Package com.dotcms.repackage.com.thoughtworks.xstream

Examples of com.dotcms.repackage.com.thoughtworks.xstream.XStream


  }

  public List <Map<String, String>> getModifiedData()  {
   
    if (modifiedData.size() > 0) {
      XStream _xstream = new XStream(new DomDriver());
      Date date = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss");
      String lastmoddate = sdf.format(date);
      File _writing = null;

      if (!new File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) {
        new File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdir();
      }
      _writing = new File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_"
          + "FixTask00005CheckHTMLPagesInconsistencies" + ".xml");

      BufferedOutputStream _bout = null;
      try {
        _bout = new BufferedOutputStream(new FileOutputStream(_writing));
      } catch (FileNotFoundException e) {

      }
      _xstream.toXML(modifiedData, _bout);
    }
    return modifiedData;
  }
View Full Code Here


    public static void objectToXML ( Object obj, File f, boolean removeFirst ) {

        if ( removeFirst && f.exists() )
            f.delete();

        XStream xstream = new XStream( new DomDriver("UTF8") );

        try {
            if ( !f.exists() ){
              f.createNewFile();
           
           
            OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream( f ), "UTF-8");
            HierarchicalStreamWriter xmlWriter = new DotPrettyPrintWriter(writer);
            xstream.marshal(obj, xmlWriter);
            writer.close();

        } catch ( FileNotFoundException e ) {
            Logger.error( PublisherUtil.class, e.getMessage(), e );
        } catch ( IOException e ) {
View Full Code Here

     *
     * @param f file to deserialize
     * @return A deserialized object
     */
    public static Object xmlToObject(File f){
      XStream xstream = new XStream(new DomDriver("UTF-8"));

      BufferedInputStream input = null;
    try {
      input = new BufferedInputStream(new FileInputStream(f));
      Object ret = xstream.fromXML(input);
      return ret;
    } catch (FileNotFoundException e) {
      Logger.error(BundlerUtil.class,e.getMessage(),e);
      return null;
    }finally{
View Full Code Here

  private Collection<File> categories;
  private XStream xstream;
 
  public PushCategoryUtil(Collection<File> categories){
    this.categories = categories;
    xstream=new XStream(new DomDriver());
  }
View Full Code Here

      temp.setStatus(detail.getStatus());
    }
  }
 
  public String getSerialized() {
    XStream xstream=new XStream(new DomDriver());
        
        String xml=xstream.toXML(this);
        return xml;
  }
View Full Code Here

        return xml;
  }
 
  public static PublishAuditHistory getObjectFromString(String serializedString) {
    PublishAuditHistory ret = null;
    XStream xstream=new XStream(new DomDriver());
    if(UtilMethods.isSet(serializedString)){
      try{
        return (PublishAuditHistory) xstream.fromXML(serializedString);
      }
      catch(Exception e){
        Logger.error(PublishAuditHistory.class, e.getMessage(), e);
      }
    }else{
View Full Code Here

  }
 
  private void doXML(List<Contentlet> cons, HttpServletResponse response, boolean render) throws IOException{
   
    XStream xstream = new XStream(new DomDriver());
    xstream.alias("content", Map.class);

    response.getWriter().println("<?xml version=\"1.0\" encoding='UTF-8'?>")
    response.getWriter().println("<contentlets>")
    for(Contentlet c : cons){
        Map m = c.getMap();
        Structure s = c.getStructure();
        for(Field f : s.getFields()){
          if(f.getFieldType().equals(Field.FieldType.BINARY.toString())){

              m.put(f.getVelocityVarName(), "/contentAsset/raw-data/" +  c.getIdentifier() + "/" + f.getVelocityVarName()  );
           
              m.put(f.getVelocityVarName() + "ContentAsset", c.getIdentifier() + "/" +f.getVelocityVarName()  );
          }
         
        }
           response.getWriter().println(xstream.toXML(m))
    }
    response.getWriter().println("</contentlets>");
    response.getWriter().flush()
    response.getWriter().close()
  }
View Full Code Here

 
  public List <Map<String, String>> getModifiedData() {

    if (modifiedData.size() > 0) {
      XStream _xstream = new XStream(new DomDriver());
      Date date = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss");
      String lastmoddate = sdf.format(date);
      File _writing = null;

      if (!new File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) {
        new File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdir();
      }
      _writing = new File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_"
          + "FixTask00003CheckContainersInconsistencies" + ".xml");

      BufferedOutputStream _bout = null;
      try {
        _bout = new BufferedOutputStream(new FileOutputStream(_writing));
      } catch (FileNotFoundException e) {

      }
      _xstream.toXML(modifiedData, _bout);
    }
    return modifiedData;
  }
View Full Code Here

    return returnValue;
  }
 
  public List <Map<String, String>> getModifiedData() {
    if (modifiedData.size() > 0) {
      XStream _xstream = new XStream(new DomDriver());
      Date date = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss");
      String lastmoddate = sdf.format(date);
      File _writing = null;
     
     
      if (!new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) {
        new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdir();
      }
     
      _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes");
     
      if (!_writing.exists()) {
        _writing.mkdirs();
      }
     
      _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_"
          + "FixTask00011RenameHostInFieldVariableName" + ".xml");
     
      BufferedOutputStream _bout = null;
      try {
        _bout = new BufferedOutputStream(new FileOutputStream(_writing));
      } catch (FileNotFoundException e) {
      }
      _xstream.toXML(modifiedData, _bout);
    }
    return modifiedData;
  }
View Full Code Here

   */

  private void doXMLFileImport(File f, PrintWriter out) {
    BufferedInputStream _bin = null;
      try {
          XStream _xstream = null;
        String _className = null;
        Class _importClass = null;
        HibernateUtil _dh = null;

        _className = f.getName().substring(0, f.getName().lastIndexOf("."));
        _xstream = new XStream(new DomDriver());
        _importClass = Class.forName(_className);
        out.println("Importing:\t" + _className);
        if (_importClass.equals(User.class)) {

        } else if (_importClass.equals(Company.class)) {

        } else {

           _dh = new HibernateUtil(_importClass);
           _bin = new BufferedInputStream(new FileInputStream(f));
           List l = (List) _xstream.fromXML(_bin);
           out.println("Found :\t" + l.size() + " " + _className + "(s)");
           String id = _dh.getSession().getSessionFactory().getClassMetadata(_importClass).getIdentifierPropertyName();
           for (int j = 0; j < l.size(); j++) {
            Object obj = l.get(j);
            if (UtilMethods.isSet(id)) {
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.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.