use of org.hisp.dhis.relationship.RelationshipConstraint in project dhis2-core by dhis2.
the class DhisConvenienceTest method createTeiToEnrollmentRelationshipType.
public static RelationshipType createTeiToEnrollmentRelationshipType(char uniqueCharacter, Program program, TrackedEntityType trackedEntityType, boolean isBidirectional) {
RelationshipConstraint teiConstraintA = new RelationshipConstraint();
teiConstraintA.setProgram(program);
teiConstraintA.setTrackedEntityType(trackedEntityType);
teiConstraintA.setRelationshipEntity(RelationshipEntity.TRACKED_ENTITY_INSTANCE);
RelationshipConstraint teiConstraintB = new RelationshipConstraint();
teiConstraintB.setProgram(program);
teiConstraintB.setTrackedEntityType(trackedEntityType);
teiConstraintB.setRelationshipEntity(RelationshipEntity.PROGRAM_INSTANCE);
RelationshipType relationshipType = createRelationshipType(uniqueCharacter);
relationshipType.setName("Tei_to_enrollment_" + uniqueCharacter);
relationshipType.setBidirectional(isBidirectional);
relationshipType.setFromConstraint(teiConstraintA);
relationshipType.setToConstraint(teiConstraintB);
return relationshipType;
}
use of org.hisp.dhis.relationship.RelationshipConstraint in project dhis2-core by dhis2.
the class DhisConvenienceTest method createMalariaCaseLinkedToPersonRelationshipType.
public static RelationshipType createMalariaCaseLinkedToPersonRelationshipType(char uniqueCharacter, Program program, TrackedEntityType trackedEntityType) {
RelationshipConstraint psiConstraint = new RelationshipConstraint();
psiConstraint.setProgram(program);
psiConstraint.setTrackedEntityType(trackedEntityType);
psiConstraint.setRelationshipEntity(RelationshipEntity.PROGRAM_STAGE_INSTANCE);
RelationshipConstraint teiConstraint = new RelationshipConstraint();
teiConstraint.setProgram(program);
teiConstraint.setTrackedEntityType(trackedEntityType);
teiConstraint.setRelationshipEntity(RelationshipEntity.TRACKED_ENTITY_INSTANCE);
RelationshipType relationshipType = createRelationshipType(uniqueCharacter);
relationshipType.setName("Malaria case linked to person");
relationshipType.setBidirectional(true);
relationshipType.setFromConstraint(psiConstraint);
relationshipType.setToConstraint(teiConstraint);
return relationshipType;
}
use of org.hisp.dhis.relationship.RelationshipConstraint in project dhis2-core by dhis2.
the class DhisConvenienceTest method createPersonToPersonRelationshipType.
public static RelationshipType createPersonToPersonRelationshipType(char uniqueCharacter, Program program, TrackedEntityType trackedEntityType, boolean isBidirectional) {
RelationshipConstraint teiConstraintA = new RelationshipConstraint();
teiConstraintA.setProgram(program);
teiConstraintA.setTrackedEntityType(trackedEntityType);
teiConstraintA.setRelationshipEntity(RelationshipEntity.TRACKED_ENTITY_INSTANCE);
RelationshipConstraint teiConstraintB = new RelationshipConstraint();
teiConstraintB.setProgram(program);
teiConstraintB.setTrackedEntityType(trackedEntityType);
teiConstraintB.setRelationshipEntity(RelationshipEntity.TRACKED_ENTITY_INSTANCE);
RelationshipType relationshipType = createRelationshipType(uniqueCharacter);
relationshipType.setName("Person_to_person_" + uniqueCharacter);
relationshipType.setBidirectional(isBidirectional);
relationshipType.setFromConstraint(teiConstraintA);
relationshipType.setToConstraint(teiConstraintB);
return relationshipType;
}
Aggregations