Skip to content

Commit e421a1f

Browse files
committed
Merge branch 'waltz-6602-report-grid' of github.com:judofosu/waltz into waltz-6602-report-grid
2 parents fd596de + ac616b8 commit e421a1f

30 files changed

Lines changed: 242 additions & 40 deletions

File tree

waltz-data/src/main/java/org/finos/waltz/data/application/ApplicationIdSelectorFactory.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import org.jooq.SelectOrderByStep;
3737
import org.jooq.SelectWhereStep;
3838
import org.jooq.impl.DSL;
39-
import org.slf4j.Logger;
40-
import org.slf4j.LoggerFactory;
4139
import org.springframework.stereotype.Service;
4240

4341
import java.util.function.Function;
@@ -61,8 +59,6 @@
6159
@Service
6260
public class ApplicationIdSelectorFactory implements Function<IdSelectionOptions, Select<Record1<Long>>> {
6361

64-
private static final Logger LOG = LoggerFactory.getLogger(ApplicationIdSelectorFactory.class);
65-
6662
private static final DataTypeIdSelectorFactory dataTypeIdSelectorFactory = new DataTypeIdSelectorFactory();
6763
private static final MeasurableIdSelectorFactory measurableIdSelectorFactory = new MeasurableIdSelectorFactory();
6864
private static final OrganisationalUnitIdSelectorFactory orgUnitIdSelectorFactory = new OrganisationalUnitIdSelectorFactory();
@@ -80,6 +76,8 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
8076
checkNotNull(options, "options cannot be null");
8177
EntityReference ref = options.entityReference();
8278
switch (ref.kind()) {
79+
case ALL:
80+
return mkForAll(options);
8381
case ACTOR:
8482
return mkForActor(options);
8583
case APP_GROUP:
@@ -129,6 +127,16 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
129127
}
130128
}
131129

