Package com.projity.server.data

Examples of com.projity.server.data.Serializer


  }

  protected ProjectData projectData;

    public Job getImportFileJob(){
      final Serializer serializer=new Serializer();
      final FileImporter importer=this;
      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
              projectData=(ProjectData)obj;
              projectData.setMaster(false);
              projectData.setLocal(false);
              long t2=System.currentTimeMillis();
              System.out.println("Loading...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$

              Collection<ResourceData> rs=(Collection<ResourceData>)projectData.getResources();
              List<EnterpriseResourceData> ers=new ArrayList<EnterpriseResourceData>(rs.size());
              for (ResourceData r: rs){
                ers.add(r.getEnterpriseResource());
              }

        ((ServerFileImporter)importer).prepareResources(ers,null,false);
        renumberProject();

              setProgress(1.0f);
                return null;
        }
        });

      job.addSwingRunnable(new JobRunnable("Import resources",1.0f){ //$NON-NLS-1$
      public Object run() throws Exception{
        ResourceMappingForm form=getResourceMapping();
        if (form!=null&&form.isLocal()) //if form==null we are in a case were have no server access. popup not needed
          if (!job.okCancel(Messages.getString("Message.ServerUnreacheableReadOnlyProject"),true)){ //$NON-NLS-1$
            setProgress(1.0f);
            throw new Exception(ABORT);
          }

        if(!importResources()){
          setProgress(1.0f);
          throw new JobCanceledException(ABORT);
        }
        setProgress(1f);
        return null;
        }
      });

        job.addRunnable(new JobRunnable("Import",1.0f){ //$NON-NLS-1$
        public Object run() throws Exception{
              System.out.println("Deserializing..."); //$NON-NLS-1$
              long t1=System.currentTimeMillis();
              ResourceMappingForm form=getResourceMapping();
//              project=serializer.deserializeProject(projectData,false,true,resourceMap);
              //DEF165936:  Projity: .pod file import fails mapped to resource with modified calendar
              //pass the map into the serializer so it can grab the original impls
//              serializer.SetStuffForPODDeserialization(form.getExistingProject(), _localResourceMap); //claur
              Project project=serializer.deserializeProject(projectData,false,null,null,null,false);
              if (project!=null&&!Environment.getStandAlone()) project.setAllDirty();
              importer.setProject(project);
              long t2=System.currentTimeMillis();
              System.out.println("Deserializing...Done in "+(t2-t1)+" ms"); //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here


    unassigned.setUniqueId(EnterpriseResource.UNASSIGNED_ID);
    unassigned.setName(Messages.getString("Text.Unassigned")); //$NON-NLS-1$
    form.setUnassignedResource(unassigned);
    projityResources.add(unassigned);

    Serializer serializer=new Serializer();

    ProjectData projectData=(ProjectData)serializer.serialize(existingProject,ProjectData.FACTORY,null);
        if (existingProject.isForceNonIncremental()) projectData.setVersion(0);
        projectData.setMaster(existingProject.isMaster());

        //resources
        Map resourceMap=serializer.saveResources(existingProject,projectData);
        List<com.projity.pm.resource.Resource> existingResources=(List<com.projity.pm.resource.Resource>)existingProject.getResourcePool().getResourceList();
        for (com.projity.pm.resource.Resource resource:existingResources){
          if (resource==null) continue;
          ResourceData r=(ResourceData)resourceMap.get(resource.getUniqueId());
          if (r!=null){
View Full Code Here

TOP

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

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.