Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

== DO NOT MERGE == KOGITO-369: [DMN Designer] User can not add an DT column constraint #2935

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 2 additions & 6 deletions kie-wb-common-dmn/.gitignore
Expand Up @@ -13,10 +13,6 @@
# Repository wide ignore mac DS_Store files
.DS_Store

#Ignore DMN's kogito related work on branch DROOLS-3727
#Added to simplify switching branches and avoid accidentially committing unrelated work!
/kie-wb-common-dmn-webapp-kogito-marshaller
/kie-wb-common-dmn-webapp-kogito-runtime
/kie-wb-common-dmn-webapp-kogito-testing
/kie-wb-common-dmn-webapp-standalone
#This is on master. Ignore to make switching branches easier
/kie-wb-common-dmn-webapp

64 changes: 64 additions & 0 deletions kie-wb-common-dmn/README.md
@@ -0,0 +1,64 @@
Graphical DMN modeling tool
===========================

This module contains various children for different purposes.

1) `kie-wb-common-dmn-api`

Common API and UI model used by Business Central and _kogito_.

2) `kie-wb-common-dmn-backend`

Server-side implementation of services relating to marshalling, imports and validation
used exclusively by Business Central and the `kie-wb-common-webapp-standalone` module.

3) `kie-wb-common-dmn-client`

Common client-side code for the _core_ editor used by Business Central and _kogito_.

4) `kie-wb-common-dmn-project-api`

API specific to integration with Business Central.

5) `kie-wb-common-dmn-project-client`

Client-side code specific to the integration with Business Central.

6) `kie-wb-common-dmn-webapp-common`

Client-side code common to the `kie-wb-common-webapp-standalone` and `kie-wb-common-webapp-kogito-testing`
modules. Includes _docks_ and diagram _navigator_. This code is not used by Business Central.

7) `kie-wb-common-dmn-webapp-kogito-common`

Substitute implementations of services in `kie-wb-common-dmn-backend` for _kogito_ client-side use.

8) `kie-wb-common-dmn-webapp-kogito-marshaller`

Client-side marshaller for _kogito_.

9) `kie-wb-common-dmn-webapp-kogito-runtime`

Webapp targeting _kogito_ integration with VSCode etc. No decorations.

10) `kie-wb-common-dmn-webapp-kogito-testing`

Webapp used for development of _kogito_ decorated with a diagram _navigator_ to emulate integration with VSCode etc.

11) `kie-wb-common-dmn-webapp-standalone`

Webapp used for development of Business Central integration.


The _kogito_ modules are isolated by the `kogito` Maven profile. In order to compile and run a _kogito_ related
webapp the following steps need to be adhered to.

1) Clone https://github.com/kiegroup/droolsjbpm-build-bootstrap/ and build the `DROOLS-3727` branch.

2) Clone https://github.com/highsource/jsonix and build the `master` branch. Ignore the failure of the compilation of some sub-modules.. enough is compiled for our use.

3) Clone https://github.com/kiegroup/gwt-jsonix-marshallers and build the `master` branch.

4) Compile `kie-wb-common` using the `kogito` profile; e.g. `mvn clean install -Pkogito`

5) Run one of the _kogito_ webapps using `mvn clean process-resources gwt:run`
42 changes: 14 additions & 28 deletions kie-wb-common-dmn/kie-wb-common-dmn-api/pom.xml
Expand Up @@ -40,33 +40,18 @@
<artifactId>validation-api</artifactId>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>

<!-- Stunner -->
<dependency>
<groupId>org.kie.workbench.stunner</groupId>
<artifactId>kie-wb-common-stunner-core-api</artifactId>
</dependency>

<dependency>
<groupId>org.kie.workbench.stunner</groupId>
<artifactId>kie-wb-common-stunner-client-api</artifactId>
</dependency>

<dependency>
<groupId>org.kie.workbench.stunner</groupId>
<artifactId>kie-wb-common-stunner-core-common</artifactId>
</dependency>

<dependency>
<groupId>org.kie.workbench.stunner</groupId>
<artifactId>kie-wb-common-stunner-shapes-api</artifactId>
<scope>provided</scope>
</dependency>

<!-- Required to generate the DefinitionSet adaptors -->
<dependency>
<groupId>org.kie.workbench.stunner</groupId>
<artifactId>kie-wb-common-stunner-processors</artifactId>
Expand All @@ -83,13 +68,6 @@
<artifactId>kie-wb-common-stunner-forms-api</artifactId>
</dependency>

