Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

Partial Samples to Demonstrate Concepts

The following code samples are incomplete. They demonstrate concepts as noted in the heading and description. These concepts are presented in the context of rule qualifiers, but you can apply them in other types of custom code. You can use these qualifiers with any rule type.

Partial Samples to Demonstrate Concepts 

You can find the following partial code samples in this section:

Checking Lists of Added Categories in Records 

The following rule qualifier code sample in Java shows how you can check whether a specific category is one of the multiple categories added to a record.

Java Sample: Checking Lists of Added Categories 

import java.util.List;
import com.mitratech.teamconnect.enterprise.api.model.Category; import com.mitratech.teamconnect.enterprise.api.model.Project;
public class CheckingValuesInRelatedRecords3 extends CustomCondition<Project> {
import java.util.List;
import com.mitratech.teamconnect.enterprise.api.model.Category; import com.mitratech.teamconnect.enterprise.api.model.Project;
public class CheckingValuesInRelatedRecords3 extends CustomCondition<Project> {
@Override
public boolean condition(Project record) {
    // Getting list of categories added to the project List<Category> categories = record.getCategories(); for (Category category : categories) {
    // Looking for some specific category
    if (category.getTreePosition().equals("FULL_TREE_POSI_TION")) { 
        return false;
            }
        }
        return true;
    }
}

Looping Through Related Records of Projects 

Related records of projects, including involved records and child projects (custom objects), have specific methods for getting them. These methods are described in Related Records.

You retrieve a list of Involved parties or all child projects:

Java Sample: Looping Through Related Records of Projects 

public void action(Project project) {
    // Get list of child objects for project for a specific custom object definition
    List<Project> children = platform.getProjectService().getChildProjects(project, "uniqueCode");

    // Loop through list of child objects 
    for (Project child : children) {
        // Do something with the child here
    }

    // Get list of embedded entities for the same specific custom object 
    definition
    List<EmbeddedEntity> embeddedEntities= project.getEmbeddedEntities("uniqueCode");
    // Loop through list of embedded entities
    for (EmbeddedEntity entity : embeddedEntities) {
        // Do something with the entity here
    }
}

Getting Child Projects of Specific Custom Objects 

The following code sample obtains a list of child or embedded objects of a specific custom object definition using its unique code. The method for getting the list takes the unique code of that object definition as an argument:

Java Sample: Getting Child Projects of Specific Custom Objects 

public void action(Project project) {
    // Get list of child objects for project for a specific custom object definition
    List<Project> children = platform.getProjectService().getChildProjects(project, "uniqueCode");
    // Loop through list of child objects for (Project child : children) {
        // Do something with the child here }
    // Get list of embedded entities for the same specific custom object definition
    List<EmbeddedEntity> embeddedEntities= project.getEmbeddedEntities("uniqueCode");
    // Loop through list of embedded entities
    for (EmbeddedEntity entity : embeddedEntities) {
        // Do something with the entity here }
} 
  • Was this article helpful?