use of org.hisp.dhis.dxf2.events.RelationshipParams in project dhis2-core by dhis2.
the class AbstractRelationshipService method getRelationship.
@Override
@Transactional(readOnly = true)
public Relationship getRelationship(org.hisp.dhis.relationship.Relationship dao, RelationshipParams params, User user) {
List<String> errors = trackerAccessManager.canRead(user, dao);
if (!errors.isEmpty()) {
// Dont include relationship
return null;
}
Relationship relationship = new Relationship();
relationship.setRelationship(dao.getUid());
relationship.setRelationshipType(dao.getRelationshipType().getUid());
relationship.setRelationshipName(dao.getRelationshipType().getName());
relationship.setFrom(includeRelationshipItem(dao.getFrom(), !params.isIncludeFrom()));
relationship.setTo(includeRelationshipItem(dao.getTo(), !params.isIncludeTo()));
relationship.setBidirectional(dao.getRelationshipType().isBidirectional());
relationship.setCreated(DateUtils.getIso8601NoTz(dao.getCreated()));
relationship.setLastUpdated(DateUtils.getIso8601NoTz(dao.getLastUpdated()));
return relationship;
}
Aggregations