Skip to content

Commit d83ddfd

Browse files
Adding ratings explorer
#199
1 parent bf30b98 commit d83ddfd

28 files changed

Lines changed: 970 additions & 205 deletions

File tree

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<module>waltz-jobs</module>
1414
<module>waltz-data</module>
1515
<module>waltz-schema</module>
16+
<module>waltz-local-config</module>
1617
</modules>
1718
<packaging>pom</packaging>
1819

@@ -24,7 +25,7 @@
2425
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2526

2627
<hikari.version>2.4.5</hikari.version>
27-
<immutables.version>2.1.15</immutables.version>
28+
<immutables.version>2.2.5</immutables.version>
2829
<jackson.version>2.7.0</jackson.version>
2930
<jackson-jsr310.version>2.4.0</jackson-jsr310.version>
3031
<jbcrypt.version>0.4</jbcrypt.version>

waltz-data/src/main/ddl/liquibase/db.changelog-1.0.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,4 +1772,26 @@
17721772

17731773
</changeSet>
17741774

1775+
1776+
<!-- 195 server_information - operating_system should NOT be nullable -->
1777+
<changeSet author="dwatkins" id="20160613-195-1">
1778+
<addNotNullConstraint columnDataType="VARCHAR(128)"
1779+
columnName="operating_system"
1780+
defaultNullValue="UNKNOWN"
1781+
tableName="server_information"/>
1782+
<addNotNullConstraint columnDataType="VARCHAR(128)"
1783+
columnName="operating_system_version"
1784+
defaultNullValue="UNKNOWN"
1785+
tableName="server_information"/>
1786+
<addNotNullConstraint columnDataType="VARCHAR(128)"
1787+
columnName="location"
1788+
defaultNullValue="UNKNOWN"
1789+
tableName="server_information"/>
1790+
<addNotNullConstraint columnDataType="VARCHAR(128)"
1791+
columnName="country"
1792+
defaultNullValue="UNKNOWN"
1793+
tableName="server_information"/>
1794+
1795+
</changeSet>
1796+
17751797
</databaseChangeLog>

waltz-data/src/main/java/com/khartec/waltz/data/capability_rating/CapabilityRatingDao.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,14 @@ public List<CapabilityRating> findByAppIds(Long[] appIds) {
204204
.and(PERSPECTIVE_RATING.PARENT_KIND.eq(EntityKind.APPLICATION.name()))
205205
.fetch(capabilityRatingMapper);
206206
}
207+
208+
public List<CapabilityRating> findByAppIdSelector(Select<Record1<Long>> appIdSelector) {
209+
Condition condition = PERSPECTIVE_RATING.PARENT_ID.in(appIdSelector)
210+
.and(PERSPECTIVE_RATING.PARENT_KIND.eq(EntityKind.APPLICATION.name()));
211+
212+
return prepareSelectPart()
213+
.where(dsl.renderInlined(condition))
214+
.fetch(capabilityRatingMapper);
215+
216+
}
207217
}