<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>

<!-- Form Modeler API -->
<dependency>
<groupId>org.kie.workbench.forms</groupId>
Expand All @@ -101,6 +79,7 @@
<artifactId>kie-wb-common-forms-adf-base</artifactId>
</dependency>

<!-- Required to generate the Properties Panel form adaptors -->
<dependency>
<groupId>org.kie.workbench.forms</groupId>
<artifactId>kie-wb-common-forms-adf-processors</artifactId>
Expand Down Expand Up @@ -149,11 +128,6 @@
<artifactId>uberfire-api</artifactId>
</dependency>

<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-commons</artifactId>
</dependency>

<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-project-api</artifactId>
Expand All @@ -170,6 +144,18 @@
<artifactId>kie-dmn-model</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Expand Up @@ -77,13 +77,12 @@ public void setExtensionElements(final ExtensionElements extensionElements) {
this.extensionElements = extensionElements;
}

//TODO {manstis} The DMN model uses Object not String
@Portable
public static class ExtensionElements extends DMNModelInstrumentedBase {

protected List<String> any;
protected List<Object> any;

public List<String> getAny() {
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<>();
}
Expand Down
Expand Up @@ -109,10 +109,10 @@ public Optional<String> getPrefixForNamespaceURI(final String namespaceURI) {
public String getDefaultNamespace() {
if (nsContext != null && nsContext.containsKey("")) {
return nsContext.entrySet().stream()
.filter(kv -> Objects.equals(kv.getKey(), ""))
.findFirst()
.map(Map.Entry::getValue)
.get();
.filter(kv -> Objects.equals(kv.getKey(), ""))
.findFirst()
.map(Map.Entry::getValue)
.get();
}
if (this.parent != null) {
return parent.getDefaultNamespace();
Expand Down
Expand Up @@ -17,6 +17,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.jboss.errai.common.client.api.annotations.Portable;
import org.kie.workbench.common.dmn.api.definition.HasExpression;
Expand Down Expand Up @@ -148,22 +149,34 @@ public int hashCode() {

@Portable
public enum Kind {
FEEL("F"),
JAVA("J"),
PMML("P");
FEEL("F", "FEEL"),
JAVA("J", "Java"),
PMML("P", "PMML");

private final String code;
private final String value;

Kind(final String code) {
Kind(final String code,
final String value) {
this.code = code;
this.value = value;
}

public String code() {
return code;
}

public static Kind fromValue(final String value) {
for (Kind kind : Kind.values()) {
if (Objects.equals(kind.value, value)) {
return kind;
}
}
throw new IllegalArgumentException("FunctionKind [" + value + "] is not supported.");
}

public static FunctionDefinition.Kind determineFromString(final String code) {
return code == null ? null : (FEEL.code.equals(code) ? FEEL : (JAVA.code.equals(code) ? JAVA : (PMML.code.equals(code) ? PMML : null)));
return code == null ? null : Objects.equals(FEEL.code, code) ? FEEL : (Objects.equals(JAVA.code, code) ? JAVA : (Objects.equals(PMML.code, code) ? PMML : null));
}
}
}
Expand Up @@ -20,8 +20,7 @@
import org.kie.workbench.common.stunner.core.factory.diagram.DiagramFactory;
import org.kie.workbench.common.stunner.core.graph.Graph;

public interface DMNDiagramFactory
extends DMNFactory,
DiagramFactory<Metadata, Diagram<Graph, Metadata>> {
public interface DMNDiagramFactory extends DMNFactory,
DiagramFactory<Metadata, Diagram<Graph, Metadata>> {

}
Expand Up @@ -18,7 +18,6 @@
import javax.enterprise.context.Dependent;

import org.kie.workbench.common.dmn.api.DMNDefinitionSet;
import org.kie.workbench.common.stunner.core.diagram.AbstractDiagram;
import org.kie.workbench.common.stunner.core.diagram.Diagram;
import org.kie.workbench.common.stunner.core.diagram.DiagramImpl;
import org.kie.workbench.common.stunner.core.diagram.Metadata;
Expand All @@ -41,12 +40,12 @@ public Class<? extends Metadata> getMetadataType() {
}

@Override
public Diagram<Graph, Metadata> doBuild(final String name,
final Metadata metadata,
final Graph<DefinitionSet, ?> graph) {
final AbstractDiagram<Graph, Metadata> result = new DiagramImpl(name,
metadata);
result.setGraph(graph);
public Diagram doBuild(final String name,
final Metadata metadata,
final Graph<DefinitionSet, ?> graph) {
final Diagram result = new DiagramImpl(name,
graph,
metadata);
return result;
}
}
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.dmn.backend.common;
package org.kie.workbench.common.dmn.api.marshalling;

import org.uberfire.backend.vfs.Path;

Expand Down
@@ -0,0 +1,103 @@
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* 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 language governing permissions and
* limitations under the License.
*/

package org.kie.workbench.common.dmn.api.marshalling;

import java.io.InputStream;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.guvnor.common.services.project.model.WorkspaceProject;
import org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata;
import org.kie.workbench.common.stunner.core.diagram.Metadata;
import org.uberfire.backend.vfs.Path;

/**
* This helper provides methods to handle imports into the DMNMarshaller.
*/
public interface DMNMarshallerImportsHelper<IMPORT, DEFINITIONS, DRGELEMENT, ITEMDEFINITION> {

/**
* This method loads all imported DMN definitions from a list of imports.
* @param metadata represents the metadata from the main DMN model.
* @param imports represent the list of imported files.
* @return a map {@link DEFINITIONS} indexed by {@link IMPORT}s.
*/
Map<IMPORT, DEFINITIONS> getImportDefinitions(final Metadata metadata,
final List<IMPORT> imports);

/**
* This method loads all imported PMML documents from a list of imports.
* @param metadata represents the metadata from the main DMN model.
* @param imports represent the list of imported files.
* @return a map {@link PMMLDocumentMetadata} indexed by {@link IMPORT}s.
*/
Map<IMPORT, PMMLDocumentMetadata> getPMMLDocuments(final Metadata metadata,
final List<IMPORT> imports);

/**
* This method loads {@link String} of all imported XML files from a list of imports.
* @param metadata represents the metadata from the main DMN model.
* @param imports represent the list of imported files.
* @return a map {@link String} indexed by {@link IMPORT}s.
*/
Map<IMPORT, String> getImportXML(final Metadata metadata,
final List<IMPORT> imports);

/**
* This method extract a list of {@link DRGELEMENT}s from the <code>importDefinitions</code> map.
* @param importDefinitions is a map of {@link DEFINITIONS} indexed by {@link IMPORT}.
* @return a list of imported {@link DRGELEMENT}s.
*/
List<DRGELEMENT> getImportedDRGElements(final Map<IMPORT, DEFINITIONS> importDefinitions);

/**
* This method extract a list of {@link ITEMDEFINITION} from the <code>importDefinitions</code> map.
* @param importDefinitions is a map of {@link DEFINITIONS} indexed by {@link IMPORT}.
* @return a list of imported {@link ITEMDEFINITION}s.
*/
List<ITEMDEFINITION> getImportedItemDefinitions(final Map<IMPORT, DEFINITIONS> importDefinitions);

/**
* This method finds the list of {@link ITEMDEFINITION}s for a given <code>namespace</code>.
* @param workspaceProject represents the project that will be scanned.
* @param modelName is the value used as the prefix for imported {@link ITEMDEFINITION}s.
* @param namespace is the namespace of the model that provides the list of {@link ITEMDEFINITION}s.
* @return a list of imported {@link ITEMDEFINITION}s.
*/
List<ITEMDEFINITION> getImportedItemDefinitionsByNamespace(final WorkspaceProject workspaceProject,
final String modelName,
final String namespace);

/**
* This method finds the {@link Path} of DMN model.
* @param metadata represents the metadata from the a DMN model from the scanned project.
* @param modelNamespace represents the namespace of the desired DMN model.
* @param modelName represents the mode name of the desired DMN model.
* @return the {@link Path} of the desired DMN model.
*/
Path getDMNModelPath(final Metadata metadata,
final String modelNamespace,
final String modelName);

/**
* This method loads the {@link InputStream} from a given {@link org.uberfire.backend.vfs.Path}.
* @param path to be loaded.
* @return the {@link InputStream} when the path is valid, otherwise is returns empty.
*/
Optional<InputStream> loadPath(final Path path);
}