Examples of StaticDataHelper


Examples of com.funambol.syncclient.util.StaticDataHelper

            printFolderInfo(folders[i]);
        }
    }
   
    public static void printMessageInfo(Message msg) {
        StaticDataHelper s = new StaticDataHelper();
       
        s.log("[DEBUG]msg.folder: " + msg.getFolder().getName() +
                " [" + msg.getFolder().toString() + "]");
        s.log("[DEBUG]msg.folder.id: " + msg.getFolder().getId());
       
        switch (msg.getFolder().getType()){
            case Folder.OUTBOX: s.log("[DEBUG]msg.folder.type: OUTBOX"); break;
            case Folder.SENT:   s.log("[DEBUG]msg.folder.type: SENT"); break;
            case Folder.INBOX:  s.log("[DEBUG]msg.folder.type: INBOX"); break;
            case Folder.DRAFT:  s.log("[DEBUG]msg.folder.type: DRAFT"); break;
        }
       
        switch (msg.getStatus()){
            case Message.Status.TX_SENT: s.log("[DEBUG]msg.status: TX_SENT"); break;
            case Message.Status.TX_PENDING: s.log("[DEBUG]msg.status: TX_PENDING"); break;
            case Message.Status.TX_SENDING: s.log("[DEBUG]msg.status: TX_SENDING"); break;           
            case Message.Status.TX_GENERAL_FAILURE: s.log("[DEBUG]msg.status: TX_GENERAL_FAILURE"); break;
            case Message.Status.TX_ENCRYPTING: s.log("[DEBUG]msg.status: TX_ENCRYPTING"); break;
            case Message.Status.TX_COMPOSING: s.log("[DEBUG]msg.status: TX_COMPOSING"); break;
            case Message.Status.TX_COMPRESSING: s.log("[DEBUG]msg.status: TX_COMPRESSING"); break;
            case Message.Status.TX_DELIVERED: s.log("[DEBUG]msg.status: TX_DELIVERED"); break;
            case Message.Status.TX_ERROR:
                s.log("[DEBUG]msg.status: TX_ERROR");
                s.log("[DEBUG]msg.transMissionError: " + msg.getTransmissionError());
                break;
            default:
                s.log("[DEBUG]msg.status:"+msg.getStatus());
        }
        int flags = msg.getFlags();
        if ( (flags & Message.Flag.SAVED) != 0 )
            s.log("[DEBUG]msg.flag: SAVED");
        if ( (flags & Message.Flag.SAVED_THEN_ORPHANED) != 0 )
            s.log("[DEBUG]msg.flag: SAVED_THEN_ORPHANED");
        if ( (flags & Message.Flag.FILED) != 0 )
            s.log("[DEBUG]msg.flag: FILED");
    }
View Full Code Here

