Package com.thoughtworks.xstream

Examples of com.thoughtworks.xstream.XStream


            return;
          }
        } else {
          // link time is up
          userRequest.getUserSession().putEntryInNonClearedStore("error.change.email.time", pT.translate("error.change.email.time"));
          XStream xml = new XStream();
          HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress());
          Identity ident = UserManager.getInstance().findIdentityByEmail(mails.get("currentEMail"));
          if (ident != null) {
            // remove keys
            ident.getUser().setProperty("emchangeKey", null);
          }
View Full Code Here


   * change email
   * @param wControl
   * @return
   */
  public boolean changeEMail(WindowControl wControl) {
    XStream xml = new XStream();
    HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress());
    Identity ident = UserManager.getInstance().findIdentityByEmail(mails.get("currentEMail"));
    if (ident != null) {
      // change mail address
      ident.getUser().setProperty("email", mails.get("changedEMail"));
      // if old mail address closed then set the new mail address
View Full Code Here

    // check if mail address scheduled to change
    RegistrationManager rm = RegistrationManager.getInstance();
    List<TemporaryKey> tk = rm.loadTemporaryKeyByAction(RegistrationManager.EMAIL_CHANGE);
    if (tk != null) {
      for (TemporaryKey temporaryKey : tk) {
        XStream xml = new XStream();
        HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(temporaryKey.getEmailAddress());
        if (emailAddress.equals(mails.get("changedEMail"))) {
          return false;
        }
      }
    }
View Full Code Here

          singleFile.add("(^_^)");
          filesList.add(singleFile);
        }
      }
     
      XStream xStream = new XStream(new XppDriver());
      xStream.setMode(XStream.NO_REFERENCES);
      String xmlString = xStream.toXML(filesList);

      log.error(xmlString);
     
      PrintWriter pw = new PrintWriter(new FileWriter(basePath+batfilePath));
        pw.println(xmlString);
