General Resource Assignment Properties
Contents
[
Hide
Show
]An assignment is a resource that has been assigned to a specific task. Each resource has general properties, typically a unique ID, a start and a finish time. This article explains how to set and get these properties with Aspose.Tasks.
Working with General Assignment Properties
The ResourceAssignment class exposes a number of properties used to set and get general assignment properties:
- Uid sets and gets an assignment’s unique ID (integer).
- Start sets and gets an assignment’s start date (java.util.Date).
- Finish sets and gets an assignment’s end date (java.util.Date).
To see an assignment’s general properties in Microsoft Project:
- From the View menu, select Task Usage.
- From the Insert menu, select Column.
- Add the Start. Finish and Unique ID columns.
General assignment properties viewed in Microsoft Project
Setting General Resource Assignment Properties using Aspose.Tasks
The following example shows how to set these properties from scratch.
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(ResourceAssignmentProperties.class);
4
5Project project = new Project();
6
7Task task = project.getRootTask().getChildren().add("Task");
8Resource rsc = project.getResources().add("Rsc");
9rsc.set(Rsc.STANDARD_RATE, BigDecimal.valueOf(10));
10rsc.set(Rsc.OVERTIME_RATE, BigDecimal.valueOf(15));
11
12ResourceAssignment assn = project.getResourceAssignments().add(task, rsc);
Getting General Resource Assignment Properties using Aspose.Tasks
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(ResourceAssignmentProperties.class);
4
5Project prj = new Project(dataDir + "input.mpp");
6for (ResourceAssignment ra : prj.getResourceAssignments()) {
7 System.out.println(ra.get(Asn.UID));
8 System.out.println(ra.get(Asn.START).toString());
9 System.out.println(ra.get(Asn.FINISH).toString());
10}