use of org.finos.waltz.model.orgunit.OrganisationalUnit in project waltz by khartec.
the class LogicalFlowDecoratorRatingsServiceHarness method main.
public static void main(String[] args) throws SQLException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
FlowClassificationRuleService authoritativeSourceService = ctx.getBean(FlowClassificationRuleService.class);
List<FlowClassificationRule> authSources = authoritativeSourceService.findAll();
OrganisationalUnitService organisationalUnitService = ctx.getBean(OrganisationalUnitService.class);
OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
dsl.select(ORGANISATIONAL_UNIT.fields()).from(ORGANISATIONAL_UNIT).fetch(organisationalUnitDao.TO_DOMAIN_MAPPER);
EntityHierarchyService hierarchyService = ctx.getBean(EntityHierarchyService.class);
List<OrganisationalUnit> allOrgUnits = organisationalUnitService.findAll();
List<FlatNode<OrganisationalUnit, Long>> ouNodes = ListUtilities.map(allOrgUnits, ou -> new FlatNode<>(ou.id().get(), ou.parentId(), ou));
Forest<OrganisationalUnit, Long> ouForest = HierarchyUtilities.toForest(ouNodes);
Map<Long, Node<OrganisationalUnit, Long>> nodeMap = ouForest.getAllNodes();
}
use of org.finos.waltz.model.orgunit.OrganisationalUnit in project waltz by khartec.
the class AppGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
DSLContext dsl = getDsl(ctx);
ApplicationService applicationDao = ctx.getBean(ApplicationService.class);
OrganisationalUnitService ouDao = ctx.getBean(OrganisationalUnitService.class);
List<String> animals = Unchecked.supplier(() -> readLines(getClass().getResourceAsStream("/app-names.txt"))).get();
OrganisationalUnit[] organisationalUnits = ouDao.findAll().toArray(new OrganisationalUnit[0]);
List<AppRegistrationRequest> registrationRequests = new ArrayList<>();
for (int i = 0; i < NUM_APPS; i++) {
String animal = randomPick(animals.toArray(new String[0])) + " - " + i;
OrganisationalUnit organisationalUnit = randomPick(organisationalUnits);
LifecyclePhase phase = rnd.nextInt(10) > 7 ? randomPick(LifecyclePhase.values()) : LifecyclePhase.PRODUCTION;
Criticality businessCriticality = rnd.nextInt(10) > 7 ? randomPick(Criticality.values()) : Criticality.HIGH;
AppRegistrationRequest app = ImmutableAppRegistrationRequest.builder().name(animal).assetCode("wltz-0" + i).description("All about " + animal).applicationKind(randomPick(ApplicationKind.values())).lifecyclePhase(phase).overallRating(randomPick(RagRating.R, RagRating.A, RagRating.A, RagRating.G, RagRating.G)).organisationalUnitId(organisationalUnit.id().get()).businessCriticality(businessCriticality).build();
registrationRequests.add(app);
}
registrationRequests.forEach(a -> applicationDao.registerApp(a, "admin"));
return null;
}
use of org.finos.waltz.model.orgunit.OrganisationalUnit in project waltz by khartec.
the class AppGroupService method addOrganisationalUnit.
public List<AppGroupEntry> addOrganisationalUnit(String userId, long groupId, long orgUnitId) throws InsufficientPrivelegeException {
verifyUserCanUpdateGroup(userId, groupId);
OrganisationalUnit orgUnit = organisationalUnitDao.getById(orgUnitId);
if (orgUnit != null) {
appGroupOrganisationalUnitDao.addOrgUnit(groupId, orgUnitId);
audit(groupId, userId, format("Added application %s to group", orgUnit.name()), EntityKind.ORG_UNIT, Operation.ADD);
}
return appGroupOrganisationalUnitDao.getEntriesForGroup(groupId);
}
use of org.finos.waltz.model.orgunit.OrganisationalUnit in project waltz by khartec.
the class OrgUnitTest method ouCanBeRetrievedById.
@Test
public void ouCanBeRetrievedById() {
OrganisationalUnit rootOU = dao.getById(ouIds.root);
assertNotNull(rootOU);
}
Aggregations