waltz-data/src/main/java/com/khartec/waltz/data/data_flow/DataFlowDao.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,28 @@ public DataFlowDao(DSLContext dsl) {
7373

7474

7575
public List<DataFlow> findByEntityReference(EntityReference ref) {
76-
return baseOrgUnitQuery()
77-
.and(DATA_FLOW.SOURCE_ENTITY_ID.eq(ref.id()).and(DATA_FLOW.SOURCE_ENTITY_KIND.eq(ref.kind().name())))
78-
.or(DATA_FLOW.TARGET_ENTITY_ID.eq(ref.id()).and(DATA_FLOW.TARGET_ENTITY_KIND.eq(ref.kind().name())))
76+
return baseQuery()
77+
.and(DATA_FLOW.SOURCE_ENTITY_ID.eq(ref.id()))
78+
.or(DATA_FLOW.TARGET_ENTITY_ID.eq(ref.id()))
7979
.fetch(dataFlowMapper);
8080
}
8181

8282

8383
public List<DataFlow> findByApplicationIdSelector(Select<Record1<Long>> appIdSelector) {
84-
return baseOrgUnitQuery()
84+
return baseQuery()
8585
.and(DATA_FLOW.SOURCE_ENTITY_ID.in(appIdSelector))
8686
.or(DATA_FLOW.TARGET_ENTITY_ID.in(appIdSelector))
8787
.fetch(dataFlowMapper);
8888
}
8989

9090
public List<DataFlow> findByApplicationIds(Collection<Long> appIds) {
91-
return baseOrgUnitQuery()
91+
return baseQuery()
9292
.and(DATA_FLOW.SOURCE_ENTITY_ID.in(appIds))
9393
.or(DATA_FLOW.TARGET_ENTITY_ID.in(appIds))
9494
.fetch(dataFlowMapper);
9595
}
9696

97-
private SelectConditionStep<Record> baseOrgUnitQuery() {
97+
private SelectConditionStep<Record> baseQuery() {
9898

9999
Field[] fields = new ArrayBuilder<Field>()
100100
.add(DATA_FLOW.fields())

waltz-data/src/main/java/com/khartec/waltz/data/data_flow/DataFlowStatsDao.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ public DataFlowMeasures countDistinctAppInvolvement(Select<Record1<Long>> appIdS
7373
df.TARGET_ENTITY_ID
7474
));
7575

76-
Select<Record1<Integer>> intraAppCounter = dsl
77-
.select(DSL.count())
78-
.from(APPLICATION)
79-
.where(APPLICATION.ID.in(appIdSelector));
76+
77+
Select<Record1<Integer>> intraAppCounter = FunctionUtilities.time("DFSD.intraAppCounter", ()
78+
-> dsl
79+
.select(DSL.count())
80+
.from(APPLICATION)
81+
.where(dsl.renderInlined(APPLICATION.ID.in(appIdSelector))));
8082

8183
Select<Record1<Integer>> query = inAppCounter
8284
.unionAll(outAppCounter)
8385
.unionAll(intraAppCounter);
8486

85-
List<Integer> results = query.fetch(0, Integer.class);
87+
List<Integer> results = FunctionUtilities.time("DFSD.executeUnionAppCounters", ()
88+
-> query.fetch(0, Integer.class));
8689

8790
return ImmutableDataFlowMeasures
8891
.builder()
@@ -93,7 +96,6 @@ public DataFlowMeasures countDistinctAppInvolvement(Select<Record1<Long>> appIdS
9396
}
9497

9598

96-
9799
public List<StringTally> tallyDataTypes(Select<Record1<Long>> appIdSelector) {
98100
checkNotNull(appIdSelector, "appIdSelector cannot be null");
99101

@@ -176,5 +178,4 @@ private SelectConditionStep<Record1<Integer>> countDistinctApps(Select<Record1<L
176178

177179
}
178180

179-
180181
}

waltz-data/src/main/java/com/khartec/waltz/data/server_info/ServerInfoDao.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
import java.math.BigDecimal;
3535
import java.util.List;
36-
import java.util.Optional;
3736
import java.util.concurrent.Future;
3837
import java.util.stream.Collectors;
3938

@@ -59,11 +58,11 @@ public class ServerInfoDao {
5958
.assetCode(row.getAssetCode())
6059
.hostname(row.getHostname())
6160
.virtual(row.getIsVirtual() == null ? false : row.getIsVirtual())
62-
.operatingSystem(Optional.ofNullable(row.getOperatingSystem()))
63-
.operatingSystemVersion(Optional.ofNullable(row.getOperatingSystemVersion()))
61+
.operatingSystem(row.getOperatingSystem())
62+
.operatingSystemVersion(row.getOperatingSystemVersion())
6463
.environment(row.getEnvironment())
65-
.location(Optional.ofNullable(row.getLocation()))
66-
.country(Optional.ofNullable(row.getCountry()))
64+
.location(row.getLocation())
65+
.country(row.getCountry())
6766
.provenance(row.getProvenance())
6867
.build();
6968
};
@@ -111,12 +110,12 @@ public int[] bulkSave(List<ServerInfo> servers) {
111110
SERVER_INFORMATION.PROVENANCE)
112111
.values(
113112
s.hostname(),
114-
s.operatingSystem().orElse(""),
115-
s.operatingSystemVersion().orElse(""),
116-
s.country().orElse(""),
113+
s.operatingSystem(),
114+
s.operatingSystemVersion(),
115+
s.country(),
117116
s.virtual(),
118117
s.environment(),
119-
s.location().orElse(""),
118+
s.location(),
120119
s.assetCode(),
121120
s.provenance()))
122121
.collect(Collectors.toList()))