View Full Code Here

      if (service == null) {
        MethodGatewayResponse mGateway = new MethodGatewayResponse();
        mGateway.setMessage("No Service given");

        XStream xStream = new XStream(new XppDriver());
        xStream.setMode(XStream.NO_REFERENCES);
        String xmlString = xStream.toXML(mGateway);

        OutputStream out = httpServletResponse.getOutputStream();

        out.write(xmlString.getBytes());
        return;
      }

      String method = httpServletRequest.getParameter("method");

      if (method == null) {
        MethodGatewayResponse mGateway = new MethodGatewayResponse();
        mGateway.setMessage("No Method given");

        XStream xStream = new XStream(new XppDriver());
        xStream.setMode(XStream.NO_REFERENCES);
        String xmlString = xStream.toXML(mGateway);

        OutputStream out = httpServletResponse.getOutputStream();

        out.write(xmlString.getBytes());
        return;
      }

      log.debug("service: " + service + " method: " + method);

      // Services

      if (service.equals("userservice")) {

        if (method.equals("getSession")) {

          Sessiondata sessionData = MainService.getInstance()
              .getsessiondata();

          XStream xStream = new XStream(new XppDriver());
          xStream.setMode(XStream.NO_REFERENCES);
          String xmlString = xStream.toXML(sessionData);

          OutputStream out = httpServletResponse.getOutputStream();

          out.write(xmlString.getBytes());
          return;
        } else if (method.equals("loginUser")) {

          String SID = httpServletRequest.getParameter("SID");
          String username = httpServletRequest
              .getParameter("username");
          String userpass = httpServletRequest
              .getParameter("userpass");

          Long returnVal = new Long(-1);

          Object obj = Usermanagement.getInstance().loginUser(SID,
              username, userpass, null, false);
          if (obj == null) {
            returnVal = new Long(-1);
          }
          String objName = obj.getClass().getName();
          log.debug("objName: " + objName);
          if (objName.equals("java.lang.Long")) {
            returnVal = (Long) obj;
          } else {
            returnVal = new Long(1);
          }

          XStream xStream = new XStream(new XppDriver());
          xStream.setMode(XStream.NO_REFERENCES);
          String xmlString = xStream.toXML(returnVal);

          OutputStream out = httpServletResponse.getOutputStream();

          out.write(xmlString.getBytes());
          return;
        } else if (method.equals("setUserObject")) {

          String SID = httpServletRequest.getParameter("SID");
          String username = httpServletRequest
              .getParameter("username");
          String firstname = httpServletRequest
              .getParameter("firstname");
          String lastname = httpServletRequest
              .getParameter("lastname");
          String profilePictureUrl = httpServletRequest
              .getParameter("profilePictureUrl");
          String email = httpServletRequest.getParameter("email");

          Long returnVal = new Long(-1);

          Long users_id = Sessionmanagement.getInstance()
              .checkSession(SID);
          Long user_level = Usermanagement.getInstance()
              .getUserLevelByID(users_id);
          if (AuthLevelmanagement.getInstance().checkAdminLevel(
              user_level)) {

            RemoteSessionObject remoteSessionObject = new RemoteSessionObject(
                username, firstname, lastname,
                profilePictureUrl, email);

            XStream xStream = new XStream(new XppDriver());
            xStream.setMode(XStream.NO_REFERENCES);
            String xmlString = xStream.toXML(remoteSessionObject);

            Sessionmanagement.getInstance()
                .updateUserRemoteSession(SID, xmlString);

            returnVal = new Long(1);
          } else {
            returnVal = new Long(-36);
          }

          XStream xStream = new XStream(new XppDriver());
          xStream.setMode(XStream.NO_REFERENCES);
          String xmlString = xStream.toXML(returnVal);

          OutputStream out = httpServletResponse.getOutputStream();

          out.write(xmlString.getBytes());
          return;
        }

      } else if (service.equals("roomservice")) {

        // public Long addRoom(String SID,
        // String name,
        // Long roomtypes_id ,
        // String comment, Long numberOfPartizipants,
        // Boolean ispublic,
        // Integer videoPodWidth,
        // Integer videoPodHeight,
        // Integer videoPodXPosition,
        // Integer videoPodYPosition,
        // Integer moderationPanelXPosition,
        // Boolean showWhiteBoard,
        // Integer whiteBoardPanelXPosition,
        // Integer whiteBoardPanelYPosition,
        // Integer whiteBoardPanelHeight,
        // Integer whiteBoardPanelWidth,
        // Boolean showFilesPanel,
        // Integer filesPanelXPosition,
        // Integer filesPanelYPosition,
        // Integer filesPanelHeight,
        // Integer filesPanelWidth) {

        if (method.equals("addRoom")) {

          String SID = httpServletRequest.getParameter("SID");
          String name = httpServletRequest.getParameter("name");
          Long roomtypes_id = Long.valueOf(
              httpServletRequest.getParameter("roomtypes_id"))
              .longValue();
          String comment = httpServletRequest.getParameter("comment");
          Long numberOfPartizipants = Long.valueOf(
              httpServletRequest
                  .getParameter("numberOfPartizipants"))
              .longValue();
          Boolean ispublic = Boolean.valueOf(
              httpServletRequest.getParameter("ispublic"))
              .booleanValue();

          Long users_id = Sessionmanagement.getInstance()
              .checkSession(SID);
          Long user_level = Usermanagement.getInstance()
              .getUserLevelByID(users_id);

          Long returnVal = Roommanagement.getInstance().addRoom(
              user_level, name, roomtypes_id, comment,
              numberOfPartizipants, ispublic, null, false, false,
              null, false, null, true, false, false, "", "", "",
              null, null, null, false);

          XStream xStream = new XStream(new XppDriver());
          xStream.setMode(XStream.NO_REFERENCES);
          String xmlString = xStream.toXML(returnVal);

          OutputStream out = httpServletResponse.getOutputStream();

          out.write(xmlString.getBytes());
          return;
View Full Code Here

      if (this.checkFileExist(filepathComplete)){
        //return new Long(-20);
        return "-20";
      }   
     
      XStream xStream = new XStream(new XppDriver());
      xStream.setMode(XStream.NO_REFERENCES);
      String xmlString = xStream.toXML(objList);   
     
      PrintWriter pw = new PrintWriter(new FileWriter(filepathComplete));
        pw.println(xmlString);
        pw.flush();
        pw.close();
View Full Code Here

       
        if (recordingConversionJob.getEndTimeInMilliSeconds().equals(0L)) {
         
          log.debug("DRAW INITIAL IMAGE");
         
          XStream xStream_temp = new XStream(new XppDriver());
          xStream_temp.setMode(XStream.NO_REFERENCES);
         
          String roomRecordingInXML = recordingConversionJob.getRecording().getRoomRecording().getInitwhiteboardvarsInXml();
         
          Map initWhiteBoardObjects = (Map) xStream_temp.fromXML(roomRecordingInXML);
         
          this.generateFileAsSVG(initWhiteBoardObjects, roomRecordingInXML, recordingConversionJob);
            
        } else {
         
          log.debug("DRAW NEXT IMAGE");
         
          if (recordingConversionJob.getRecording().getDuration() >= recordingConversionJob.getEndTimeInMilliSeconds()) {
         
            List<WhiteBoardEvent> whiteBoardEventList = WhiteBoardEventDaoImpl.getInstance().
                getWhiteboardEventsInRange(
                    recordingConversionJob.getEndTimeInMilliSeconds(),
                    recordingConversionJob.getEndTimeInMilliSeconds()+(numberOfMilliseconds-1),
                    recordingConversionJob.getRecording().getRoomRecording().getRoomrecordingId());
           
           
            log.debug("whiteBoardEventList SIZE "+whiteBoardEventList.size());
           
            XStream xStream_temp = new XStream(new XppDriver());
            xStream_temp.setMode(XStream.NO_REFERENCES);
           
            String roomRecordingInXML = recordingConversionJob.getCurrentWhiteBoardAsXml();
            Map whiteBoardObjects = (Map) xStream_temp.fromXML(roomRecordingInXML);
             
            //Do simulate Whiteboard Events in Temp Object
           
            for (WhiteBoardEvent whiteBoardEvent : whiteBoardEventList) {
             
              log.debug("whiteBoardEvent: "+whiteBoardEvent.getStarttime());
             
              XStream xStream_temp_action = new XStream(new XppDriver());
              xStream_temp_action.setMode(XStream.NO_REFERENCES);
             
              Map actionObj = (Map) xStream_temp_action.fromXML(whiteBoardEvent.getAction());
             
              log.debug("whiteBoardEvent: "+actionObj);
             
              Date dateOfEvent = (Date) actionObj.get(1);
              String action = actionObj.get(2).toString()
              Map actionObject = (Map) actionObj.get(3);
             
              log.debug("action: "+action);
             
              if (action.equals("draw") || action.equals("redo")){
               
                //log.debug(actionObject);
                //log.debug(actionObject.size()-1);
                //log.debug(actionObject.get(actionObject.size()-1));
               
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                log.debug("objectOID: "+objectOID);
                whiteBoardObjects.put(objectOID, actionObject);
              } else if (action.equals("clear")) {
                whiteBoardObjects = new HashMap<String,Map>();
              } else if (action.equals("delete") || action.equals("undo")) {
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                log.debug("removal of objectOID: "+objectOID);
                whiteBoardObjects.remove(objectOID);
              } else if (action.equals("size") || action.equals("editProp")
                  || action.equals("editText")) {
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                //Map roomItem = (Map) whiteBoardObjects.get(objectOID);
                whiteBoardObjects.put(objectOID, actionObject);
               
              } else {
                log.warn("Unkown Type: "+action+" actionObject: "+actionObject);
              }
             
            }
           
            XStream xStream_temp_store = new XStream(new XppDriver());
            xStream_temp_store.setMode(XStream.NO_REFERENCES);
            String roomRecordingInXMLToSave = xStream_temp_store.toXML(whiteBoardObjects);
           
            this.generateFileAsSVG(whiteBoardObjects, roomRecordingInXMLToSave, recordingConversionJob);
         
          } else {
           
View Full Code Here

       
        if (recordingConversionJob.getEndTimeInMilliSeconds().equals(0L)) {
         
          log.debug("DRAW INITIAL IMAGE");
         
          XStream xStream_temp = new XStream(new XppDriver());
          xStream_temp.setMode(XStream.NO_REFERENCES);
         
          String roomRecordingInXML = recordingConversionJob.getRecording().getRoomRecording().getInitwhiteboardvarsInXml();
         
          Map initWhiteBoardObjects = (Map) xStream_temp.fromXML(roomRecordingInXML);
         
          this.generateFileAsSVG(initWhiteBoardObjects, roomRecordingInXML, recordingConversionJob);
            
        } else {
         
          log.debug("DRAW NEXT IMAGE");
         
          if (recordingConversionJob.getRecording().getDuration() >= recordingConversionJob.getEndTimeInMilliSeconds()) {
         
            List<WhiteBoardEvent> whiteBoardEventList = WhiteBoardEventDaoImpl.getInstance().
                getWhiteboardEventsInRange(
                    recordingConversionJob.getEndTimeInMilliSeconds(),
                    recordingConversionJob.getEndTimeInMilliSeconds()+(numberOfMilliseconds-1),
                    recordingConversionJob.getRecording().getRoomRecording().getRoomrecordingId());
           
           
            log.debug("whiteBoardEventList SIZE "+whiteBoardEventList.size());
           
            XStream xStream_temp = new XStream(new XppDriver());
            xStream_temp.setMode(XStream.NO_REFERENCES);
           
            String roomRecordingInXML = recordingConversionJob.getCurrentWhiteBoardAsXml();
            Map whiteBoardObjects = (Map) xStream_temp.fromXML(roomRecordingInXML);
             
            //Do simulate Whiteboard Events in Temp Object
           
            for (WhiteBoardEvent whiteBoardEvent : whiteBoardEventList) {
             
              log.debug("whiteBoardEvent: "+whiteBoardEvent.getStarttime());
             
              XStream xStream_temp_action = new XStream(new XppDriver());
              xStream_temp_action.setMode(XStream.NO_REFERENCES);
             
              Map actionObj = (Map) xStream_temp_action.fromXML(whiteBoardEvent.getAction());
             
              log.debug("whiteBoardEvent: "+actionObj);
             
              Date dateOfEvent = (Date) actionObj.get(1);
              String action = actionObj.get(2).toString()
              Map actionObject = (Map) actionObj.get(3);
             
              log.debug("action: "+action);
             
              if (action.equals("draw") || action.equals("redo")){
               
                //log.debug(actionObject);
                //log.debug(actionObject.size()-1);
                //log.debug(actionObject.get(actionObject.size()-1));
               
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                log.debug("objectOID: "+objectOID);
                whiteBoardObjects.put(objectOID, actionObject);
              } else if (action.equals("clear")) {
                whiteBoardObjects = new HashMap<String,Map>();
              } else if (action.equals("delete") || action.equals("undo")) {
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                log.debug("removal of objectOID: "+objectOID);
                whiteBoardObjects.remove(objectOID);
              } else if (action.equals("size") || action.equals("editProp")
                  || action.equals("editText")) {
                String objectOID = actionObject.get(actionObject.size()-1).toString();
                //Map roomItem = (Map) whiteBoardObjects.get(objectOID);
                whiteBoardObjects.put(objectOID, actionObject);
               
              } else {
                log.warn("Unkown Type: "+action+" actionObject: "+actionObject);
              }
             
            }
           
            XStream xStream_temp_store = new XStream(new XppDriver());
            xStream_temp_store.setMode(XStream.NO_REFERENCES);
            String roomRecordingInXMLToSave = xStream_temp_store.toXML(whiteBoardObjects);
           
            this.generateFileAsSVG(whiteBoardObjects, roomRecordingInXMLToSave, recordingConversionJob);
         
            return true;
          } else {
View Full Code Here

      LinkedHashMap lMap = new LinkedHashMap();
      String filepathComplete = filePath+wmlFolderName+fileName;
     
      log.error("filepathComplete: "+filepathComplete);
     
      XStream xStream = new XStream(new XppDriver());
      xStream.setMode(XStream.NO_REFERENCES);
     
      BufferedReader reader = new BufferedReader(new FileReader(filepathComplete));
        String xmlString = "";
        while (reader.ready()) {
          xmlString += reader.readLine();
        }
     
        //lMap = (LinkedHashMap) xStream.fromXML(xmlString);
       ArrayList lMapList = (ArrayList) xStream.fromXML(xmlString);
     
      return lMapList;
    } catch (Exception err){
      log.error("loadWmlFile",err);
    }
View Full Code Here

            LinkedHashMap lMap = new LinkedHashMap();
            String filepathComplete = filePath + fileName + fileExt;

            log.error("filepathComplete: " + filepathComplete);

            XStream xStream = new XStream(new XppDriver());
            xStream.setMode(XStream.NO_REFERENCES);

            BufferedReader reader = new BufferedReader(new FileReader(
                    filepathComplete));
            String xmlString = "";
            while (reader.ready()) {
                xmlString += reader.readLine();
            }

            // lMap = (LinkedHashMap) xStream.fromXML(xmlString);
            ArrayList lMapList = (ArrayList) xStream.fromXML(xmlString);

            return lMapList;
        } catch (Exception err) {
            log.error(err);
        }
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.XStream

Copyright © 2018 www.massapicom. 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.