130+
131+
private Select<Record1<Long>> mkForAll(IdSelectionOptions options) {
132+
Condition applicationConditions = SelectorUtilities.mkApplicationConditions(options);
133+
134+
return DSL
135+
.select(APPLICATION.ID)
136+
.from(APPLICATION)
137+
.where(applicationConditions);
138+
}
139+
132140
private Select<Record1<Long>> mkForLegalEntity(IdSelectionOptions options) {
133141
return DSL
134142
.select(LEGAL_ENTITY_RELATIONSHIP.TARGET_ID)

waltz-data/src/main/java/org/finos/waltz/data/change_initiative/ChangeInitiativeIdSelectorFactory.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.finos.waltz.data.entity_hierarchy.AbstractIdSelectorFactory;
2323
import org.finos.waltz.data.orgunit.OrganisationalUnitIdSelectorFactory;
2424
import org.finos.waltz.model.*;
25+
import org.finos.waltz.model.application.LifecyclePhase;
2526
import org.finos.waltz.schema.tables.EntityHierarchy;
2627
import org.jooq.Record1;
2728
import org.jooq.Select;
@@ -48,6 +49,8 @@ public ChangeInitiativeIdSelectorFactory() {
4849
@Override
4950
protected Select<Record1<Long>> mkForOptions(IdSelectionOptions options) {
5051
switch (options.entityReference().kind()) {
52+
case ALL:
53+
return mkForAll(options);
5154
case ACTOR:
5255
case APPLICATION:
5356
case MEASURABLE:
@@ -124,6 +127,14 @@ private Select<Record1<Long>> mkForChangeInitiative(IdSelectionOptions options)
124127
}
125128

126129

130+
private Select<Record1<Long>> mkForAll(IdSelectionOptions options) {
131+
return DSL
132+
.select(CHANGE_INITIATIVE.ID)
133+
.from(CHANGE_INITIATIVE)
134+
.where(CHANGE_INITIATIVE.LIFECYCLE_PHASE.ne(LifecyclePhase.RETIRED.name()));
135+
}
136+
137+
127138
private Select<Record1<Long>> mkForRef(IdSelectionOptions options) {
128139
EntityReference ref = options.entityReference();
129140

waltz-data/src/main/java/org/finos/waltz/data/change_set/ChangeSetIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
4444
case CHANGE_INITIATIVE:
4545
// all physical flows where the app is a source or target
4646
return mkForChangeInitiative(options);
47+
case ALL:
4748
case APPLICATION:
4849
case APP_GROUP:
4950
case FLOW_DIAGRAM:

waltz-data/src/main/java/org/finos/waltz/data/change_unit/ChangeUnitIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
4848
case APPLICATION:
4949
// all physical flows where the app is a source or target
5050
return mkForFlowEndpoint(options);
51+
case ALL:
5152
case APP_GROUP:
5253
case FLOW_DIAGRAM:
5354
case MEASURABLE:

waltz-data/src/main/java/org/finos/waltz/data/end_user_app/EndUserAppDao.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
package org.finos.waltz.data.end_user_app;
2020

2121
import org.finos.waltz.data.JooqUtilities;
22-
import org.finos.waltz.model.Criticality;
2322
import org.finos.waltz.model.application.LifecyclePhase;
2423
import org.finos.waltz.model.enduserapp.EndUserApplication;
2524
import org.finos.waltz.model.enduserapp.ImmutableEndUserApplication;
25+
import org.finos.waltz.model.physical_flow.CriticalityValue;
2626
import org.finos.waltz.model.tally.Tally;
2727
import org.finos.waltz.schema.tables.records.EndUserApplicationRecord;
28+
import org.jooq.Condition;
2829
import org.jooq.DSLContext;
2930
import org.jooq.Record;
3031
import org.jooq.Record1;
@@ -42,8 +43,11 @@
4243
@Repository
4344
public class EndUserAppDao {
4445

45-
4646
private final DSLContext dsl;
47+
private static final Condition COMMON_CONDITION = END_USER_APPLICATION.IS_PROMOTED.isFalse()
48+
.and(END_USER_APPLICATION.LIFECYCLE_PHASE.in(
49+
LifecyclePhase.PRODUCTION.name(),
50+
LifecyclePhase.DEVELOPMENT.name()));
4751

4852
public static final RecordMapper<Record, EndUserApplication> TO_DOMAIN_MAPPER = r -> {
4953
EndUserApplicationRecord record = r.into(END_USER_APPLICATION);
@@ -55,7 +59,7 @@ public class EndUserAppDao {
5559
.id(record.getId())
5660
.organisationalUnitId(record.getOrganisationalUnitId())
5761
.lifecyclePhase(LifecyclePhase.valueOf(record.getLifecyclePhase()))
58-
.riskRating(Criticality.valueOf(record.getRiskRating()))
62+
.riskRating(CriticalityValue.of(record.getRiskRating()))
5963
.provenance(record.getProvenance())
6064
.isPromoted(record.getIsPromoted())
6165
.build();
@@ -72,15 +76,16 @@ public List<Tally<Long>> countByOrganisationalUnit() {
7276
dsl,
7377
END_USER_APPLICATION,
7478
END_USER_APPLICATION.ORGANISATIONAL_UNIT_ID,
75-
END_USER_APPLICATION.IS_PROMOTED.isFalse());
79+
COMMON_CONDITION
80+
);
7681
}
7782

7883
@Deprecated
7984
public List<EndUserApplication> findByOrganisationalUnitSelector(Select<Record1<Long>> selector) {
8085
return dsl.select(END_USER_APPLICATION.fields())
8186
.from(END_USER_APPLICATION)
8287
.where(END_USER_APPLICATION.ORGANISATIONAL_UNIT_ID.in(selector)
83-
.and(END_USER_APPLICATION.IS_PROMOTED.isFalse()))
88+
.and(COMMON_CONDITION))
8489
.fetch(TO_DOMAIN_MAPPER);
8590
}
8691

@@ -89,7 +94,7 @@ public List<EndUserApplication> findBySelector(Select<Record1<Long>> selector) {
8994
return dsl.select(END_USER_APPLICATION.fields())
9095
.from(END_USER_APPLICATION)
9196
.where(END_USER_APPLICATION.ID.in(selector)
92-
.and(END_USER_APPLICATION.IS_PROMOTED.isFalse()))
97+
.and(COMMON_CONDITION))
9398
.fetch(TO_DOMAIN_MAPPER);
9499
}
95100

@@ -115,7 +120,7 @@ public List<EndUserApplication> findAll() {
115120
return dsl
116121
.select(END_USER_APPLICATION.fields())
117122
.from(END_USER_APPLICATION)
118-
.where(END_USER_APPLICATION.IS_PROMOTED.isFalse())
123+
.where(COMMON_CONDITION)
119124
.fetch(TO_DOMAIN_MAPPER);
120125
}
121126
}

waltz-data/src/main/java/org/finos/waltz/data/end_user_app/EndUserAppIdSelectorFactory.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package org.finos.waltz.data.end_user_app;
2020

21+
import org.finos.waltz.common.SetUtilities;
22+
import org.finos.waltz.model.application.LifecyclePhase;
2123
import org.finos.waltz.schema.tables.EndUserApplication;
2224
import org.finos.waltz.schema.tables.Involvement;
2325
import org.finos.waltz.schema.tables.Person;
@@ -35,6 +37,8 @@
3537
import org.slf4j.Logger;
3638
import org.slf4j.LoggerFactory;
3739

40+
import java.util.Collection;
41+
import java.util.Set;
3842
import java.util.function.Function;
3943

4044
import static org.finos.waltz.schema.tables.EndUserApplication.END_USER_APPLICATION;
@@ -52,7 +56,9 @@ public class EndUserAppIdSelectorFactory implements Function<IdSelectionOptions,
5256
private final OrganisationalUnitIdSelectorFactory orgUnitIdSelectorFactory = new OrganisationalUnitIdSelectorFactory();
5357
private final Person person = PERSON.as("per");
5458
private final PersonHierarchy personHierarchy = PERSON_HIERARCHY.as("phier");
55-
59+
private final Set<String> validLifecyclePhases = SetUtilities.asSet(
60+
LifecyclePhase.PRODUCTION.name(),
61+
LifecyclePhase.DEVELOPMENT.name());
5662

5763

5864
@Override
@@ -81,7 +87,8 @@ private Select<Record1<Long>> mkForOrgUnit(IdSelectionOptions options) {
8187
return DSL
8288
.selectDistinct(eua.ID)
8389
.from(eua)
84-
.where(eua.ORGANISATIONAL_UNIT_ID.in(ouSelector));
90+
.where(eua.ORGANISATIONAL_UNIT_ID.in(ouSelector)
91+
.and(eua.LIFECYCLE_PHASE.in(validLifecyclePhases)));
8592
}
8693

8794

@@ -114,7 +121,8 @@ private Select<Record1<Long>> mkForSinglePerson(IdSelectionOptions options) {
114121
.innerJoin(eua)
115122
.on(eua.ID.eq(involvement.ENTITY_ID))
116123
.where(involvement.ENTITY_KIND.eq(EntityKind.END_USER_APPLICATION.name()))
117-
.and(involvement.EMPLOYEE_ID.eq(employeeId));
124+
.and(involvement.EMPLOYEE_ID.eq(employeeId))
125+
.and(eua.LIFECYCLE_PHASE.in(validLifecyclePhases));
118126
}
119127

120128

@@ -138,7 +146,8 @@ private Select<Record1<Long>> mkForPersonReportees(IdSelectionOptions options) {
138146
.from(involvement)
139147
.innerJoin(eua)
140148
.on(eua.ID.eq(involvement.ENTITY_ID))
141-
.where(condition);
149+
.where(condition)
150+
.and(eua.LIFECYCLE_PHASE.in(validLifecyclePhases));
142151
}
143152

144153

waltz-data/src/main/java/org/finos/waltz/data/legal_entity/LegalEntityRelationshipIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
4343
switch (options.entityReference().kind()) {
4444
case ACTOR:
4545
return mkForActor(options);
46+
case ALL:
4647
case APPLICATION:
4748
case APP_GROUP:
4849
case MEASURABLE:

waltz-data/src/main/java/org/finos/waltz/data/licence/LicenceIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected Select<Record1<Long>> mkForOptions(IdSelectionOptions options) {
5555
case LICENCE:
5656
return mkForLicence(options);
5757
case ACTOR:
58+
case ALL:
5859
case APP_GROUP:
5960
case CHANGE_INITIATIVE:
6061
case FLOW_DIAGRAM:

waltz-data/src/main/java/org/finos/waltz/data/logical_flow/LogicalFlowIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
6363
switch (options.entityReference().kind()) {
6464
case ACTOR:
6565
return mkForActor(options);
66+
case ALL:
6667
case APPLICATION:
6768
case APP_GROUP:
6869
case CHANGE_INITIATIVE:

waltz-data/src/main/java/org/finos/waltz/data/measurable/MeasurableIdSelectorFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public Select<Record1<Long>> apply(IdSelectionOptions options) {
7676
return mkForMeasurable(options);
7777
case APP_GROUP:
7878
case PROCESS_DIAGRAM:
79+
case ALL:
7980
return mkViaAppSelector(options);
8081
case AGGREGATE_OVERLAY_DIAGRAM:
8182
return mkForAggregatedEntityDiagram(options);

0 commit comments

Comments
 (0)