Working with Outline Codes in a Project

Custom outline codes are tags you define for tasks or resources that provide a project structure that is different from WBS codes or outline numbers. Aspose.Tasks for Java lets you retrieve these outline codes and their properties, such as Alias, AllLevelsRequired, Enterprise, EnterpriseOutlineCodeAlias, FieldId, FieldName, PhoneticAlias, Guid, Masks and Values.

Retrieving Outline Code Definitions The Project class exposes getOutlineCodes() which is a collection of OutlineCodeDefinition items. The OutlineCodeDefinition provides all the detail as shown in the following sample code.

The following lines of code retrieve a project’s outline code information.

 1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
 2Project project = new Project(projectName);
 3for (OutlineCodeDefinition ocd : project.getOutlineCodes()) {
 4    System.out.println("Alias = " + ocd.getAlias());
 5    if (ocd.getAllLevelsRequired()) {
 6        System.out.println("It contains property: must have all levels");
 7    } else {
 8        System.out.println("It does not contain property: must have all levels");
 9    }
10    if (ocd.getEnterprise()) {
11        System.out.println("It is an enterprise custom outline code.");
12    } else {
13        System.out.println("It is not an enterprise custom outline code.");
14    }
15    System.out.println(
16            "Reference to another custom field for which this outline code definition is an alias is = "
17                    + ocd.getEnterpriseOutlineCodeAlias());
18    System.out.println("Field Id = " + ocd.getFieldId());
19    System.out.println("Field Name = " + ocd.getFieldName());
20    System.out.println("Phonetic Alias = " + ocd.getPhoneticAlias());
21    System.out.println("Guid = " + ocd.getGuid());
22
23    // Display outline code masks
24    for (OutlineMask m1 : ocd.getMasks()) {
25        System.out.println("Level of a mask = " + m1.getLevel());
26        System.out.println("Mask = " + m1.toString());
27    }
28
29    // Display out line code values
30    for (OutlineValue v1 : ocd.getValues()) {
31        System.out.println("Description of outline value = " + v1.getDescription());
32        System.out.println("Value Id = " + v1.getValueId());
33        System.out.println("Value = " + v1.getValue());
34        System.out.println("Type = " + v1.getType());
35    }
36}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.