use of org.finos.waltz.model.entity_relationship.EntityRelationship in project waltz by khartec.
the class EntityRelationshipHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
EntityRelationshipDao dao = ctx.getBean(EntityRelationshipDao.class);
EntityReference ref = EntityReference.mkRef(EntityKind.MEASURABLE, 613);
Collection<EntityRelationship> rels = dao.findRelationshipsInvolving(ref);
rels.forEach(r -> System.out.println(r.a().name()));
System.out.println("----");
System.out.println(dao.tallyRelationshipsInvolving(ref));
}
use of org.finos.waltz.model.entity_relationship.EntityRelationship in project waltz by khartec.
the class RoadmapService method createRoadmap.
public Long createRoadmap(RoadmapCreateCommand command, String userId) {
long roadmapId = roadmapDao.createRoadmap(command.name(), command.ratingSchemeId(), command.columnType(), command.rowType(), userId);
if (roadmapId > 0) {
changeLogService.write(ImmutableChangeLog.copyOf(RoadmapUtilities.mkBasicLogEntry(roadmapId, String.format("Created roadmap: %s", command.name()), userId)).withOperation(Operation.ADD));
}
EntityRelationship reln = ImmutableEntityRelationship.builder().a(command.linkedEntity()).b(mkRef(EntityKind.ROADMAP, roadmapId)).relationship(RelationshipKind.RELATES_TO.name()).lastUpdatedBy(userId).build();
entityRelationshipDao.create(reln);
return roadmapId;
}
use of org.finos.waltz.model.entity_relationship.EntityRelationship in project waltz by khartec.
the class MeasurableRelationshipService method create.
public boolean create(String userName, EntityReference entityRefA, EntityReference entityRefB, String relationshipKind, String description) {
EntityRelationship relationship = ImmutableEntityRelationship.builder().a(entityRefA).b(entityRefB).relationship(relationshipKind).description(description).lastUpdatedBy(userName).build();
boolean result = entityRelationshipDao.create(relationship);
if (result) {
logAddition(relationship);
}
return result;
}
use of org.finos.waltz.model.entity_relationship.EntityRelationship in project waltz by khartec.
the class AppGroupService method addChangeInitiative.
public Collection<ChangeInitiative> addChangeInitiative(String username, long groupId, long changeInitiativeId) throws InsufficientPrivelegeException {
verifyUserCanUpdateGroup(username, groupId);
EntityRelationship entityRelationship = buildChangeInitiativeRelationship(username, groupId, changeInitiativeId);
entityRelationshipDao.save(entityRelationship);
audit(groupId, username, format("Associated change initiative: %d", changeInitiativeId), EntityKind.CHANGE_INITIATIVE, Operation.ADD);
return changeInitiativeService.findForSelector(mkOpts(mkRef(EntityKind.APP_GROUP, groupId), HierarchyQueryScope.EXACT));
}
use of org.finos.waltz.model.entity_relationship.EntityRelationship in project waltz by khartec.
the class AppGroupService method removeChangeInitiative.
public Collection<ChangeInitiative> removeChangeInitiative(String username, long groupId, long changeInitiativeId) throws InsufficientPrivelegeException {
verifyUserCanUpdateGroup(username, groupId);
EntityRelationship entityRelationship = buildChangeInitiativeRelationship(username, groupId, changeInitiativeId);
entityRelationshipDao.remove(entityRelationship.toKey());
audit(groupId, username, format("Removed associated change initiative: %d", changeInitiativeId), EntityKind.CHANGE_INITIATIVE, Operation.REMOVE);
return changeInitiativeService.findForSelector(mkOpts(mkRef(EntityKind.APP_GROUP, groupId), HierarchyQueryScope.EXACT));
}
Aggregations