waltz-jobs/src/main/java/com/khartec/waltz/jobs/AppHarness.java

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919

2020
import com.khartec.waltz.model.application.Application;
2121
import com.khartec.waltz.model.application.AssetCodeRelationshipKind;
22-
import com.khartec.waltz.service.DIConfiguration;
23-
import com.khartec.waltz.service.application.ApplicationService;
24-
import org.jooq.DSLContext;
25-
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
22+
import com.khartec.waltz.model.trait.ImmutableTrait;
2623

2724
import java.util.List;
2825
import java.util.Map;
@@ -34,19 +31,29 @@ public class AppHarness {
3431

3532
public static void main(String[] args) {
3633

37-
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
38-
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
39-
DSLContext dsl = ctx.getBean(DSLContext.class);
40-
41-
List<String> tagList = applicationService.findAllTags();
42-
43-
tagList.forEach(System.out::println);
44-
45-
System.out.println("---------------");
46-
47-
applicationService.findByTag("not-good-at-flying").forEach(a -> System.out.println(a.name()));
48-
49-
System.out.println(applicationService.findTagsForApplication(521L));
34+
// AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
35+
// ApplicationService applicationService = ctx.getBean(ApplicationService.class);
36+
// DSLContext dsl = ctx.getBean(DSLContext.class);
37+
//
38+
// List<String> tagList = applicationService.findAllTags();
39+
//
40+
// tagList.forEach(System.out::println);
41+
//
42+
// System.out.println("---------------");
43+
//
44+
// applicationService.findByTag("not-good-at-flying").forEach(a -> System.out.println(a.name()));
45+
//
46+
// System.out.println(applicationService.findTagsForApplication(521L));
47+
//
48+
49+
ImmutableTrait t = ImmutableTrait.builder()
50+
.description("HEllo")
51+
.icon("Hello")
52+
.name("fdjlkfjd;")
53+
.applicationDeclarable(true)
54+
.build();
55+
56+
System.out.println(t);
5057
}
5158

5259

waltz-local-config/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>waltz</artifactId>
7+
<groupId>com.khartec</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>waltz-local-config</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>com.khartec</groupId>
17+
<artifactId>waltz-web</artifactId>
18+
<version>1.0-SNAPSHOT</version>
19+
</dependency>
20+
</dependencies>
21+
22+
</project>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!--
2+
~ This file is part of Waltz.
3+
~
4+
~ Waltz is free software: you can redistribute it and/or modify
5+
~ it under the terms of the GNU General Public License as published by
6+
~ the Free Software Foundation, either version 3 of the License, or
7+
~ (at your option) any later version.
8+
~
9+
~ Waltz is distributed in the hope that it will be useful,
10+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
~ GNU General Public License for more details.
13+
~
14+
~ You should have received a copy of the GNU General Public License
15+
~ along with Waltz. If not, see <http://www.gnu.org/licenses/>.
16+
-->
17+
18+
19+
<configuration>
20+
21+
<appender name="STDOUT"
22+
class="ch.qos.logback.core.ConsoleAppender">
23+
<encoder>
24+
<pattern>
25+
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
26+
</pattern>
27+
</encoder>
28+
</appender>
29+
30+
<appender name="FILE"
31+
class="ch.qos.logback.core.FileAppender">
32+
<file>logs/waltz.log</file>
33+
<append>true</append>
34+
<encoder>
35+
<pattern>
36+
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
37+
</pattern>
38+
</encoder>
39+
</appender>
40+
41+
<logger name="com.khartec" level="DEBUG" />
42+
<!--<logger name="org.jooq" level="DEBUG" />-->
43+
44+
<root level="WARN">
45+
<appender-ref ref="STDOUT" />
46+
<appender-ref ref="FILE" />
47+
</root>
48+
49+
</configuration>

waltz-model/src/main/java/com/khartec/waltz/model/DescriptionProvider.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
import org.immutables.value.Value;
2121

22+
2223
public interface DescriptionProvider {
2324

24-
@Value.Default
25-
default String description() { return ""; }
25+
@Value
26+
@Nullable
27+
String description();
2628
}

0 commit comments

Comments
 (0)