-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6850 from davidwatkins73/waltz-6830-fcr-table-ass…
…essments Flow Classification Rule table to show assessments
- Loading branch information
Showing
13 changed files
with
293 additions
and
43 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
waltz-data/src/main/java/org/finos/waltz/data/measurable_rating/MeasurableRatingViewDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.finos.waltz.data.measurable_rating; | ||
|
||
import org.finos.waltz.data.JooqUtilities; | ||
import org.finos.waltz.model.EntityKind; | ||
import org.finos.waltz.model.EntityReference; | ||
import org.finos.waltz.model.measurable_rating.ImmutablePrimaryRatingViewItem; | ||
import org.finos.waltz.model.measurable_rating.PrimaryRatingViewItem; | ||
import org.finos.waltz.schema.Tables; | ||
import org.finos.waltz.schema.tables.Measurable; | ||
import org.finos.waltz.schema.tables.MeasurableCategory; | ||
import org.finos.waltz.schema.tables.MeasurableRating; | ||
import org.finos.waltz.schema.tables.RatingSchemeItem; | ||
import org.jooq.DSLContext; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Set; | ||
|
||
import static org.finos.waltz.model.EntityReference.mkRef; | ||
import static org.finos.waltz.schema.Tables.*; | ||
|
||
@Repository | ||
public class MeasurableRatingViewDao { | ||
|
||
private static final MeasurableRating mr = MEASURABLE_RATING; | ||
private static final Measurable m = MEASURABLE; | ||
private static final RatingSchemeItem rsi = RATING_SCHEME_ITEM; | ||
private static final MeasurableCategory mc = MEASURABLE_CATEGORY; | ||
|
||
private final DSLContext dsl; | ||
|
||
@Autowired | ||
public MeasurableRatingViewDao(DSLContext dsl) { | ||
this.dsl = dsl; | ||
} | ||
|
||
|
||
/** | ||
* Given an application id will return a set of primary ratings. | ||
* The {@link PrimaryRatingViewItem} is a lightweight object with | ||
* just enough data for display purposes. | ||
* | ||
* @param appId the identifier of the app to return primary ratings | ||
* @return a set of primary ratings, the set will be empty if there are no ratings or the app cannot be found | ||
*/ | ||
public Set<PrimaryRatingViewItem> findPrimaryRatingsForApp(long appId) { | ||
return dsl | ||
.select(mc.ID, | ||
mc.NAME, | ||
mc.DESCRIPTION, | ||
m.ID, | ||
m.NAME, | ||
m.DESCRIPTION, | ||
rsi.NAME, | ||
rsi.DESCRIPTION, | ||
rsi.COLOR) | ||
.from(mr) | ||
.innerJoin(m).on(m.ID.eq(mr.MEASURABLE_ID)) | ||
.innerJoin(mc).on(mc.ID.eq(m.MEASURABLE_CATEGORY_ID)) | ||
.innerJoin(rsi).on(mr.RATING.eq(rsi.CODE) | ||
.and(rsi.SCHEME_ID.eq(mc.RATING_SCHEME_ID))) | ||
.where(mr.ENTITY_KIND.eq(EntityKind.APPLICATION.name()) | ||
.and(mr.ENTITY_ID.eq(appId))) | ||
.fetchSet(r -> ImmutablePrimaryRatingViewItem | ||
.builder() | ||
.measurableCategory(mkRef( | ||
EntityKind.MEASURABLE_CATEGORY, | ||
r.get(mc.ID), | ||
r.get(mc.NAME), | ||
r.get(mc.DESCRIPTION))) | ||
.measurable(mkRef( | ||
EntityKind.MEASURABLE, | ||
r.get(m.ID), | ||
r.get(m.NAME), | ||
r.get(m.DESCRIPTION))) | ||
.ratingName(r.get(rsi.NAME)) | ||
.ratingDescription(r.get(rsi.DESCRIPTION)) | ||
.ratingColor(r.get(rsi.COLOR)) | ||
.build()); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
.../main/java/org/finos/waltz/model/flow_classification_rule/FlowClassificationRuleView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.finos.waltz.model.flow_classification_rule; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import org.finos.waltz.model.assessment_definition.AssessmentDefinition; | ||
import org.finos.waltz.model.assessment_rating.AssessmentRating; | ||
import org.finos.waltz.model.rating.RatingSchemeItem; | ||
import org.immutables.value.Value; | ||
|
||
import java.util.Set; | ||
|
||
@Value.Immutable | ||
@JsonSerialize(as = ImmutableFlowClassificationRuleView.class) | ||
public abstract class FlowClassificationRuleView { | ||
|
||
public abstract Set<FlowClassificationRule> flowClassificationRules(); | ||
|
||
public abstract Set<AssessmentRating> assessmentRatings(); | ||
|
||
public abstract Set<AssessmentDefinition> primaryAssessmentDefinitions(); | ||
|
||
public abstract Set<RatingSchemeItem> ratingSchemeItems(); | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
waltz-model/src/main/java/org/finos/waltz/model/measurable_rating/PrimaryRatingViewItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.finos.waltz.model.measurable_rating; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import org.finos.waltz.model.EntityReference; | ||
import org.finos.waltz.model.rating.RatingSchemeItem; | ||
import org.immutables.value.Value; | ||
|
||
@Value.Immutable | ||
@JsonSerialize(as = ImmutablePrimaryRatingViewItem.class) | ||
public abstract class PrimaryRatingViewItem { | ||
|
||
public abstract EntityReference measurableCategory(); | ||
public abstract EntityReference measurable(); | ||
public abstract String ratingName(); | ||
public abstract String ratingDescription(); | ||
public abstract String ratingColor(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.