Package com.projity.server.data

Examples of com.projity.server.data.DataUtil


    public static Job getImportFileJob(final FileImporter importer){
      final Job job=new Job(importer.getJobQueue(),"importFile",Messages.getString("LocalFileImporter.Importing"),true); //$NON-NLS-1$ //$NON-NLS-2$
        job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
        public Object run() throws Exception{
              DataUtil serializer=new DataUtil();
              System.out.println("Loading "+importer.getFileName()+"..."); //$NON-NLS-1$ //$NON-NLS-2$

              long t1=System.currentTimeMillis();
              ObjectInputStream in=new ObjectInputStream(new FileInputStream(importer.getFileName()));
              Object obj=in.readObject();
              if (obj instanceof String) obj=in.readObject(); //check version in the future
              DocumentData projectData=(DocumentData)obj;
              projectData.setMaster(true);
              projectData.setLocal(true);
              long t2=System.currentTimeMillis();
              System.out.println("Loading...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$


              System.out.println("Deserializing..."); //$NON-NLS-1$
              t1=System.currentTimeMillis();
//              project=serializer.deserializeProject(projectData,false,true,resourceMap);
              importer.setProject(serializer.deserializeLocalDocument(projectData));
              t2=System.currentTimeMillis();
              System.out.println("Deserializing...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$
          setProgress(1.0f);
                return null;
        }
View Full Code Here


    }
    public static Job getExportFileJob(final FileImporter importer){
      final Job job=new Job(importer.getJobQueue(),"exportFile",Messages.getString("LocalFileImporter.Exporting"),true); //$NON-NLS-1$ //$NON-NLS-2$
        job.addRunnable(new JobRunnable("Export",1.0f){ //$NON-NLS-1$
        public Object run() throws Exception{
              DataUtil serializer=new DataUtil();
              System.out.println("Serialization..."); //$NON-NLS-1$
              long t1=System.currentTimeMillis();
              DocumentData projectData=serializer.serializeDocument(importer.getProject());
              projectData.setMaster(true);
              projectData.setLocal(true);
              long t2=System.currentTimeMillis();
              System.out.println("Serialization...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$
              File f=new File(importer.getFileName());
View Full Code Here

TOP

Related Classes of com.projity.server.data.DataUtil

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.