Génération de données timide

Aspose.Tasks peut générer des données timides pour différents contours de travail d’une ressource attribuée. Les données générées sont obtenues à l’aide de TimesCaledata qui prend les dates de démarrage et de fin du projet en tant que paramètres d’entrée.

GÉNÉRATION DES DONNÉES TIMIERSÉE Le morceau de code suivant attribue différents types de contours de travail à une ressource attribuée et affiche ses données en phase de temps.

 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(TimephasedDataGeneration.class);
 4
 5// Read the source MPP file
 6Project project = new Project(dataDir + "SampleFile.Mpp");
 7
 8// Get the first task of the Project
 9Task task = project.getRootTask().getChildren().getById(1);
10
11// Get the First Resource Assignment of the Project
12ResourceAssignment firstRA = project.getResourceAssignments().toList().get(0);
13
14// Flat contour is default contour
15System.out.println("Flat contour");
16for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
17    System.out.println(td.getStart().toString() + " " + td.getValue());
18}
19
20// Change contour
21firstRA.set(Asn.WORK_CONTOUR, WorkContourType.Turtle);
22System.out.println("Turtle contour");
23for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
24    System.out.println(td.getStart().toString() + " " + td.getValue());
25}
26
27// Change contour
28firstRA.set(Asn.WORK_CONTOUR, WorkContourType.BackLoaded);
29System.out.println("BackLoaded contour");
30for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
31    System.out.println(td.getStart().toString() + " " + td.getValue());
32}
33
34// Change contour
35firstRA.set(Asn.WORK_CONTOUR, WorkContourType.FrontLoaded);
36System.out.println("FrontLoaded contour");
37for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
38    System.out.println(td.getStart().toString() + " " + td.getValue());
39}
40
41// Change contour
42firstRA.set(Asn.WORK_CONTOUR, WorkContourType.Bell);
43System.out.println("Bell contour");
44for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
45    System.out.println(td.getStart().toString() + " " + td.getValue());
46}
47
48// Change contour
49firstRA.set(Asn.WORK_CONTOUR, WorkContourType.EarlyPeak);
50System.out.println("EarlyPeak contour");
51for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
52    System.out.println(td.getStart().toString() + " " + td.getValue());
53}
54
55// Change contour
56firstRA.set(Asn.WORK_CONTOUR, WorkContourType.LatePeak);
57System.out.println("LatePeak contour");
58for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
59    System.out.println(td.getStart().toString() + " " + td.getValue());
60}
61// Change contour
62firstRA.set(Asn.WORK_CONTOUR, WorkContourType.DoublePeak);
63System.out.println("DoublePeak contour");
64for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
65    System.out.println(td.getStart().toString() + " " + td.getValue());
66}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.