리소스 할당 생성

작업 및 리소스 연결 리소스 할당. 이 기사에서는 Aspose.Tasks for java를 사용하여 하나를 만드는 방법을 설명합니다.

리소스 할당 만들기

Resource 클래스는 기본 생성자를 사용하거나 작업 및 리소스를 전달하여 리소스 할당을 작성하는 두 가지 방법을 노출시킵니다.

프로그래밍 샘플 : 직접 프로젝트에 ResourceAssignment 추가 다음 코드 샘플은 객체를 인스턴스화하지 않고 프로젝트에 리소스 할당을 추가합니다.

1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(CreateResourceAssignments.class);
4Project project = new Project();
5Task task = project.getRootTask().getChildren().add("Task");
6
7Resource rsc = project.getResources().add("Rsc");
8
9ResourceAssignment assn = project.getResourceAssignments().add(task, rsc);

Read Shared Resource Assignments

The shared assignments are assignments of the specific resource to tasks in other projects when the current project uses a resource from a resource pool. Using Aspose.Tasks , the shared assignments can be read from MPP and taken into account when Peak\Overallocated properties are calculated. The following code example demonstrates how to read shared resource assignments.

1// suppose "test.mpp" contains resource from resource pool and assignments from other projects
2Project project = new Project(dataDir + "test.mpp");
3Resource resource = project.getResources().getByUid(1);
4// Units are calculated using assignments from other projects.
5Double units = resource.get(Rsc.PEAK_UNITS); 
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.