Package com.projity.pm.resource

Examples of com.projity.pm.resource.EnterpriseResource


        return resource;

    }
    public static ResourceImpl deserializeResourceAndAddToPool(ResourceData resourceData,ResourcePool resourcePool,Session reindex,Map enterpriseResources) throws IOException, ClassNotFoundException{
        EnterpriseResourceData enterpriseResourceData=resourceData.getEnterpriseResource();
        EnterpriseResource enterpriseResource;
        if (enterpriseResources==null){
          enterpriseResource =(EnterpriseResource)deserialize(enterpriseResourceData,reindex);
          enterpriseResource.setUserAccount(enterpriseResourceData.getUserAccount());
        }else{
          EnterpriseResourceData e=(EnterpriseResourceData)enterpriseResources.get(new Long(enterpriseResourceData.getUniqueId()));
          if (e==null) return null; //TODO handle this
          enterpriseResource =(EnterpriseResource)deserialize(e,reindex);
          enterpriseResource.setUserAccount(e.getUserAccount());
        }
        enterpriseResource.setGlobalWorkVector(enterpriseResourceData.getGlobalWorkVector());
        enterpriseResource.setMaster(resourcePool.isMaster());
        ResourceImpl resource=(resourceData.getSerialized()==null)?
                createResourceFromEnterpriseResource(enterpriseResource):
                (ResourceImpl)deserialize(resourceData,reindex);

        resource.setGlobalResource(enterpriseResource);
        setRoles(resource, resourceData);


        // to ensure older projects import correctly
        WorkingCalendar cal = (WorkingCalendar) enterpriseResource.getWorkCalendar();
        if (cal==null)
            enterpriseResource.setWorkCalendar(WorkingCalendar.getInstanceBasedOn(resourcePool.getDefaultCalendar()));
        else {
          try {
//        cal.setBaseCalendar(CalendarService.findBaseCalendar(cal.getBaseCalendar().getName()));// avoids multiple instances
            WorkCalendar baseCal=CalendarService.findBaseCalendar(cal.getBaseCalendar().getName());
        //TODO verification in case the name isn't found, import problem
View Full Code Here


    private static void setRoles(ResourceImpl resource,ResourceData resourceData){
        resource.setRole(resourceData.getRole());

        int[] authRoles=resourceData.getEnterpriseResource().getAuthorizedRoles();
        if (authRoles!=null){
          EnterpriseResource globalResource=resource.getGlobalResource();
          globalResource.setDefaultRole(authRoles.length>0?authRoles[0]:ApplicationUser.INACTIVE);
          Set<Integer> roles=new HashSet<Integer>();
          for (int i=0;i<authRoles.length;i++) {
        roles.add(UserUtil.toExtendedRole(authRoles[i],resource.isUser()));
      }
          globalResource.setAuthorizedRoles(roles);
          globalResource.setLicense(resourceData.getEnterpriseResource().getLicense());
          globalResource.setLicenseOptions(resourceData.getEnterpriseResource().getLicenseOptions());
        }

    }
View Full Code Here

  }
  public Node createTask(Project project){
    return new NodeBridge(new NormalTask(project));
  }
  public Node createResource(ResourcePool resourcePool){
    return new NodeBridge(new ResourceImpl(new EnterpriseResource(resourcePool)));
  }
View Full Code Here

TOP

Related Classes of com.projity.pm.resource.EnterpriseResource

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.