Method of subscription to SubscriptionService replace the existing subscriber data

Hello

I wrote a servlet that is customized to manage the logic of subscription request to my initiating service to push (instead of using the class SubscriptionServlet ) and inside the servlet I call the method SubscriptionService to subscribe and pass a SubscribeRequest instance with the subscription data.

When I run my subscription logic in a Unit Test, it runs successfully and persists in the Subscriber data in the mysql database, but when I run the Unit Test with a different address and a different subscriberId kept the first Subscriber data is deleted and the new data to the Subscriber are saved.

The code that I use for this is:

                //subscriber object is a propietary class which contains a Map with the subscriber data                Map attributes = subscriber.getSubscriberAttributes();
        SubscriptionService service = SubscriptionBeanLocator.getSubscriptionService();
        String appId = attributes.get(APP_ID).toString();
        String newId =  idGenerator.generateId();

        PushApplication pushApplication = getBbPushApplicationManager().getPushApplication();

        if(pushApplication == null){
            throw new SubscriptionException("No existe una aplicación push configurada");
        }

        if(!pushApplication.getId().equals(appId)){
            throw new SubscriptionException("La aplicación especificada no existe");
        }

        logger.info("Generated New ID for Subscriber : " + newId);

        SubscribeRequest subscribeRequest = new SubscribeRequest();
        subscribeRequest.setPushApplicationId(appId);
        subscribeRequest.setSubscriberId(newId);
        subscribeRequest.setAddress(attributes.get(BB_PIN).toString());
        subscribeRequest.setOsVersion(attributes.get(OS_VERSION).toString());
        subscribeRequest.setModel(attributes.get(DEVICE_MODEL).toString());
        subscribeRequest.setType(SubscriberType.PUBLIC); 

        try {
             service.subscribe(subscribeRequest);
        } catch (InvalidPushAppException e) {
            throw new SubscriptionException("La aplicación especificada no éxiste");
        } catch (CPSubscriptionFailureException e) {
            throw new SubscriptionException("Hubo Problemas mientras se procesaba la suscripcion");
        } catch (PushSDKException e) {
            throw new SubscriptionException("Error interno en el sistema");
        }

In the API Documentation, there is not any specific information on the requirements of the Subscriber of the query data or sign-up for the use of the SubscriberService method.

Please I need your help

Thanks in advance

I solved this problem. I delete my application by mistake and because of that my registered subscribers was eliminated too.

Tags: BlackBerry Developers

