Skip to content

Commit

Permalink
Merge pull request #7050 from deutschebank/db-contrib/waltz-7044-euc-…
Browse files Browse the repository at this point in the history
…page

 euc page
  • Loading branch information
davidwatkins73 authored Apr 9, 2024
2 parents ca36aa7 + ca1e9f8 commit e7a02aa
Show file tree
Hide file tree
Showing 16 changed files with 398 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.finos.waltz.model.application.LifecyclePhase;
import org.finos.waltz.model.enduserapp.EndUserApplication;
import org.finos.waltz.model.enduserapp.ImmutableEndUserApplication;
import org.finos.waltz.model.entity_search.EntitySearchOptions;
import org.finos.waltz.model.physical_flow.CriticalityValue;
import org.finos.waltz.model.tally.Tally;
import org.finos.waltz.schema.tables.records.EndUserApplicationRecord;
Expand All @@ -34,6 +35,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

import static java.util.Optional.ofNullable;
Expand Down Expand Up @@ -123,4 +125,5 @@ public List<EndUserApplication> findAll() {
.where(COMMON_CONDITION)
.fetch(TO_DOMAIN_MAPPER);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.finos.waltz.data.end_user_app.search;

import org.finos.waltz.data.SearchDao;
import org.finos.waltz.data.end_user_app.EndUserAppDao;
import org.finos.waltz.model.enduserapp.EndUserApplication;
import org.finos.waltz.model.entity_search.EntitySearchOptions;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

import static java.util.Collections.emptyList;
import static org.finos.waltz.common.ListUtilities.concat;
import static org.finos.waltz.data.JooqUtilities.mkBasicTermSearch;
import static org.finos.waltz.data.JooqUtilities.mkStartsWithTermSearch;
import static org.finos.waltz.data.SearchUtilities.mkTerms;
import static org.finos.waltz.schema.Tables.END_USER_APPLICATION;


@Repository
public class EndUserAppSearchDao implements SearchDao<EndUserApplication> {

private final DSLContext dsl;


@Autowired
public EndUserAppSearchDao(DSLContext dsl) {
this.dsl = dsl;
}


/**
* Searches by <code>name</code> and <code>external_id</code>
* @param options
* @return List of matching end user applications,
* matches on name are given precedence over external_id matches
*/
@Override
public List<EndUserApplication> search(EntitySearchOptions options) {
List<String> terms = mkTerms(options.searchQuery());
if (terms.isEmpty()) {
return emptyList();
}

Condition nameCondition = mkBasicTermSearch(END_USER_APPLICATION.NAME, terms);
Condition externalIdCondition = mkStartsWithTermSearch(END_USER_APPLICATION.EXTERNAL_ID, terms);

return concat(
mkQuery(nameCondition, options),
mkQuery(externalIdCondition, options));
}


private List<EndUserApplication> mkQuery(Condition nameCondition, EntitySearchOptions options) {
return dsl
.select(END_USER_APPLICATION.fields())
.from(END_USER_APPLICATION)
.where(nameCondition)
.orderBy(END_USER_APPLICATION.NAME)
.limit(options.limit())
.fetch(EndUserAppDao.TO_DOMAIN_MAPPER);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public abstract class EndUserApplication implements
DescriptionProvider,
ExternalIdProvider,
NameProvider,
ProvenanceProvider {

ProvenanceProvider,
WaltzEntity {
public abstract Long organisationalUnitId();
public abstract String applicationKind();
public abstract LifecyclePhase lifecyclePhase();
Expand All @@ -45,11 +45,12 @@ public abstract class EndUserApplication implements
@Value.Default
public EntityKind kind() { return EntityKind.END_USER_APPLICATION; }

public EntityReference toEntityReference() {
public EntityReference entityReference() {
return ImmutableEntityReference.builder()
.kind(EntityKind.END_USER_APPLICATION)
.id(id().get())
.name(name())
.description(description())
.build();
}
}
1 change: 1 addition & 0 deletions waltz-ng/client/common/link-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const stateKindTuples = [
{kind: "CHANGE_INITIATIVE", state: "main.change-initiative.view"},
{kind: "CHANGE_SET", state: "main.change-set.view"},
{kind: "DATA_TYPE", state: "main.data-type.view"},
{kind: "END_USER_APPLICATION", state: "main.end-user-application.view"},
{kind: "ENTITY_RELATIONSHIP", state: "main.entity-relationship.view"},
{kind: "ENTITY_STATISTIC", state: "main.entity-statistic.view"},
{kind: "FLOW_DIAGRAM", state: "main.flow-diagram.view"},
Expand Down
9 changes: 5 additions & 4 deletions waltz-ng/client/common/svelte/EntityLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ViewLink from "./ViewLink.svelte";
import EntityLabel from "./EntityLabel.svelte";
import {kindToViewState} from "../link-utils";
import _ from "lodash";
/**
* Entity Link takes an entity ref
Expand All @@ -22,11 +23,11 @@
$: {
try {
state = ref
? kindToViewState(ref.kind)
: null;
state = _.isEmpty(ref)
? null
: kindToViewState(ref.kind);
} catch(e){
console.error(e);
console.error(e, "bad ref?", ref);
}
}
Expand Down
11 changes: 11 additions & 0 deletions waltz-ng/client/dynamic-section/dynamic-section-definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,16 @@ const legalEntityRelationshipSections = [
changeLogSection
];

const endUserApplicationSections = [
assessmentRatingSection,
bookmarksSection,
entityNamedNotesSection,
involvedPeopleSection,
dataFlowSection,
entityDiagramsSection,
changeLogSection
];


export const dynamicSectionsByKind = {
"main.actor.view": actorSections,
Expand All @@ -916,6 +926,7 @@ export const dynamicSectionsByKind = {
"main.database.external-id": databaseSections,
"main.database.view": databaseSections,
"main.entity-relationship.view": entityRelationshipSections,
"main.end-user-application.view": endUserApplicationSections,
"main.flow-classification-rule.view": flowClassificationRuleSections,
"main.flow-diagram.view": flowDiagramSections,
"main.involvement-kind.view": involvementKindSections,
Expand Down
12 changes: 8 additions & 4 deletions waltz-ng/client/end-user-apps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
*
*/

import angular from 'angular';
import * as endUserAppStore from './services/end-user-app-store';
import {registerStore} from '../common/module-utils';
import angular from "angular";
import * as endUserAppStore from "./services/end-user-app-store";
import {registerStore} from "../common/module-utils";
import Routes from "./routes";

export default () => {

const module = angular.module('waltz.end.user.apps', []);
const module = angular.module("waltz.end.user.apps", []);

module
.config(Routes);

registerStore(module, endUserAppStore);

Expand Down
65 changes: 65 additions & 0 deletions waltz-ng/client/end-user-apps/pages/end-user-application-view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import EndUserApplicationOverview
from "../svelte/EndUserApplicationOverview.svelte";
import {initialiseData} from "../../common";
import {CORE_API} from "../../common/services/core-api-utils";

const initialState = {
EndUserApplicationOverview,
parentEntityRef: null,
endUserApplication: null
};


const addToHistory = (historyStore, ref) => {
if (! ref) { return; }
historyStore.put(
ref.name,
"END_USER_APPLICATION",
"main.end-user-application.view",
{ id: ref.id });
};


function controller($stateParams, historyStore, serviceBroker) {

const vm = initialiseData(this, initialState);

const endUserAppId = $stateParams.id;

vm.parentEntityRef = { id: endUserAppId, kind: "END_USER_APPLICATION" };

serviceBroker
.loadViewData(
CORE_API.EndUserAppStore.getById,
[endUserAppId])
.then(r => {
vm.endUserApplication = r.data;
addToHistory(historyStore, vm.endUserApplication);
});
}


controller.$inject = [
"$stateParams",
"HistoryStore",
"ServiceBroker"
];

const template = `
<div>
<waltz-svelte-component component="$ctrl.EndUserApplicationOverview"
end-user-application="$ctrl.endUserApplication">
</waltz-svelte-component>
<br>
<waltz-dynamic-sections-view parent-entity-ref="$ctrl.parentEntityRef">
</waltz-dynamic-sections-view>
</div>`;

export default {
template,
controller,
controllerAs: "$ctrl",
bindToController: true,
};
41 changes: 41 additions & 0 deletions waltz-ng/client/end-user-apps/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific
*
*/

import EndUserApplicationView from "./pages/end-user-application-view";

const baseState = {};


const viewState = {
url: "end-user-application/id/{id:int}",
views: {
"content@": EndUserApplicationView
}

};

function setup($stateProvider) {
$stateProvider
.state("main.end-user-application", baseState)
.state("main.end-user-application.view", viewState);
}

setup.$inject = ["$stateProvider"];


export default setup;
12 changes: 11 additions & 1 deletion waltz-ng/client/end-user-apps/services/end-user-app-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ export function store($http, baseUrl) {
.get(`${BASE}`)
.then(result => result.data);

const getById = (id) => $http
.get(`${BASE}/id/${id}`)
.then(result => result.data);


return {
findBySelector,
countByOrganisationalUnit,
promoteToApplication,
findAll
findAll,
getById
};
}

Expand Down Expand Up @@ -73,6 +78,11 @@ export const EndUserAppStore_API = {
serviceName,
serviceFnName: 'findAll',
description: 'returns all EUDAs that are not promoted'
},
getById: {
serviceName,
serviceFnName: 'getById',
description: 'returns specific EUDA based on id'
}
};

Loading

0 comments on commit e7a02aa

Please sign in to comment.