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

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


    }
  }

  @SuppressWarnings("unchecked")
  protected void processXML(Contentlet contentlet, InputStream input) {
    XStream xstream=new XStream(new DomDriver());
    xstream.alias("content", Map.class);
    xstream.registerConverter(new MapEntryConverter());
    Map<String,Object> root=(Map<String,Object>) xstream.fromXML(input);
    processMap(contentlet,root);
  }
View Full Code Here


            }
        }

        // jira.dotmarketing.net/browse/DOTCMS-1073
        if (perCons.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);
            java.io.File _writing = null;
            java.io.File _writingwbin = null;

            java.io.File backupFolder = new java.io.File(backupPath);
            if (!backupFolder.exists()) {
                backupFolder.mkdirs();
            }
            for(Contentlet cont:perCons){
                Structure st=cont.getStructure();
                List <Field> fields= st.getFields();
                List<Map<String,Object>> filelist = new ArrayList<Map<String,Object>>();
                ContentletAndBinary contentwbin= new ContentletAndBinary ();
                contentwbin.setMap(cont.getMap()) ;
                Boolean arebinfiles=false;
                java.io.File file=null;
                for(Field field:fields){
                    if(field.getFieldType().equals(Field.FieldType.BINARY.toString())){
                        try{
                            file = getBinaryFile(cont.getInode(), field.getVelocityVarName(), user);
                        }catch (Exception ex) {
                            Logger.debug(this, ex.getMessage(), ex);
                        }
                        if (file != null) {
                            byte[] bytes = null;
                            try {
                                bytes = FileUtil.getBytes(file);
                            } catch (IOException e) {
                            }
                            Map<String,Object> temp = new HashMap<String,Object>();
                            temp.put(file.getName(), bytes);
                            filelist.add(temp);
                            arebinfiles = true;
                        }
                    }
                }

                _writing = new java.io.File(backupPath + java.io.File.separator + cont.getIdentifier().toString() + ".xml");
                _writingwbin = new java.io.File(backupPath + java.io.File.separator + cont.getIdentifier().toString() + "_bin" + ".xml");
                BufferedOutputStream _bout = null;

                if(!arebinfiles){
                    try {
                        _bout = new BufferedOutputStream(new FileOutputStream(_writing));
                    } catch (FileNotFoundException e) {
                    }
                    _xstream.toXML(cont, _bout);
                }
                else{
                    try {
                        _bout = new BufferedOutputStream(new FileOutputStream(_writingwbin));
                    } catch (FileNotFoundException e) {

                    }
                    contentwbin.setBinaryFilesList(filelist);
                    _xstream.toXML(contentwbin, _bout);
                    arebinfiles=false;
                }
            }

        }
View Full Code Here

            indexAPI.removeContentFromIndex(contentlet);
            CacheLocator.getIdentifierCache().removeFromCacheByVersionable(contentlet);
        }

        if (contentlets.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);
            java.io.File _writing = null;

            java.io.File backupFolder = new java.io.File(backupPath);
            if (!backupFolder.exists()) {
                backupFolder.mkdirs();
            }
            _writing = new java.io.File(backupPath + java.io.File.separator + lastmoddate + "_" + "deletedcontentlets" + ".xml");

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

            }
            _xstream.toXML(contentlets, _bout);
        }
        // jira.dotmarketing.net/browse/DOTCMS-1073
        deleteBinaryFiles(contentletsVersion,null);

    }
View Full Code Here

                    mapResponse.put( "separator", separator );

                    bundlesArray.add( mapResponse );
                }

                XStream xstream = new XStream( new DomDriver() );
                xstream.alias( "response", ArrayList.class );

                StringBuilder xmlBuilder = new StringBuilder();
                xmlBuilder.append( "<?xml version=\"1.0\" encoding='UTF-8'?>" );
                xmlBuilder.append( xstream.toXML( bundlesArray ) );

                responseMessage.append( xmlBuilder );
            } else {

                JSONArray bundlesArray = new JSONArray();
View Full Code Here

                mapResponse.put( "success", true );
                mapResponse.put( "message", "Success message" );
                mapResponse.put( "param1", param1 );
                mapResponse.put( "param2", param2 );

                XStream xstream = new XStream( new DomDriver() );
                xstream.alias( "response", Map.class );

                StringBuilder xmlBuilder = new StringBuilder();
                xmlBuilder.append( "<?xml version=\"1.0\" encoding='UTF-8'?>" );
                xmlBuilder.append( xstream.toXML( mapResponse ) );

                responseMessage.append( xmlBuilder );
            } else {

                //TODO: Handle JSON and JSONP the same
View Full Code Here

                mapResponse.put( "success", true );
                mapResponse.put( "message", "Success message" );
                mapResponse.put( "param1", param1 );
                mapResponse.put( "param2", param2 );

                XStream xstream = new XStream( new DomDriver() );
                xstream.alias( "response", Map.class );

                StringBuilder xmlBuilder = new StringBuilder();
                xmlBuilder.append( "<?xml version=\"1.0\" encoding='UTF-8'?>" );
                xmlBuilder.append( xstream.toXML( mapResponse ) );

                responseMessage.append( xmlBuilder );
            } else {

                //TODO: Handle JSON and JSONP the same
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.