Similar Questions

  • Write that VI PNG file will not replace the existing file

    Hi all

    I use VI file PNG write to store the graph in a png file. I am able to save the file with a specific file name, which includes the date, model number, serial number etc.. Once the chart is saved as a png file, if I make changes in the graph (as autoscale, turn captions etc.) and try again to save the file with the same file name, write PNG leader VI does not save the changes I made on the chart. I'm looking at the timestamp on the windows Explorer, but it is not updated. I opened the VI itself (which is write protected) to see if it generates an error if I provided the same file name, but it does not generate an error.

    I don't know if I am missing anything.

    Can you people please help me find a way to replace the existing PNG file?

    I'm using LabVIEW 2013 on Win 7 machine.

    p.s. I use the second method mentioned in this article:

    http://digital.NI.com/public.nsf/allkb/5AE4ADCBB65A6D8F86256FBF007A1AC1

    (Programmatically with the Get Image method).

    Thanks for your help

    OPR

    OPR wrote:
    ... Write VI PNG file does not save the changes I made on the chart. I'm looking at the timestamp on the windows Explorer, but it is not updated.

    You are also looking at the image itself? Explorer Windows cannot update the timestamp in the display immediately, or you might be looking at creation time, which doesn't seem to change when you replace a file.

    I can say that I saw a similar question very recently (he was also PNG, even if it's not really relevant), and here it certainly crushes - http://forums.ni.com/t5/LabVIEW/LAVA-snippet-overwrite-keeps-old-date-time-of-png-file/m-p/3257059#M...

  • This morning, I received an invitation to update, I 'agreed '. The upgrade has replaced the existing version of Firefox. How can I go back to the version I was using? Help!

    Upgrade to V8 replaced the existing version of Firefox. That's when I found that the V8 does not work with my OS

    Thank you Matt... If I had been able to quickly locate the table with earlier versions of Firefox, I would have been able to solve this problem as soon as possible.

    I'm still not that when asked if Firefox was running slow click on upgrade and when I did, went from 3.n.n in V8.

  • OfficeJet Pro 8600 more: Saving scan to file, always asking to replace the existing file.

    When I scan a document using the software on my computer, it asks to save it.  When I say yes, it saves it in a new folder I did. But he still wants to replace the existing analysis.  I want that each new scan to be named Scan0001, Scan0002 etc.  I want to keep a copy of all the scans I'm emailing them, or simply keep a copy on my computer.

    I think I just found my own solution.  He has the ability to "see him save as dialog".  I think that it should be disabled.

  • copy / paste does not replace the existing file

    Hello

    Sometimes, I copy a jpeg file and passed in a folder.  This file has the same file name.  but after having stuck to it, I noticed that there are 2 files with the same name.
    How can I get to replace this file?
    Thank you

    Hello

    Sometimes, I copy a jpeg file and passed in a folder.  This file has the same file name.  but after having stuck to it, I noticed that there are 2 files with the same name.
    How can I get to replace this file?
    Thank you

    If you paste a file into a folder that already has a file with the SAME file name, you will be informed and asked to choose one of the following:
    1. do not copy
    2. copy and replace those already on file
    3. copy and keep both.

    Perhaps, you have chosen the 3rd weight?

    modification of...

    It will not replace the existing file, unless both have EXACTLY the same file name.

  • I downloaded red CS6 plugin and added to the contents of the package, replaced the existing files with the new without saving, now my thumbnails images RED and the color correction do not WORK! How to bring back my old file importerRed! ?? Help!

    I downloaded red CS6 plugin and added to the contents of the package, replaced the existing files with the new without saving, now my thumbnails images RED and the color correction do not WORK! How to bring back my old file importerRed! ?? Help!

    Try asking in the forum Premiere Pro seems to be an Adobe first Pro Lab

  • ODI can load data into the planning and REPLACE the existing data?

    Hello
    ODI (9.3.1.1) can load data into the planning and REPLACE the existing data?
    Currently of our ODI by "ADD" load to existing data data - so that is I accidentally run the load twice, it would be double planning numbers. I don't know how to do it to REPLACE so that running more than twice has no effect.

    With the help of the essbase adapter you would use a rule of load, in the State of charge, you can set whether to replace or add to existing values. It is not difficult to pass.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • E 8610 HP MFP: install new printer HP 8610 to replace the existing HP J6450

    I am about to install a new printer HP 8610 to replace my current HP J6450 printer. Should I uninstall the existing drivers and the HP Solution Center software? (That was an unpleasant task in the past). Currently the W10.

    Hello

    The new printer should use the HP printer Assistant software.

    Kind regards.

  • Replace the existing values in the BSO

    I use a rule of load to load the data from a SQL table. The SQL table has multiple records with the same combination of dimension.

    For example, if I have:

    Sheet 1: East soda sales 10
    Sheet 2: East soda sales 10

    When I use "replace existing values", and I question the intersection, I get 10. When I use Add to the existing values, assuming that it was nothing first, I get 20.

    I know Aso, you can use the buffer load to records of amount with the same intersection in the cube before loading to the database. My question is, should I use a SQL sum in the State of charge (since I can't create a view that aggregates), or is there some other facility in environmental assessments which allows to replace what is in the cube, but not replacement when the intersection itself appears twice in the same load of data.

    Thanks for your time.

    Published by: user12268822 on November 29, 2012 12:28

    If you want to replace what you have in the BSO cube with the sum of the values of the SQL, then you will need to use the money in your SQL query.

  • Create table replaces the existing table in mssql

    In a program that allows us to update our sites, we use the function 'create an array' of MS SQL to create missing tables in databases.

    Thousands of time we used it, if a table already exists with the same name of the table in the create table MS SQL survey command an error.

    In fact, MS SQL documentation indicates that only if you include the optional 'replace' command, will be a replaced existing table.

    But today, we used this program on a new host, that we are trying, and the create table command actually did replace an existing table with a new table, delete all the records from the old table.

    I'm trying to understand what this would allow the settings at the server level.

    This is the code we use:

    < CFQUERY NAME = "recipe" DATASOURCE = "recipe" dbtype = "ODBC" username = "" #ruser # "password =" #rPASS #">"
    Create table recipecats)
    RecipecatID int IDENTITY(1, 1) NOT NULL PRIMARY KEY,
    recipecatdescription NVARCHAR (50) NULL)
    < / cfquery >

    Are you sure that this is not just to create another table with the same name, but one
    different owner?

    I saw the strangeness (it's probably just weird for me because I am ignorant)
    of what is happening), I can READ a table owned by another user without
    calling the name of the table with its owner, and when I go to CREATE a table
    of the same name, it is actually created as my current user and subsequently when
    you ask the name of the full table, I get the results of one, is not new
    the former. If I'm right in the name of the table, I can ask both/either. Kind
    way similar CF hunting around different scopes when you aren't eligible one
    reference to a variable.

    Also, your code should probably be testing to see if the table exists
    before you try to create it anyway. "Just try and catch.
    "If it errors" is not considered as 'test' if there is

    --
    Adam

  • Not enough Drive Space Error when only to replace the existing files in the copy

    Hi, I have same directories. It is on the D drive and the other is on the E drive. Both drives are 2 TB in size and rich. All files are 262 MB in size. I need to copy all the files from drive E on the D drive, since all files on drive E have video data and files on the D drive are not, although they are the same size files. When I try to copy and replace the files in drive E D, I get an error message indicating that I don't have enough disk space. It is sufficient as I am only to replace the files. No new additional file is copied. What can I do?

    If the files on the 'E' have video and those of 'd' only that they may not have the same size.

    Second, you must be almost 2 x the space to copy files as they are the copy in a folder "tmp".

    If the files are the same on D and E, why don't delete you those without video and move those with?

  • Download file to replace the existing one, without change of name

    We have files on our server that we need to have dedicated and stable names, like change us them periodically and we always want to have the same name. When download us them through Contribute, the software automatically adds a suffix to them, making them not the same file name to one that we need to replace. I can understand why this might do it for security reasons, if someone changes the file and then replace the work of someone, say. But we want to disable it.

    For example, if I have a file named form.pdf, when I made edits to it, I need to replace the previous version of form.pdf. Instead, Contribute calls this form of form001.pdf, which makes it DO NOT crush him.

    Is that somewhere in the permissions? Help, please.

    Thank you

    Annie

    To get the right to replace the similar version of orPublish,

    activate the option "Allow users to delete files, they are allowed to change" in the edit role setting dialog box.

    To reach this dialog,

    1. Administer the Web site.
    2. Select the role you want to make this setting.
    3. Click on change settings for role...
    4. Select the folder/file access category.

    Hope this helps you.

  • It is possible to omit the popup warns "do you want to replace the existing file?

    Well, the title says already

    I have an application where the user can save the results to a log file; These data are added

    (using OpenFile (file_name, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII), so the opening of this file will not replace its content, but it adds up.) It would be appropriate to use the same file.

    Unfortunately, when the caller (FileSelectPopupEx) and selecting an existing file of the warning that appears the file already exists. It's OK. But the message keeps saying "want to replace you? In this case, this message is quite confusing for the user, because the program will not replace anything (which of course does not function FileSelectPopupEx).

    So I was wondering if it is possible to avoid or change this message popup?

    Thank you!

    What constant you spent buttonLabel parameter? The behavior of the function changes depending on the indicated button. In particular, (citing the help):

    Note   If VAL_SELECT_BUTTON or VAL_LOAD_BUTTON is passed to the parameter buttonLabel, FileSelectPopupEx service confirms that the selected file exists. If the file does not exist, the function prompts the user to select an existing file.

    Using the button "Save" should result in the confirmation message that you face now.

    I guess if you are using the simple OK button no prompt (to confirm: I'm not sure but I can't test it at the moment).

  • Replace the existing files.

    Hi Forum, using the code below, im copy links to the particular folder.

    The problem is when I copy links to file individual and if the folder already has the same links (file name).

    The file is copied to the _1 instead of replace directly.

    var = app.documents relationships [0] .links;

    MyServer = Folder("/Users/rajni/Desktop/TestLink");

    KY = myserver.path + "/" + myserver.name;

    for (var i = 0; i < theLinks.length; i ++)

    {

    Troubleshoot [i] (myserver) .copyLink;

    }

    I don't want to copy the links of the path of the link and replace in the specific folder (if the folder already has the same link).

    Forum! Any help on this.

    Hello

    Change the var statement:

    var mDoc = app.activeDocument,
    destFolder = Folder(mDoc.filePath).parent + "/LINKS DOC/",
    k, currLink, currFile, currName, destFile;
    
    if(!Folder(destFolder).exists)
         Folder(destFolder).create();
    
    for (k = 0 ; k < mDoc.links.length; k++) {
         currLink = mDoc.links[k];
         currFile = File(currLink.filePath);
         currName = currFile.name;
         destFile = File(destFolder + currName);
         currFile.copy(destFile);
         }
    

    Jarek

  • "You want to replace the existing folder with the new?

    How can I find the old file I accidentally replaced with a new one (they had the same name)?

    I use OS X El Capitan

    Restore it from a backup, or try using a waste product of data, such as those listed here. Do not write on the disc until the files are recovered or you choose not to recover them.

    If utilities do not work, you can contact a professional data recovery service, but these can charge hundreds or thousands of dollars.

    (144366)

Maybe you are looking for

  • Satellite A50, I can't burn DVD

    Hi allI can't Format DVD?And I can't the DVD Burning? Note: I have the Toshiba satalite A50 modeland it is having the writable DVD. Help me please... Thank you

  • Satellite A60: Problem of memory after update Bios V.1.9

    Hi all I've just updated my bios to version 1.9 last week. Previously, I've upgraded my RAM from 512 MB to 1.5 GB (P4 2.8 GHz., 40 GB HARD drive) and my phone worked perfectly with the old Bios and RAM. After the Bios Update to the new version, 1.9,

  • need to rest by car to its original merger

    Greeting I get my iMac with a clean install and I think I re-partition my drive also. After more than a week, I noticed the difference in speed when running applications and start the system, I check my disk in disk utilities it shows two disks (disk

  • Best router for incoming Windows remote access

    Helloyou have a question of a client that is located on an Active Directory Server with a box of Windows Server 2008 running the remote access server. What firewall might recommend that allow connections from the Internet on to the incoming client Wi

  • fact my aspire 5517 notebook series have built in microphone?

    I tried to get my microphone to work for use in my Skype calls. I do not know if the series aspire 5517 laptop has one built and if yes, how can I get it to work?