Examples of com.funambol.syncclient.util.StaticDataHelper

            if (!signal) {
                throw new NetworkException();
            }
      
            try {
                StaticDataHelper sdh = new StaticDataHelper();
               
                byte[] dataToSend = request.getBytes();//the SyncML message to send in byte form
                   
                // ----------------------------------------------------------------------------------------------------------              
                String sessionId = SyncManagerImpl.session_id;
                StaticDataHelper.log("### Opening the connection nr. " + ++(SyncManagerImpl.c) + " in session " + sessionId);
               
                httpCon = (HttpConnection)Connector.open(requestURL + ";deviceside=true");//'true' direct TCP, 'false' proxy TCP (MDS)
               
                String url = httpCon.getURL();
                String jsessionid;
                String jsessionidParam = "jsessionid=";
                String devicesideParam = ";deviceside=";
                //StaticDataHelper.log("[DEBUG] URL: " + url);
                int startIndex = url.indexOf(jsessionidParam) + jsessionidParam.length();
                int endIndex = url.indexOf(devicesideParam);
                //StaticDataHelper.log("[DEBUG] startIndex: " + startIndex);
                //StaticDataHelper.log("[DEBUG] endIndex: " + endIndex);
                if (url.indexOf(jsessionidParam) != -&& endIndex != -1) {
                    jsessionid = url.substring(startIndex, endIndex);
                } else {
                    jsessionid = "jsessionid from server not yet available";
                }
                               
                StaticDataHelper.log("### Connection nr. " + SyncManagerImpl.c + " in session " + sessionId + " [" + jsessionid + "] opened");
                // --------------------------------------------------------------------------------------------------------------------------------------
               
                httpCon.setRequestMethod(HttpConnection.POST);
               
                httpCon.setRequestProperty (PROP_USER_AGENT,
                                            "BlackBerry/" + sdh.getOS());
                httpCon.setRequestProperty (PROP_CONTENT_LENGTH,
                                            String.valueOf(dataToSend.length));
                httpCon.setRequestProperty (PROP_CONTENT_TYPE,
                                            "application/vnd.syncml+xml");
           
View Full Code Here

Examples of com.funambol.syncclient.util.StaticDataHelper

         * bug augmenting the End date
         * by a day
         */
        long oneDay = 0;//bug 1189

        StaticDataHelper sdh = new StaticDataHelper();
        String osVersion = sdh.getOS();

        if (list.isSupportedField(field)) {
            try {
                value = event.getDate(field, 0);
                StaticDataHelper.log("[LOG]Retrieving from device date to add to SIF-E: "
                                     + new Date(value).toString() + "[" + value + "]");
            } catch (Exception e) {
                StaticDataHelper.log(">>>Exception in XMLEventParser.appendFieldDate() "
                                     + "--> Field not set: " + tag + " e.toString(): "
                                     + e.toString());
            }
           
            //a Calendar in GMT
            Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));//getInstance()
            //the date in the local time zone
            Date evdate = new Date(value);
            //the offset of the local time zone
            offset = getTimeZoneOffSet(evdate);
            //the calendar receives the local date as it was GMT
            cal.setTime(new Date(value - offset));

            // If the year is 1970, It can be to fix, check the cache.
            if (cal.get(cal.YEAR) <= 1970) {
               
                /*
                 * this check is to fix a bug introduced
                 * with the caching feature. In fact, the
                 * object cacheData is initialized only
                 * in the method parseEvent(), that is
                 * invoked only on data coming from the
                 * server to the client. When data is
                 * transferred only from the client to
                 * the server, the variable is not
                 * initialized, and a NullPointerException
                 * is thrown
                 */
                if (cacheData != null) {
                    Long cd = (Long)cacheData.get(tag);
                    if (cd != null) {
                        long cached = cd.longValue();
                        if (cached < 0) {
                            // Restore the original date prior to 01/01/1970
                            value = cached;
                            evdate = new Date(value);
                            cal.setTime(evdate);
                        }
                    }
                }
            }

            if (allday) {
                format = DATETIME_FORMAT_ALLDAY;//"yyyy-MM-dd"
               
                // If it's an end date and it's past 01/01/1970,
                // check if it has to be fixed.
                if (isBuggy("allday") && tag.equals(END) && value > 0) { //allday <End>
                   
                    long start = event.getDate(event.START, event.ATTR_NONE);
                    StaticDataHelper.log("[LOG]'value' -> " + new Date(value).toString());
                    StaticDataHelper.log("[LOG]'start' -> " + new Date(start).toString());
                   
                    // If the event is changed, or it is new, we must fix
                    // the end before sending it out.
                    if (isEventChanged(start, value)) {//'value' is here the end date
                        oneDay = 24*60*60*1000;
                    }
                }
            } else {//not allday
                format = DATETIME_FORMAT_UTC;//"yyyyMMdd'T'HHmmss'Z'"
            }

            SimpleDateFormat formatter = new SimpleDateFormat(format);
            // FIXME: why cal.getTime().getTime() should be different from value?
            sdh.log(">>>original date: " + new Date(cal.getTime().getTime()).toString());
            formattedDate = formatter.format( new Date(cal.getTime().getTime() - oneDay) );
            sdh.log(">>>fixed date: " + formattedDate);
           
            /*
             * this is to use the start date
             * information of the <Start>
             * element as content for the not supported
View Full Code Here

Examples of com.funambol.syncclient.util.StaticDataHelper

        int  offset = 0 ;

        Calendar date  = null ;

        StaticDataHelper sdh = new StaticDataHelper();

        String osVersion = sdh.getOS();

        //removed fixing bug 867
        //offset =  24 * 60 * 60 * 1000;
      
        day    = Integer.parseInt(field.substring(8, 10));//xxxxxxxx10
View Full Code Here

Examples of com.funambol.syncclient.util.StaticDataHelper

    private boolean checkOS(String os)
    {
        // bugfix 870 ------------------------------------
        if (os == null || os.length() == 0)
        {
            StaticDataHelper sdh = new StaticDataHelper();
            sdh.setOS();
            os = sdh.getOS();
        }  
        if (os == null)
        {
            return false;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.