diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ArtifactConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ArtifactConverter.java new file mode 100644 index 00000000000..25fc33bbdaa --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ArtifactConverter.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; + +public abstract class ArtifactConverter extends DMNElementConverter { + + public ArtifactConverter(XStream xstream) { + super(xstream); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AssociationConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AssociationConverter.java new file mode 100644 index 00000000000..411989b9e7e --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AssociationConverter.java @@ -0,0 +1,89 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Association; +import org.kie.dmn.model.api.AssociationDirection; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TAssociation; + +public class AssociationConverter extends ArtifactConverter { + public static final String TARGET_REF = "targetRef"; + public static final String SOURCE_REF = "sourceRef"; + public static final String ASSOCIATION_DIRECTION = "associationDirection"; + + public AssociationConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TAssociation(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TAssociation.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Association a = (Association) parent; + + if( SOURCE_REF.equals( nodeName ) ) { + a.setSourceRef( (DMNElementReference) child ); + } else if( TARGET_REF.equals( nodeName ) ) { + a.setTargetRef( (DMNElementReference) child ); + } else { + super.assignChildElement( parent, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Association a = (Association) parent; + + String associationDirectionValue = reader.getAttribute(ASSOCIATION_DIRECTION); + + if (associationDirectionValue != null) a.setAssociationDirection(AssociationDirection.fromValue(associationDirectionValue)); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Association a = (Association) parent; + + writeChildrenNode(writer, context, a.getSourceRef(), SOURCE_REF); + writeChildrenNode(writer, context, a.getTargetRef(), TARGET_REF); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Association a = (Association) parent; + + if (a.getAssociationDirection() != null) writer.addAttribute(ASSOCIATION_DIRECTION, a.getAssociationDirection().value()); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AuthorityRequirementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AuthorityRequirementConverter.java new file mode 100644 index 00000000000..03d76f6b0c7 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/AuthorityRequirementConverter.java @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TAuthorityRequirement; + +public class AuthorityRequirementConverter extends DMNElementConverter { + public static final String REQUIRED_AUTHORITY = "requiredAuthority"; + public static final String REQUIRED_INPUT = "requiredInput"; + public static final String REQUIRED_DECISION = "requiredDecision"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + AuthorityRequirement ar = (AuthorityRequirement) parent; + + if (REQUIRED_DECISION.equals(nodeName)) { + ar.setRequiredDecision( (DMNElementReference) child ); + } else if (REQUIRED_INPUT.equals(nodeName)) { + ar.setRequiredInput( (DMNElementReference) child ); + } else if (REQUIRED_AUTHORITY.equals(nodeName)) { + ar.setRequiredAuthority( (DMNElementReference) child ); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + AuthorityRequirement ar = (AuthorityRequirement) parent; + + if (ar.getRequiredDecision() != null) writeChildrenNode(writer, context, ar.getRequiredDecision(), REQUIRED_DECISION); + if (ar.getRequiredInput() != null) writeChildrenNode(writer, context, ar.getRequiredInput(), REQUIRED_INPUT); + if (ar.getRequiredAuthority() != null) writeChildrenNode(writer, context, ar.getRequiredAuthority(), REQUIRED_AUTHORITY); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public AuthorityRequirementConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TAuthorityRequirement(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TAuthorityRequirement.class); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BindingConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BindingConverter.java new file mode 100644 index 00000000000..b2c3f79d6c4 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BindingConverter.java @@ -0,0 +1,85 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Binding; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.v1_5.TBinding; + +public class BindingConverter extends DMNModelInstrumentedBaseConverter { + public static final String EXPRESSION = "expression"; + public static final String PARAMETER = "parameter"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Binding b = (Binding) parent; + + if (PARAMETER.equals(nodeName)) { + b.setParameter((InformationItem) child); + } else if (child instanceof Expression) { + b.setExpression((Expression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Binding b = (Binding) parent; + + writeChildrenNode(writer, context, b.getParameter(), PARAMETER); + if (b.getExpression() != null) writeChildrenNode(writer, context, b.getExpression(), MarshallingUtils.defineExpressionNodeName(xstream, b.getExpression())); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public BindingConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TBinding(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TBinding.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BoundsConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BoundsConverter.java new file mode 100644 index 00000000000..8119f1c7ccb --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BoundsConverter.java @@ -0,0 +1,85 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.Bounds; + +public class BoundsConverter extends DMNModelInstrumentedBaseConverter { + + + private static final String HEIGHT = "height"; + private static final String WIDTH = "width"; + private static final String Y = "y"; + private static final String X = "x"; + + public BoundsConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Bounds abs = (Bounds) parent; + + abs.setX(Double.valueOf(reader.getAttribute(X))); + abs.setY(Double.valueOf(reader.getAttribute(Y))); + abs.setWidth(Double.valueOf(reader.getAttribute(WIDTH))); + abs.setHeight(Double.valueOf(reader.getAttribute(HEIGHT))); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + Bounds abs = (Bounds) parent; + + writer.addAttribute(X, org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils.manageDouble(abs.getX())); + writer.addAttribute(Y, org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils.manageDouble(abs.getY())); + writer.addAttribute(WIDTH, org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils.manageDouble(abs.getWidth())); + writer.addAttribute(HEIGHT, FormatUtils.manageDouble(abs.getHeight())); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.Bounds(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.Bounds.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessContextElementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessContextElementConverter.java new file mode 100644 index 00000000000..3e9271c2968 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessContextElementConverter.java @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.BusinessContextElement; + +public abstract class BusinessContextElementConverter extends NamedElementConverter { + public static final String URI = "URI"; + + public BusinessContextElementConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + BusinessContextElement bce = (BusinessContextElement) parent; + + String uri = reader.getAttribute(URI); + + bce.setURI(uri); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + BusinessContextElement bce = (BusinessContextElement) parent; + + if (bce.getURI() != null) writer.addAttribute(URI, bce.getURI()); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessKnowledgeModelConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessKnowledgeModelConverter.java new file mode 100644 index 00000000000..6c661df66ae --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/BusinessKnowledgeModelConverter.java @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.BusinessKnowledgeModel; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.FunctionDefinition; +import org.kie.dmn.model.api.KnowledgeRequirement; +import org.kie.dmn.model.v1_5.TBusinessKnowledgeModel; + +public class BusinessKnowledgeModelConverter extends InvocableConverter { + public static final String ENCAPSULATED_LOGIC = "encapsulatedLogic"; + public static final String VARIABLE = "variable"; + public static final String KNOWLEDGE_REQUIREMENT = "knowledgeRequirement"; + public static final String AUTHORITY_REQUIREMENT = "authorityRequirement"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + BusinessKnowledgeModel bkm = (BusinessKnowledgeModel) parent; + + if (ENCAPSULATED_LOGIC.equals(nodeName)) { + bkm.setEncapsulatedLogic((FunctionDefinition) child); + } else if (KNOWLEDGE_REQUIREMENT.equals(nodeName)) { + bkm.getKnowledgeRequirement().add((KnowledgeRequirement) child); + } else if (AUTHORITY_REQUIREMENT.equals(nodeName)) { + bkm.getAuthorityRequirement().add((AuthorityRequirement) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + BusinessKnowledgeModel bkm = (BusinessKnowledgeModel) parent; + + if (bkm.getEncapsulatedLogic() != null) writeChildrenNode(writer, context, bkm.getEncapsulatedLogic(), ENCAPSULATED_LOGIC); + // Now as Invocable: if (bkm.getVariable() != null) writeChildrenNode(writer, context, bkm.getVariable(), VARIABLE); + for (KnowledgeRequirement i : bkm.getKnowledgeRequirement()) { + writeChildrenNode(writer, context, i, KNOWLEDGE_REQUIREMENT); + } + for (AuthorityRequirement a : bkm.getAuthorityRequirement()) { + writeChildrenNode(writer, context, a, AUTHORITY_REQUIREMENT); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public BusinessKnowledgeModelConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TBusinessKnowledgeModel(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TBusinessKnowledgeModel.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ChildExpressionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ChildExpressionConverter.java new file mode 100644 index 00000000000..ae0af3d2fd5 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ChildExpressionConverter.java @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.v1_5.TChildExpression; + +public class ChildExpressionConverter extends DMNModelInstrumentedBaseConverter { + + public static final String ID = "id"; + + public ChildExpressionConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + ChildExpression i = (ChildExpression) parent; + + if (child instanceof Expression) { + i.setExpression((Expression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + String id = reader.getAttribute( ID ); + + if (id != null) { + ((ChildExpression) parent).setId(id); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + ChildExpression e = (ChildExpression) parent; + + if (e.getId() != null) { + writer.addAttribute(ID, e.getId()); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + ChildExpression i = (ChildExpression) parent; + + writeChildrenNode(writer, context, i.getExpression(), MarshallingUtils.defineExpressionNodeName(xstream, i.getExpression())); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TChildExpression(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TChildExpression.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ColorConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ColorConverter.java new file mode 100644 index 00000000000..230f5cdcee6 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ColorConverter.java @@ -0,0 +1,80 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.Color; + +public class ColorConverter extends DMNModelInstrumentedBaseConverter { + + private static final String RED = "red"; + private static final String GREEN = "green"; + private static final String BLUE = "blue"; + + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Color style = (Color) parent; + + style.setRed(Integer.valueOf(reader.getAttribute(RED))); + style.setGreen(Integer.valueOf(reader.getAttribute(GREEN))); + style.setBlue(Integer.valueOf(reader.getAttribute(BLUE))); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Color style = (Color) parent; + + writer.addAttribute(RED, Integer.valueOf(style.getRed()).toString()); + writer.addAttribute(GREEN, Integer.valueOf(style.getGreen()).toString()); + writer.addAttribute(BLUE, Integer.valueOf(style.getBlue()).toString()); + } + + public ColorConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.Color(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(org.kie.dmn.model.v1_5.dmndi.Color.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ConditionalConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ConditionalConverter.java new file mode 100644 index 00000000000..bd64a8b0351 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ConditionalConverter.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Conditional; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TChildExpression; +import org.kie.dmn.model.v1_5.TConditional; + +public class ConditionalConverter extends ExpressionConverter { + + public static final String IF = "if"; + public static final String THEN = "then"; + public static final String ELSE = "else"; + + public ConditionalConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Conditional cond = (Conditional) parent; + + if (IF.equals(nodeName)) { + cond.setIf((ChildExpression) child); + } else if (THEN.equals(nodeName)) { + cond.setThen((ChildExpression) child); + } else if (ELSE.equals(nodeName)) { + cond.setElse((ChildExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Conditional cond = (Conditional) parent; + writeChildrenNode(writer, context, cond.getIf(), IF); + writeChildrenNode(writer, context, cond.getThen(), THEN); + writeChildrenNode(writer, context, cond.getElse(), ELSE); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TConditional(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TConditional.class); + } + + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, IF, TChildExpression.class); + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, THEN, TChildExpression.class); + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, ELSE, TChildExpression.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextConverter.java new file mode 100644 index 00000000000..4cb7d913b31 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextConverter.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Context; +import org.kie.dmn.model.api.ContextEntry; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TContext; + +public class ContextConverter extends ExpressionConverter { + public static final String CONTEXT_ENTRY = "contextEntry"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Context c = (Context) parent; + + if (CONTEXT_ENTRY.equals(nodeName)) { + c.getContextEntry().add((ContextEntry) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Context c = (Context) parent; + + for (ContextEntry ce : c.getContextEntry()) { + writeChildrenNode(writer, context, ce, CONTEXT_ENTRY); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public ContextConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TContext(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TContext.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextEntryConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextEntryConverter.java new file mode 100644 index 00000000000..2ec439d0031 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ContextEntryConverter.java @@ -0,0 +1,85 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ContextEntry; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.v1_5.TContextEntry; + +public class ContextEntryConverter extends DMNElementConverter { + public static final String EXPRESSION = "expression"; + public static final String VARIABLE = "variable"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + ContextEntry ce = (ContextEntry) parent; + + if (VARIABLE.equals(nodeName)) { + ce.setVariable((InformationItem) child); + } else if (child instanceof Expression) { + ce.setExpression((Expression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + ContextEntry ce = (ContextEntry) parent; + + if (ce.getVariable() != null) writeChildrenNode(writer, context, ce.getVariable(), VARIABLE); + writeChildrenNode(writer, context, ce.getExpression(), MarshallingUtils.defineExpressionNodeName(xstream, ce.getExpression())); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public ContextEntryConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TContextEntry(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TContextEntry.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNBaseConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNBaseConverter.java new file mode 100644 index 00000000000..412c70f6408 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNBaseConverter.java @@ -0,0 +1,105 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.mapper.Mapper; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; + +public abstract class DMNBaseConverter + extends AbstractCollectionConverter { + + public DMNBaseConverter(Mapper mapper) { + super( mapper ); + } + + public void marshal( + Object object, + HierarchicalStreamWriter writer, + MarshallingContext context) { + writeAttributes(writer, object); + writeChildren(writer, context, object); + } + + protected void writeChildrenNode(HierarchicalStreamWriter writer, MarshallingContext context, Object node, String nodeAlias) { + writer.startNode(nodeAlias); + context.convertAnother(node); + writer.endNode(); + } + + protected void writeChildrenNodeAsValue(HierarchicalStreamWriter writer, MarshallingContext context, String nodeValue, String nodeAlias) { + writer.startNode(nodeAlias); + writer.setValue(nodeValue); + writer.endNode(); + } + + protected abstract void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent); + + protected abstract void writeAttributes(HierarchicalStreamWriter writer, Object parent); + + public Object unmarshal( + HierarchicalStreamReader reader, + UnmarshallingContext context) { + DMNModelInstrumentedBase obj = createModelObject(); + assignAttributes( reader, obj ); + parseElements( reader, context, obj ); + return obj; + } + + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + while ( reader.hasMoreChildren() ) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + Object object = readItem( + reader, + context, + null ); + if( object instanceof DMNModelInstrumentedBase ) { + ((DMNModelInstrumentedBase) object).setParent((DMNModelInstrumentedBase) parent); + ((DMNModelInstrumentedBase) parent).addChildren((DMNModelInstrumentedBase) object); + } + reader.moveUp(); + assignChildElement( parent, nodeName, object ); + } + } + + protected abstract DMNModelInstrumentedBase createModelObject(); + + protected abstract void assignChildElement(Object parent, String nodeName, Object child); + + protected abstract void assignAttributes(HierarchicalStreamReader reader, Object parent); + + protected void mvDownConvertAnotherMvUpAssignChildElement(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent, String expectedNodeName, Class type) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + if (!expectedNodeName.equals(nodeName)) throw new IllegalStateException(); + Object object = context.convertAnother(null, type); + if( object instanceof DMNModelInstrumentedBase ) { + ((DMNModelInstrumentedBase) object).setParent((DMNModelInstrumentedBase) parent); + ((DMNModelInstrumentedBase) parent).addChildren((DMNModelInstrumentedBase) object); + } + reader.moveUp(); + assignChildElement( parent, nodeName, object ); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDIConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDIConverter.java new file mode 100644 index 00000000000..e1d71863355 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDIConverter.java @@ -0,0 +1,90 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.DMNDI; +import org.kie.dmn.model.api.dmndi.DMNDiagram; +import org.kie.dmn.model.api.dmndi.DMNStyle; + +public class DMNDIConverter extends DMNModelInstrumentedBaseConverter { + + private static final String DMN_STYLE = "DMNStyle"; + private static final String DMN_DIAGRAM = "DMNDiagram"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNDI list = (DMNDI) parent; + + if (child instanceof DMNDiagram) { + list.getDMNDiagram().add((DMNDiagram) child); + } else if (child instanceof DMNStyle) { + list.getDMNStyle().add((DMNStyle) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNDI list = (DMNDI) parent; + + for (DMNDiagram e : list.getDMNDiagram()) { + writeChildrenNode(writer, context, e, DMN_DIAGRAM); + } + for (DMNStyle e : list.getDMNStyle()) { + writeChildrenNode(writer, context, e, DMN_STYLE); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public DMNDIConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNDI(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(org.kie.dmn.model.v1_5.dmndi.DMNDI.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDecisionServiceDividerLineConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDecisionServiceDividerLineConverter.java new file mode 100644 index 00000000000..dbcdd95ae9d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDecisionServiceDividerLineConverter.java @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; + +public class DMNDecisionServiceDividerLineConverter extends EdgeConverter { + + public DMNDecisionServiceDividerLineConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNDecisionServiceDividerLine(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.DMNDecisionServiceDividerLine.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDiagramConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDiagramConverter.java new file mode 100644 index 00000000000..96a2438ec3d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNDiagramConverter.java @@ -0,0 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.DMNDiagram; +import org.kie.dmn.model.api.dmndi.DiagramElement; +import org.kie.dmn.model.api.dmndi.Dimension; + +public class DMNDiagramConverter extends DiagramConverter { + + private static final String SIZE = "Size"; + private static final String USE_ALTERNATIVE_INPUT_DATA_SHAPE = "useAlternativeInputDataShape"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNDiagram style = (DMNDiagram) parent; + + if (child instanceof Dimension) { + style.setSize((Dimension) child); + } else if (child instanceof DiagramElement) { + style.getDMNDiagramElement().add((DiagramElement) child); + } else { + super.assignChildElement(style, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DMNDiagram id = (DMNDiagram) parent; + id.setUseAlternativeInputDataShape( + Boolean.parseBoolean(reader.getAttribute(USE_ALTERNATIVE_INPUT_DATA_SHAPE))); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNDiagram style = (DMNDiagram) parent; + + if (style.getSize() != null) { + writeChildrenNode(writer, context, style.getSize(), SIZE); + } + for (DiagramElement de : style.getDMNDiagramElement()) { + writeChildrenNode(writer, context, de, de.getClass().getSimpleName()); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DMNDiagram id = (DMNDiagram) parent; + + if (id.getUseAlternativeInputDataShape() != null) { + writer.addAttribute(USE_ALTERNATIVE_INPUT_DATA_SHAPE, id.getUseAlternativeInputDataShape().toString()); + } + } + + public DMNDiagramConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNDiagram(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(org.kie.dmn.model.v1_5.dmndi.DMNDiagram.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNEdgeConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNEdgeConverter.java new file mode 100644 index 00000000000..a64d8b3f6ff --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNEdgeConverter.java @@ -0,0 +1,108 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.DMNEdge; +import org.kie.dmn.model.api.dmndi.DMNLabel; + +public class DMNEdgeConverter extends EdgeConverter { + + private static final String DMN_ELEMENT_REF = "dmnElementRef"; + private static final String SOURCE_ELEMENT = "sourceElement"; + private static final String TARGET_ELEMENT = "targetElement"; + private static final String DMN_LABEL = "DMNLabel"; + + public DMNEdgeConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNEdge concrete = (DMNEdge) parent; + + if (child instanceof DMNLabel) { + concrete.setDMNLabel((DMNLabel) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DMNEdge concrete = (DMNEdge) parent; + + String dmnElementRef = reader.getAttribute(DMN_ELEMENT_REF); + String sourceElement = reader.getAttribute(SOURCE_ELEMENT); + String targetElement = reader.getAttribute(TARGET_ELEMENT); + + if (dmnElementRef != null) { + concrete.setDmnElementRef(org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.parseQNameString(dmnElementRef)); + } + if (sourceElement != null) { + concrete.setSourceElement(org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.parseQNameString(sourceElement)); + } + if (targetElement != null) { + concrete.setTargetElement(org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.parseQNameString(targetElement)); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNEdge concrete = (DMNEdge) parent; + + if (concrete.getDMNLabel() != null) { + writeChildrenNode(writer, context, concrete.getDMNLabel(), DMN_LABEL); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + DMNEdge concrete = (DMNEdge) parent; + if (concrete.getDmnElementRef() != null) { + writer.addAttribute(DMN_ELEMENT_REF, org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.formatQName(concrete.getDmnElementRef(), concrete)); + } + if (concrete.getSourceElement() != null) { + writer.addAttribute(SOURCE_ELEMENT, org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.formatQName(concrete.getSourceElement(), concrete)); + } + if (concrete.getTargetElement() != null) { + writer.addAttribute(TARGET_ELEMENT, MarshallingUtils.formatQName(concrete.getTargetElement(), concrete)); + } + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNEdge(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.DMNEdge.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementConverter.java new file mode 100644 index 00000000000..10dbf0323ea --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementConverter.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElement; + +public abstract class DMNElementConverter + extends DMNModelInstrumentedBaseConverter { + public static final String ID = "id"; + public static final String LABEL = "label"; + public static final String DESCRIPTION = "description"; + public static final String EXTENSION_ELEMENTS = "extensionElements"; + + public DMNElementConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + if ( DESCRIPTION.equals( nodeName ) && child instanceof String ) { + ((DMNElement) parent).setDescription( (String) child ); + } else if(EXTENSION_ELEMENTS.equals(nodeName) + && child instanceof DMNElement.ExtensionElements) { + ((DMNElement)parent).setExtensionElements((DMNElement.ExtensionElements)child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + String id = reader.getAttribute( ID ); + String label = reader.getAttribute( LABEL ); + + DMNElement dmne = (DMNElement) parent; + + dmne.setId( id ); + dmne.setLabel( label ); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNElement e = (DMNElement) parent; + + if (e.getDescription() !=null) { writeChildrenNodeAsValue(writer, context, e.getDescription(), DESCRIPTION); } + if (e.getExtensionElements() != null ) { writeChildrenNode(writer, context, e.getExtensionElements(), EXTENSION_ELEMENTS); } + } + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DMNElement e = (DMNElement) parent; + + if (e.getId() != null) writer.addAttribute( ID , e.getId() ); + if (e.getLabel() != null) writer.addAttribute( LABEL , e.getLabel() ); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementReferenceConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementReferenceConverter.java new file mode 100644 index 00000000000..fdcaa4a2fbf --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNElementReferenceConverter.java @@ -0,0 +1,76 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TDMNElementReference; + +public class DMNElementReferenceConverter + extends DMNModelInstrumentedBaseConverter { + + private static final String HREF = "href"; + + public DMNElementReferenceConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TDMNElementReference.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement( parent, nodeName, child ); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + DMNElementReference er = (DMNElementReference) parent; + + String href = reader.getAttribute( HREF ); + + er.setHref( href ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDMNElementReference(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + // no children nodes. + } + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DMNElementReference er = (DMNElementReference) parent; + + if ( er.getHref() != null ) writer.addAttribute(HREF, er.getHref()); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNLabelConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNLabelConverter.java new file mode 100644 index 00000000000..2377b0f42eb --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNLabelConverter.java @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.DMNLabel; + +public class DMNLabelConverter extends ShapeConverter { + + public static final String TEXT = "Text"; + + public DMNLabelConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNLabel concrete = (DMNLabel) parent; + + if (nodeName.equals(TEXT)) { + concrete.setText((String) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNLabel concrete = (DMNLabel) parent; + + if (concrete.getText() != null) { + writeChildrenNode(writer, context, concrete.getText(), TEXT); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNLabel(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.DMNLabel.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNListConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNListConverter.java new file mode 100644 index 00000000000..fcadabbb8d6 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNListConverter.java @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.List; +import org.kie.dmn.model.v1_5.TList; + +public class DMNListConverter extends ExpressionConverter { + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + List list = (List) parent; + + if (child instanceof Expression) { + list.getExpression().add((Expression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + List list = (List) parent; + + for (Expression e : list.getExpression()) { + writeChildrenNode(writer, context, e, MarshallingUtils.defineExpressionNodeName(xstream, e)); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public DMNListConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TList(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TList.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNModelInstrumentedBaseConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNModelInstrumentedBaseConverter.java new file mode 100644 index 00000000000..e2cb72702ca --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNModelInstrumentedBaseConverter.java @@ -0,0 +1,118 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.CustomStaxReader; +import org.kie.dmn.backend.marshalling.CustomStaxWriter; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TDefinitions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.namespace.QName; +import java.util.Map; +import java.util.Map.Entry; + +public abstract class DMNModelInstrumentedBaseConverter + extends DMNBaseConverter { + + private static final Logger LOG = LoggerFactory.getLogger(DMNModelInstrumentedBaseConverter.class); + + protected XStream xstream; + + public DMNModelInstrumentedBaseConverter(XStream xstream) { + super( xstream.getMapper() ); + this.xstream = xstream; + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + KieDMNModelInstrumentedBase mib = (KieDMNModelInstrumentedBase) parent; + + CustomStaxReader customStaxReader = (CustomStaxReader) reader.underlyingReader(); + + Map currentNSCtx = customStaxReader.getNsContext(); + mib.getNsContext().putAll(currentNSCtx); + + mib.setLocation( customStaxReader.getLocation() ); + + mib.setAdditionalAttributes( customStaxReader.getAdditionalAttributes() ); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + // no call to super as super is abstract method. + } + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + KieDMNModelInstrumentedBase mib = (KieDMNModelInstrumentedBase) parent; + + CustomStaxWriter staxWriter = ((CustomStaxWriter) writer.underlyingWriter()); + for (Entry kv : mib.getNsContext().entrySet()) { + try { + if (KieDMNModelInstrumentedBase.URI_DMN.equals(kv.getValue())) { + // skip as that is the default namespace xmlns<:prefix>=DMN is handled by the stax driver. + } else { + staxWriter.writeNamespace(kv.getKey(), kv.getValue()); + } + } catch (Exception e) { + LOG.warn("The XML driver writer failed to manage writing namespace, namespaces prefixes could be wrong in the resulting file.", e); + } + } + + for ( Entry kv : mib.getAdditionalAttributes().entrySet() ) { + staxWriter.addAttribute(kv.getKey().getPrefix() + ":" + kv.getKey().getLocalPart(), kv.getValue()); + } + + if (parent instanceof TDefinitions) { + TDefinitions tDefinitions = (TDefinitions) parent; + String dmndiPrefix = tDefinitions.getPrefixForNamespaceURI(KieDMNModelInstrumentedBase.URI_DMNDI).orElse("dmndi"); + String diPrefix = tDefinitions.getPrefixForNamespaceURI(KieDMNModelInstrumentedBase.URI_DI).orElse("di"); + String dcPrefix = tDefinitions.getPrefixForNamespaceURI(KieDMNModelInstrumentedBase.URI_DC).orElse("dc"); + + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNDI", dmndiPrefix), "DMNDI"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNDiagram", dmndiPrefix), "DMNDiagram"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNStyle", dmndiPrefix), "style"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNStyle", dmndiPrefix), "DMNStyle"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNShape", dmndiPrefix), "DMNShape"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNEdge", dmndiPrefix), "DMNEdge"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNDecisionServiceDividerLine", dmndiPrefix), "DMNDecisionServiceDividerLine"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "DMNLabel", dmndiPrefix), "DMNLabel"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, DMNLabelConverter.TEXT, dmndiPrefix), DMNLabelConverter.TEXT); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "Size", dmndiPrefix), "Size"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "useAlternativeInputDataShape", dmndiPrefix), "useAlternativeInputDataShape"); + + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "FillColor", dmndiPrefix), "FillColor"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "StrokeColor", dmndiPrefix), "StrokeColor"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DMNDI, "FontColor", dmndiPrefix), "FontColor"); + + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DI, "waypoint", diPrefix), "waypoint"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DI, "extension", diPrefix), "extension"); + staxWriter.getQNameMap().registerMapping(new QName(KieDMNModelInstrumentedBase.URI_DC, "Bounds", dcPrefix), "Bounds"); + } + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNShapeConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNShapeConverter.java new file mode 100644 index 00000000000..be45b4af9b8 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNShapeConverter.java @@ -0,0 +1,118 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine; +import org.kie.dmn.model.api.dmndi.DMNLabel; +import org.kie.dmn.model.v1_5.dmndi.DMNShape; + +public class DMNShapeConverter extends ShapeConverter { + + private static final String FILL_COLOR = "FillColor"; + private static final String STROKE_COLOR = "StrokeColor"; + private static final String FONT_COLOR = "FontColor"; + + private static final String FONT_FAMILY = "fontFamily"; + private static final String FONT_SIZE = "fontSize"; + private static final String FONT_ITALIC = "fontItalic"; + private static final String FONT_BOLD = "fontBold"; + private static final String FONT_UNDERLINE = "fontUnderline"; + private static final String FONT_STRIKE_THROUGH = "fontStrikeThrough"; + private static final String LABEL_HORIZONTAL_ALIGNMENT = "labelHorizontalAlignement"; + private static final String LABEL_VERTICAL_ALIGNMENT = "labelVerticalAlignment"; + + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNShape style = (DMNShape) parent; + + if (child instanceof DMNLabel) { + style.setDMNLabel((DMNLabel) child); + } else if (child instanceof DMNDecisionServiceDividerLine) { + style.setDMNDecisionServiceDividerLine((DMNDecisionServiceDividerLine) child); + } else { + super.assignChildElement(style, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DMNShape style = (DMNShape) parent; + + style.setDmnElementRef(org.kie.dmn.backend.marshalling.v1_5.xstream.MarshallingUtils.parseQNameString(reader.getAttribute("dmnElementRef"))); + + String isListedInputData = reader.getAttribute("isListedInputData"); + String isCollapsed = reader.getAttribute("isCollapsed"); + + if (isListedInputData != null) { + style.setIsListedInputData(Boolean.valueOf(isListedInputData)); + } + if (isCollapsed != null) { + style.setIsCollapsed(Boolean.valueOf(isCollapsed)); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNShape style = (DMNShape) parent; + + if (style.getDMNLabel() != null) { + writeChildrenNode(writer, context, style.getDMNLabel(), "DMNLabel"); + } + if (style.getDMNDecisionServiceDividerLine() != null) { + writeChildrenNode(writer, context, style.getDMNDecisionServiceDividerLine(), "DMNDecisionServiceDividerLine"); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DMNShape style = (DMNShape) parent; + + writer.addAttribute("dmnElementRef", MarshallingUtils.formatQName(style.getDmnElementRef(), style)); + + if (style.isIsListedInputData() != null) { + writer.addAttribute("isListedInputData", style.isIsListedInputData().toString()); + } + writer.addAttribute("isCollapsed", Boolean.valueOf(style.isIsCollapsed()).toString()); + } + + public DMNShapeConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new DMNShape(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(DMNShape.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNStyleConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNStyleConverter.java new file mode 100644 index 00000000000..1fb5ce01cab --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DMNStyleConverter.java @@ -0,0 +1,163 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.AlignmentKind; +import org.kie.dmn.model.api.dmndi.Color; +import org.kie.dmn.model.api.dmndi.DMNStyle; + +public class DMNStyleConverter extends StyleConverter { + + private static final String FILL_COLOR = "FillColor"; + private static final String STROKE_COLOR = "StrokeColor"; + private static final String FONT_COLOR = "FontColor"; + + private static final String FONT_FAMILY = "fontFamily"; + private static final String FONT_SIZE = "fontSize"; + private static final String FONT_ITALIC = "fontItalic"; + private static final String FONT_BOLD = "fontBold"; + private static final String FONT_UNDERLINE = "fontUnderline"; + private static final String FONT_STRIKE_THROUGH = "fontStrikeThrough"; + private static final String LABEL_HORIZONTAL_ALIGNMENT = "labelHorizontalAlignement"; + private static final String LABEL_VERTICAL_ALIGNMENT = "labelVerticalAlignment"; + + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DMNStyle style = (DMNStyle) parent; + + if (FILL_COLOR.equals(nodeName)) { + style.setFillColor((Color) child); + } else if (STROKE_COLOR.equals(nodeName)) { + style.setStrokeColor((Color) child); + } else if (FONT_COLOR.equals(nodeName)) { + style.setFontColor((Color) child); + } else { + super.assignChildElement(style, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DMNStyle style = (DMNStyle) parent; + + String fontFamily = reader.getAttribute(FONT_FAMILY ); + String fontSize = reader.getAttribute(FONT_SIZE); + String fontItalic = reader.getAttribute(FONT_ITALIC); + String fontBold = reader.getAttribute(FONT_BOLD); + String fontUnderline = reader.getAttribute(FONT_UNDERLINE); + String fontStrikeThrough = reader.getAttribute(FONT_STRIKE_THROUGH); + String labelHorizontalAlignement = reader.getAttribute(LABEL_HORIZONTAL_ALIGNMENT); + String labelVerticalAlignment = reader.getAttribute(LABEL_VERTICAL_ALIGNMENT); + + if (fontFamily != null) { + style.setFontFamily(fontFamily); + } + if (fontSize != null) { + style.setFontSize(Double.valueOf(fontSize)); + } + if (fontItalic != null) { + style.setFontItalic(Boolean.valueOf(fontItalic)); + } + if (fontBold != null) { + style.setFontBold(Boolean.valueOf(fontBold)); + } + if (fontUnderline != null) { + style.setFontUnderline(Boolean.valueOf(fontUnderline)); + } + if (fontStrikeThrough != null) { + style.setFontStrikeThrough(Boolean.valueOf(fontStrikeThrough)); + } + if (labelHorizontalAlignement != null) { + style.setLabelHorizontalAlignement(AlignmentKind.valueOf(labelHorizontalAlignement)); + } + if (labelVerticalAlignment != null) { + style.setLabelVerticalAlignment(AlignmentKind.valueOf(labelVerticalAlignment)); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DMNStyle style = (DMNStyle) parent; + + if (style.getFillColor() != null) { + writeChildrenNode(writer, context, style.getFillColor(), FILL_COLOR); + } + if (style.getStrokeColor() != null) { + writeChildrenNode(writer, context, style.getStrokeColor(), STROKE_COLOR); + } + if (style.getFontColor() != null) { + writeChildrenNode(writer, context, style.getFontColor(), FONT_COLOR); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DMNStyle style = (DMNStyle) parent; + + if (style.getFontFamily() != null) { + writer.addAttribute(FONT_FAMILY, style.getFontFamily()); + } + if (style.getFontSize() != null) { + writer.addAttribute(FONT_SIZE, FormatUtils.manageDouble(style.getFontSize())); + } + if (style.isFontItalic() != null) { + writer.addAttribute(FONT_ITALIC, style.isFontItalic().toString()); + } + if (style.isFontBold() != null) { + writer.addAttribute(FONT_BOLD, style.isFontBold().toString()); + } + if (style.isFontUnderline() != null) { + writer.addAttribute(FONT_UNDERLINE, style.isFontUnderline().toString()); + } + if (style.isFontStrikeThrough() != null) { + writer.addAttribute(FONT_STRIKE_THROUGH, style.isFontStrikeThrough().toString()); + } + if (style.getLabelHorizontalAlignement() != null) { + writer.addAttribute(LABEL_HORIZONTAL_ALIGNMENT, style.getLabelHorizontalAlignement().toString()); + } + if (style.getLabelVerticalAlignment() != null) { + writer.addAttribute(LABEL_VERTICAL_ALIGNMENT, style.getLabelVerticalAlignment().toString()); + } + } + + public DMNStyleConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.DMNStyle(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(org.kie.dmn.model.v1_5.dmndi.DMNStyle.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DRGElementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DRGElementConverter.java new file mode 100644 index 00000000000..90238ff9fc5 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DRGElementConverter.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; + +public abstract class DRGElementConverter + extends NamedElementConverter { + + public DRGElementConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement( parent, nodeName, child ); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionConverter.java new file mode 100644 index 00000000000..7e1f658999d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionConverter.java @@ -0,0 +1,153 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Decision; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.InformationRequirement; +import org.kie.dmn.model.api.KnowledgeRequirement; +import org.kie.dmn.model.v1_5.TDecision; + +public class DecisionConverter extends DRGElementConverter { + public static final String QUESTION = "question"; + public static final String ALLOWED_ANSWERS = "allowedAnswers"; + public static final String VARIABLE = "variable"; + public static final String INFORMATION_REQUIREMENT = "informationRequirement"; + public static final String KNOWLEDGE_REQUIREMENT = "knowledgeRequirement"; + public static final String AUTHORITY_REQUIREMENT = "authorityRequirement"; + public static final String SUPPORTED_OBJECTIVE = "supportedObjective"; + public static final String IMPACTED_PERFORMANCE_INDICATOR = "impactedPerformanceIndicator"; + public static final String DECISION_MAKER = "decisionMaker"; + public static final String DECISION_OWNER = "decisionOwner"; + public static final String USING_PROCESS = "usingProcess"; + public static final String USING_TASK = "usingTask"; + public static final String EXPRESSION = "expression"; + + public DecisionConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TDecision.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Decision dec = (Decision) parent; + + if (QUESTION.equals(nodeName)) { + dec.setQuestion((String) child); + } else if (ALLOWED_ANSWERS.equals(nodeName)) { + dec.setAllowedAnswers((String) child); + } else if (VARIABLE.equals(nodeName) ) { + dec.setVariable( (InformationItem) child ); + } else if (INFORMATION_REQUIREMENT.equals(nodeName) ) { + dec.getInformationRequirement().add( (InformationRequirement) child ); + } else if (KNOWLEDGE_REQUIREMENT.equals(nodeName) ) { + dec.getKnowledgeRequirement().add((KnowledgeRequirement) child); + } else if (AUTHORITY_REQUIREMENT.equals(nodeName) ) { + dec.getAuthorityRequirement().add((AuthorityRequirement) child); + } else if (SUPPORTED_OBJECTIVE.equals(nodeName) ) { + dec.getSupportedObjective().add((DMNElementReference) child); + } else if (IMPACTED_PERFORMANCE_INDICATOR.equals(nodeName) ) { + dec.getImpactedPerformanceIndicator().add((DMNElementReference) child); + } else if (DECISION_MAKER.equals(nodeName) ) { + dec.getDecisionMaker().add((DMNElementReference) child); + } else if (DECISION_OWNER.equals(nodeName) ) { + dec.getDecisionOwner().add((DMNElementReference) child); + } else if (USING_PROCESS.equals(nodeName) ) { + dec.getUsingProcess().add((DMNElementReference) child); + } else if (USING_TASK.equals(nodeName) ) { + dec.getUsingTask().add((DMNElementReference) child); + } else if ( child instanceof Expression ) { + dec.setExpression( (Expression) child ); + } else { + super.assignChildElement( dec, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + + // no attributes. + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDecision(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Decision dec = (Decision) parent; + + if (dec.getQuestion() != null) writeChildrenNodeAsValue(writer, context, dec.getQuestion(), QUESTION); + if (dec.getAllowedAnswers() != null) writeChildrenNodeAsValue(writer, context, dec.getAllowedAnswers(), ALLOWED_ANSWERS); + if (dec.getVariable() != null) writeChildrenNode(writer, context, dec.getVariable(), VARIABLE); + for ( InformationRequirement ir : dec.getInformationRequirement() ) { + writeChildrenNode(writer, context, ir, INFORMATION_REQUIREMENT); + } + for ( KnowledgeRequirement kr : dec.getKnowledgeRequirement() ) { + writeChildrenNode(writer, context, kr, KNOWLEDGE_REQUIREMENT); + } + for ( AuthorityRequirement ar : dec.getAuthorityRequirement() ) { + writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT); + } + for ( DMNElementReference so : dec.getSupportedObjective() ) { + writeChildrenNode(writer, context, so, SUPPORTED_OBJECTIVE); + } + for ( DMNElementReference ipi : dec.getImpactedPerformanceIndicator() ) { + writeChildrenNode(writer, context, ipi, IMPACTED_PERFORMANCE_INDICATOR); + } + for ( DMNElementReference dm : dec.getDecisionMaker() ) { + writeChildrenNode(writer, context, dm, DECISION_MAKER); + } + for ( DMNElementReference downer : dec.getDecisionOwner() ) { + writeChildrenNode(writer, context, downer, DECISION_OWNER); + } + for ( DMNElementReference up : dec.getUsingProcess() ) { + writeChildrenNode(writer, context, up, USING_PROCESS); + } + for ( DMNElementReference ut : dec.getUsingTask() ) { + writeChildrenNode(writer, context, ut, USING_TASK); + } + if (dec.getExpression() != null) { + Expression e = dec.getExpression(); + String nodeName = MarshallingUtils.defineExpressionNodeName(xstream, e); + writeChildrenNode(writer, context, e, nodeName); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionRuleConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionRuleConverter.java new file mode 100644 index 00000000000..0c65aec1f97 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionRuleConverter.java @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.DecisionRule; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.RuleAnnotation; +import org.kie.dmn.model.api.UnaryTests; +import org.kie.dmn.model.v1_5.TDecisionRule; + +public class DecisionRuleConverter extends DMNElementConverter { + public static final String OUTPUT_ENTRY = "outputEntry"; + public static final String INPUT_ENTRY = "inputEntry"; + public static final String ANNOTATION_ENTRY = "annotationEntry"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DecisionRule dr = (DecisionRule) parent; + + if (INPUT_ENTRY.equals(nodeName)) { + dr.getInputEntry().add((UnaryTests) child); + } else if (OUTPUT_ENTRY.equals(nodeName)) { + dr.getOutputEntry().add((LiteralExpression) child); + } else if (ANNOTATION_ENTRY.equals(nodeName)) { + dr.getAnnotationEntry().add((RuleAnnotation) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DecisionRule dr = (DecisionRule) parent; + + for (UnaryTests ie : dr.getInputEntry()) { + writeChildrenNode(writer, context, ie, INPUT_ENTRY); + } + for (LiteralExpression oe : dr.getOutputEntry()) { + writeChildrenNode(writer, context, oe, OUTPUT_ENTRY); + } + for (RuleAnnotation a : dr.getAnnotationEntry()) { + writeChildrenNode(writer, context, a, ANNOTATION_ENTRY); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public DecisionRuleConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDecisionRule(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TDecisionRule.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionServiceConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionServiceConverter.java new file mode 100644 index 00000000000..cf602339a81 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionServiceConverter.java @@ -0,0 +1,122 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.DecisionService; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TDMNElementReference; +import org.kie.dmn.model.v1_5.TDecisionService; + +public class DecisionServiceConverter extends InvocableConverter { + + public static final String OUTPUT_DECISION = "outputDecision"; + + public static final String ENCAPSULATED_DECISION = "encapsulatedDecision"; + + public static final String INPUT_DECISION = "inputDecision"; + + public static final String INPUT_DATA = "inputData"; + + public DecisionServiceConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDecisionService(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TDecisionService.class); + } + + @Override + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + while (reader.hasMoreChildren()) { + reader.moveDown(); + Object object; + String nodeName = reader.getNodeName(); + if (nodeName.equals(INPUT_DATA)) { + // Patch because the tag name inputData is used in both decision services and as a DRG Element + DMNElementReference ref = new TDMNElementReference(); + ref.setHref(reader.getAttribute("href")); + object = ref; + } else { + // Default behaviour + object = readItem(reader, context, null); + } + if (object instanceof DMNModelInstrumentedBase) { + ((KieDMNModelInstrumentedBase) object).setParent((KieDMNModelInstrumentedBase) parent); + ((KieDMNModelInstrumentedBase) parent).addChildren((KieDMNModelInstrumentedBase) object); + } + reader.moveUp(); + assignChildElement(parent, nodeName, object); + } + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DecisionService decisionService = (DecisionService) parent; + switch (nodeName) { + case OUTPUT_DECISION: + decisionService.getOutputDecision().add((DMNElementReference) child); + break; + case ENCAPSULATED_DECISION: + decisionService.getEncapsulatedDecision().add((DMNElementReference) child); + break; + case INPUT_DECISION: + decisionService.getInputDecision().add((DMNElementReference) child); + break; + case INPUT_DATA: + decisionService.getInputData().add((DMNElementReference) child); + break; + default: + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DecisionService decisionService = (DecisionService) parent; + + for (DMNElementReference ref : decisionService.getOutputDecision()) { + writeChildrenNode(writer, context, ref, OUTPUT_DECISION); + } + for (DMNElementReference ref : decisionService.getEncapsulatedDecision()) { + writeChildrenNode(writer, context, ref, ENCAPSULATED_DECISION); + } + for (DMNElementReference ref : decisionService.getInputDecision()) { + writeChildrenNode(writer, context, ref, INPUT_DECISION); + } + for (DMNElementReference ref : decisionService.getInputData()) { + writeChildrenNode(writer, context, ref, INPUT_DATA); + } + + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionTableConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionTableConverter.java new file mode 100644 index 00000000000..d9494965f30 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DecisionTableConverter.java @@ -0,0 +1,124 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.BuiltinAggregator; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.DecisionRule; +import org.kie.dmn.model.api.DecisionTable; +import org.kie.dmn.model.api.DecisionTableOrientation; +import org.kie.dmn.model.api.HitPolicy; +import org.kie.dmn.model.api.InputClause; +import org.kie.dmn.model.api.OutputClause; +import org.kie.dmn.model.api.RuleAnnotationClause; +import org.kie.dmn.model.v1_5.TDecisionTable; + +public class DecisionTableConverter extends ExpressionConverter { + public static final String RULE = "rule"; + public static final String OUTPUT = "output"; + public static final String INPUT = "input"; + public static final String HIT_POLICY = "hitPolicy"; + public static final String AGGREGATION = "aggregation"; + public static final String PREFERRED_ORIENTATION = "preferredOrientation"; + public static final String OUTPUT_LABEL = "outputLabel"; + + public static final String ANNOTATION = "annotation"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DecisionTable dt = (DecisionTable) parent; + + if (INPUT.equals(nodeName)) { + dt.getInput().add((InputClause) child); + } else if (OUTPUT.equals(nodeName)) { + dt.getOutput().add((OutputClause) child); + } else if (ANNOTATION.equals(nodeName)) { + dt.getAnnotation().add((RuleAnnotationClause) child); + } else if (RULE.equals(nodeName)) { + dt.getRule().add((DecisionRule) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DecisionTable dt = (DecisionTable) parent; + + String hitPolicyValue = reader.getAttribute(HIT_POLICY); + String aggregationValue = reader.getAttribute(AGGREGATION); + String preferredOrientationValue = reader.getAttribute(PREFERRED_ORIENTATION); + String outputLabel = reader.getAttribute(OUTPUT_LABEL); + + if (hitPolicyValue != null) dt.setHitPolicy(HitPolicy.fromValue(hitPolicyValue)); + if (aggregationValue != null) dt.setAggregation(BuiltinAggregator.fromValue(aggregationValue)); + if (preferredOrientationValue != null) dt.setPreferredOrientation(DecisionTableOrientation.fromValue(preferredOrientationValue)); + dt.setOutputLabel(outputLabel); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DecisionTable dt = (DecisionTable) parent; + + for (InputClause i : dt.getInput()) { + writeChildrenNode(writer, context, i, INPUT); + } + for (OutputClause o : dt.getOutput()) { + writeChildrenNode(writer, context, o, OUTPUT); + } + for (RuleAnnotationClause a : dt.getAnnotation()) { + writeChildrenNode(writer, context, a, ANNOTATION); + } + for (DecisionRule r : dt.getRule()) { + writeChildrenNode(writer, context, r, RULE); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DecisionTable dt = (DecisionTable) parent; + + if (dt.getHitPolicy() != null) writer.addAttribute(HIT_POLICY, dt.getHitPolicy().value()); + if (dt.getAggregation()!= null) writer.addAttribute(AGGREGATION, dt.getAggregation().value()); + if (dt.getPreferredOrientation() != null) writer.addAttribute(PREFERRED_ORIENTATION, dt.getPreferredOrientation().value()); + if (dt.getOutputLabel() != null) writer.addAttribute(OUTPUT_LABEL, dt.getOutputLabel()); + } + + public DecisionTableConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDecisionTable(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TDecisionTable.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DefinitionsConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DefinitionsConverter.java new file mode 100644 index 00000000000..1e111a91d9d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DefinitionsConverter.java @@ -0,0 +1,193 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Artifact; +import org.kie.dmn.model.api.Association; +import org.kie.dmn.model.api.BusinessContextElement; +import org.kie.dmn.model.api.BusinessKnowledgeModel; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.DRGElement; +import org.kie.dmn.model.api.Decision; +import org.kie.dmn.model.api.DecisionService; +import org.kie.dmn.model.api.Definitions; +import org.kie.dmn.model.api.ElementCollection; +import org.kie.dmn.model.api.Group; +import org.kie.dmn.model.api.Import; +import org.kie.dmn.model.api.InputData; +import org.kie.dmn.model.api.ItemDefinition; +import org.kie.dmn.model.api.KnowledgeSource; +import org.kie.dmn.model.api.OrganizationUnit; +import org.kie.dmn.model.api.PerformanceIndicator; +import org.kie.dmn.model.api.TextAnnotation; +import org.kie.dmn.model.api.dmndi.DMNDI; +import org.kie.dmn.model.v1_5.TDefinitions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.XMLConstants; + +public class DefinitionsConverter + extends NamedElementConverter { + + private static final Logger LOG = LoggerFactory.getLogger(DefinitionsConverter.class); + + private static final String EXPRESSION_LANGUAGE = "expressionLanguage"; + private static final String TYPE_LANGUAGE = "typeLanguage"; + private static final String NAMESPACE = "namespace"; + private static final String EXPORTER = "exporter"; + private static final String EXPORTER_VERSION = "exporterVersion"; + + public static final String IMPORT = "import"; + public static final String ITEM_DEFINITION = "itemDefinition"; + public static final String DRG_ELEMENT = "drgElement"; + public static final String ARTIFACT = "artifact"; + public static final String ELEMENT_COLLECTION = "elementCollection"; + public static final String BUSINESS_CONTEXT_ELEMENT = "businessContextElement"; + + public DefinitionsConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TDefinitions.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Definitions def = (Definitions) parent; + if ( IMPORT.equals(nodeName) ) { + def.getImport().add((Import) child); + } else if (ITEM_DEFINITION.equals(nodeName)) { + def.getItemDefinition().add((ItemDefinition) child); + } else if (child instanceof DRGElement) { + def.getDrgElement().add( (DRGElement) child ); + } else if (child instanceof Artifact) { + def.getArtifact().add((Artifact) child); + } else if (ELEMENT_COLLECTION.equals(nodeName)) { + def.getElementCollection().add((ElementCollection) child); + } else if (child instanceof BusinessContextElement ) { + def.getBusinessContextElement().add((BusinessContextElement) child); + } else if (child instanceof DMNDI) { + DMNDI dmndi = (DMNDI) child; + dmndi.normalize(); + def.setDMNDI(dmndi); + } else { + super.assignChildElement( def, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + Definitions def = (Definitions) parent; + + String exprLang = reader.getAttribute( EXPRESSION_LANGUAGE ); + String typeLang = reader.getAttribute( TYPE_LANGUAGE ); + String namespace = reader.getAttribute( NAMESPACE ); + String exporter = reader.getAttribute( EXPORTER ); + String exporterVersion = reader.getAttribute( EXPORTER_VERSION ); + + def.setExpressionLanguage( exprLang ); + def.setTypeLanguage( typeLang ); + def.setNamespace( namespace ); + def.setExporter( exporter ); + def.setExporterVersion( exporterVersion ); + + if (!def.getNsContext().containsKey(XMLConstants.DEFAULT_NS_PREFIX)) { + LOG.warn("This DMN file does not define a default namespace"); + } + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDefinitions(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Definitions def = (Definitions) parent; + + for ( Import i : def.getImport() ) { + writeChildrenNode(writer, context, i, IMPORT); + } + for ( ItemDefinition id : def.getItemDefinition() ) { + writeChildrenNode(writer, context, id, ITEM_DEFINITION); + } + for ( DRGElement e : def.getDrgElement() ) { + String nodeName = DRG_ELEMENT; + if (e instanceof BusinessKnowledgeModel) { + nodeName = "businessKnowledgeModel"; + } else if (e instanceof Decision) { + nodeName = "decision"; + } else if (e instanceof InputData) { + nodeName = "inputData"; + } else if (e instanceof KnowledgeSource) { + nodeName = "knowledgeSource"; + } else if (e instanceof DecisionService) { + nodeName = "decisionService"; + } + writeChildrenNode(writer, context, e, nodeName); + } + for ( Artifact a : def.getArtifact() ) { + String nodeName = ARTIFACT; + if (a instanceof Association) { + nodeName = "association"; + } else if (a instanceof TextAnnotation) { + nodeName = "textAnnotation"; + } else if (a instanceof Group) { + nodeName = "group"; + } + writeChildrenNode(writer, context, a, nodeName); + } + for ( ElementCollection ec : def.getElementCollection() ) { + writeChildrenNode(writer, context, ec, ELEMENT_COLLECTION); + } + for ( BusinessContextElement bce : def.getBusinessContextElement() ) { + String nodeName = BUSINESS_CONTEXT_ELEMENT; + if (bce instanceof OrganizationUnit) { + nodeName = "organizationUnit"; + } else if (bce instanceof PerformanceIndicator) { + nodeName = "performanceIndicator"; + } + writeChildrenNode(writer, context, bce, nodeName); + } + + if (def.getDMNDI() != null) { + writeChildrenNode(writer, context, def.getDMNDI(), "DMNDI"); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Definitions def = (Definitions) parent; + + if (def.getExpressionLanguage() != null) writer.addAttribute( EXPRESSION_LANGUAGE , def.getExpressionLanguage() ); + if (def.getTypeLanguage() != null) writer.addAttribute( TYPE_LANGUAGE, def.getTypeLanguage() ); + if (def.getNamespace() != null) writer.addAttribute( NAMESPACE, def.getNamespace()); + if (def.getExporter() != null) writer.addAttribute( EXPORTER, def.getExporter() ); + if (def.getExporterVersion() != null) writer.addAttribute( EXPORTER_VERSION, def.getExporterVersion()); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramConverter.java new file mode 100644 index 00000000000..63bf5c226dc --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramConverter.java @@ -0,0 +1,84 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.dmndi.Diagram; + +public abstract class DiagramConverter extends DiagramElementConverter { + + private static final String RESOLUTION = "resolution"; + private static final String DOCUMENTATION = "documentation"; + private static final String NAME = "name"; + + public DiagramConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Diagram abs = (Diagram) parent; + + String name = reader.getAttribute(NAME); + String documentation = reader.getAttribute(DOCUMENTATION); + String resolution = reader.getAttribute(RESOLUTION); + + if (name != null) { + abs.setName(name); + } + if (documentation != null) { + abs.setDocumentation(documentation); + } + if (resolution != null) { + abs.setResolution(Double.valueOf(resolution)); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Diagram abs = (Diagram) parent; + + if (abs.getName() != null) { + writer.addAttribute(NAME, abs.getName()); + } + if (abs.getDocumentation() != null) { + writer.addAttribute(DOCUMENTATION, abs.getDocumentation()); + } + if (abs.getResolution() != null) { + writer.addAttribute(RESOLUTION, abs.getResolution().toString()); + } + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementConverter.java new file mode 100644 index 00000000000..240b7a2e353 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementConverter.java @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.model.api.dmndi.DiagramElement; +import org.kie.dmn.model.api.dmndi.Style; + +public abstract class DiagramElementConverter extends DMNModelInstrumentedBaseConverter { + + private static final String STYLE = "style"; + private static final String SHARED_STYLE = "sharedStyle"; + private static final String EXTENSION = "extension"; + private static final String ID = "id"; + + public DiagramElementConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + DiagramElement abs = (DiagramElement) parent; + + if (child instanceof DiagramElement.Extension) { + abs.setExtension((DiagramElement.Extension) child); + } else if (child instanceof Style) { + abs.setStyle((Style) child); + } else { + super.assignChildElement(abs, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + DiagramElement abs = (DiagramElement) parent; + String id = reader.getAttribute(ID); + if (id != null) { + abs.setId(id); + } + + String sharedStyleXmlSerialization = reader.getAttribute(SHARED_STYLE); + if (sharedStyleXmlSerialization != null) { + abs.setSharedStyle(new org.kie.dmn.model.v1_5.dmndi.Style.IDREFStubStyle(sharedStyleXmlSerialization)); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + DiagramElement abs = (DiagramElement) parent; + + if (abs.getExtension() != null) { + writeChildrenNode(writer, context, abs.getExtension(), EXTENSION); + } + if (abs.getStyle() != null) { + writeChildrenNode(writer, context, abs.getStyle(), STYLE); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + DiagramElement abs = (DiagramElement) parent; + + if (abs.getId() != null) { + writer.addAttribute(ID, abs.getId()); + } + + if (abs.getSharedStyle() != null) { + writer.addAttribute(SHARED_STYLE, abs.getSharedStyle().getId()); + } + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementExtensionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementExtensionConverter.java new file mode 100644 index 00000000000..34919a59461 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DiagramElementExtensionConverter.java @@ -0,0 +1,132 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.mapper.CannotResolveClassException; +import org.kie.dmn.api.marshalling.DMNExtensionRegister; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.dmndi.DiagramElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +public class DiagramElementExtensionConverter extends DMNModelInstrumentedBaseConverter { + + private static final Logger LOG = LoggerFactory.getLogger(DiagramElementExtensionConverter.class); + + private List extensionRegisters = new ArrayList<>(); + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + // no attributes. + } + + public DiagramElementExtensionConverter(XStream xStream, List extensionRegisters) { + super(xStream); + if (!extensionRegisters.isEmpty()) { + this.extensionRegisters.addAll(extensionRegisters); + } + } + + @Override + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { + DMNModelInstrumentedBase obj = createModelObject(); + assignAttributes(reader, obj); + if (extensionRegisters.size() == 0) { + while (reader.hasMoreChildren()) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + // skipping nodeName + reader.moveUp(); + } + } else { + // do as default behavior, but in case cannot unmarshall an extension element child, just skip it. + while (reader.hasMoreChildren()) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + try { + Object object = readItem(reader, context, null); + if (object instanceof DMNModelInstrumentedBase) { + ((KieDMNModelInstrumentedBase) object).setParent(obj); + obj.addChildren((KieDMNModelInstrumentedBase) object); + } + assignChildElement(obj, nodeName, object); + } catch (CannotResolveClassException e) { + // do nothing; I tried to convert the extension element child with the converters, but no converter is registered for this child. + LOG.debug("Tried to convert the extension element child {}, but no converter is registered for this child.", nodeName); + } + reader.moveUp(); + } + } + return obj; + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + if (extensionRegisters.size() == 0) { + return; + } + + org.kie.dmn.model.api.dmndi.DiagramElement.Extension ee = (org.kie.dmn.model.api.dmndi.DiagramElement.Extension) parent; + if (ee.getAny() != null) { + for (Object a : ee.getAny()) { + writeItem(a, context, writer); + } + } + } + + public DiagramElementExtensionConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new DiagramElement.Extension(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(DiagramElement.Extension.class); + } + + @Override + public void assignChildElement(Object parent, String nodeName, Object child) { + org.kie.dmn.model.api.dmndi.DiagramElement.Extension id = (org.kie.dmn.model.api.dmndi.DiagramElement.Extension) parent; + id.getAny().add(child); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DimensionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DimensionConverter.java new file mode 100644 index 00000000000..b154e0a969f --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/DimensionConverter.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.Dimension; + +public class DimensionConverter extends DMNModelInstrumentedBaseConverter { + + + private static final String HEIGHT = "height"; + private static final String WIDTH = "width"; + + public DimensionConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Dimension abs = (Dimension) parent; + + abs.setWidth(Double.valueOf(reader.getAttribute(WIDTH))); + abs.setHeight(Double.valueOf(reader.getAttribute(HEIGHT))); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Dimension abs = (Dimension) parent; + + writer.addAttribute(WIDTH, org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils.manageDouble(abs.getWidth())); + writer.addAttribute(HEIGHT, FormatUtils.manageDouble(abs.getHeight())); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.Dimension(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.Dimension.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EdgeConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EdgeConverter.java new file mode 100644 index 00000000000..7e8df9bbe6a --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EdgeConverter.java @@ -0,0 +1,72 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.dmndi.Edge; +import org.kie.dmn.model.api.dmndi.Point; + +public abstract class EdgeConverter extends DiagramElementConverter { + + private static final String WAYPOINT = "waypoint"; + + public EdgeConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Edge abs = (Edge) parent; + + if (child instanceof Point) { + abs.getWaypoint().add((Point) child); + } else { + super.assignChildElement(abs, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Edge abs = (Edge) parent; + + for (Point pt : abs.getWaypoint()) { + writeChildrenNode(writer, context, pt, WAYPOINT); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ElementCollectionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ElementCollectionConverter.java new file mode 100644 index 00000000000..cd6d5f4560d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ElementCollectionConverter.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.ElementCollection; +import org.kie.dmn.model.v1_5.TElementCollection; + +public class ElementCollectionConverter extends NamedElementConverter { + + public static final String DRG_ELEMENT = "drgElement"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + ElementCollection ec = (ElementCollection) parent; + + if (DRG_ELEMENT.equals( nodeName )) { + ec.getDrgElement().add((DMNElementReference) child); + } + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + ElementCollection ec = (ElementCollection) parent; + + for (DMNElementReference e : ec.getDrgElement()) { + writeChildrenNode(writer, context, e, DRG_ELEMENT); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public ElementCollectionConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TElementCollection(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TElementCollection.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EveryConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EveryConverter.java new file mode 100644 index 00000000000..78db4cf5d3f --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/EveryConverter.java @@ -0,0 +1,41 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TEvery; + +public class EveryConverter extends QuantifiedConverter { + + public EveryConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TEvery(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TEvery.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExpressionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExpressionConverter.java new file mode 100644 index 00000000000..f7068d00496 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExpressionConverter.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.UnaryTests; + +public abstract class ExpressionConverter + extends DMNElementConverter { + + public static final String TYPE_REF = "typeRef"; + + public ExpressionConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + String typeRef = reader.getAttribute( TYPE_REF ); + + if (typeRef != null) { + ((Expression) parent).setTypeRef(MarshallingUtils.parseQNameString(typeRef)); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Expression e = (Expression) parent; + + if (!(e instanceof UnaryTests) && e.getTypeRef() != null) { + writer.addAttribute(TYPE_REF, MarshallingUtils.formatQName(e.getTypeRef(), e)); + } + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExtensionElementsConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExtensionElementsConverter.java new file mode 100644 index 00000000000..1dce336d38e --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ExtensionElementsConverter.java @@ -0,0 +1,133 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import com.thoughtworks.xstream.mapper.CannotResolveClassException; +import org.kie.dmn.api.marshalling.DMNExtensionRegister; +import org.kie.dmn.model.api.DMNElement.ExtensionElements; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TDMNElement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +public class ExtensionElementsConverter extends DMNModelInstrumentedBaseConverter { + + private static final Logger LOG = LoggerFactory.getLogger(ExtensionElementsConverter.class); + + private List extensionRegisters = new ArrayList<>(); + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + // no attributes. + } + + public ExtensionElementsConverter(XStream xStream, List extensionRegisters) { + super(xStream); + if ( !extensionRegisters.isEmpty() ) { + this.extensionRegisters.addAll(extensionRegisters); + } + } + + + @Override + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { + DMNModelInstrumentedBase obj = createModelObject(); + assignAttributes( reader, obj ); + if(extensionRegisters.size() == 0) { + while (reader.hasMoreChildren()) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + // skipping nodeName + reader.moveUp(); + } + } else { + // do as default behavior, but in case cannot unmarshall an extension element child, just skip it. + while (reader.hasMoreChildren()) { + reader.moveDown(); + String nodeName = reader.getNodeName(); + try { + Object object = readItem(reader, context, null); + if (object instanceof DMNModelInstrumentedBase) { + ((KieDMNModelInstrumentedBase) object).setParent(obj); + obj.addChildren((KieDMNModelInstrumentedBase) object); + } + assignChildElement(obj, nodeName, object); + } catch (CannotResolveClassException e) { + // do nothing; I tried to convert the extension element child with the converters, but no converter is registered for this child. + LOG.debug("Tried to convert the extension element child {}, but no converter is registered for this child.", nodeName); + } + reader.moveUp(); + } + } + return obj; + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + if(extensionRegisters.size() == 0) { + return; + } + + ExtensionElements ee = (ExtensionElements) parent; + if ( ee.getAny() != null ) { + for ( Object a : ee.getAny() ) { + writeItem(a, context, writer); + } + } + } + + public ExtensionElementsConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TDMNElement.TExtensionElements(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TDMNElement.TExtensionElements.class); + } + + @Override + public void assignChildElement(Object parent, String nodeName, Object child) { + ExtensionElements id = (ExtensionElements)parent; + id.getAny().add(child); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FilterConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FilterConverter.java new file mode 100644 index 00000000000..67d9e4768ac --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FilterConverter.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Filter; +import org.kie.dmn.model.v1_5.TChildExpression; +import org.kie.dmn.model.v1_5.TFilter; + +public class FilterConverter extends ExpressionConverter { + + public static final String IN = "in"; + public static final String MATCH = "match"; + + public FilterConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Filter filter = (Filter) parent; + + if (IN.equals(nodeName)) { + filter.setIn((ChildExpression) child); + } else if (MATCH.equals(nodeName)) { + filter.setMatch((ChildExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Filter filter = (Filter) parent; + writeChildrenNode(writer, context, filter.getIn(), IN); + writeChildrenNode(writer, context, filter.getMatch(), MATCH); + + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TFilter(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TFilter.class); + } + + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, IN, TChildExpression.class); + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, MATCH, TChildExpression.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ForConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ForConverter.java new file mode 100644 index 00000000000..a61895120bd --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ForConverter.java @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.For; +import org.kie.dmn.model.v1_5.TChildExpression; +import org.kie.dmn.model.v1_5.TFor; +import org.kie.dmn.model.v1_5.TTypedChildExpression; + +public class ForConverter extends IteratorConverter { + + public static final String RETURN = "return"; + + public ForConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + For i = (For) parent; + + if (RETURN.equals(nodeName) && child instanceof ChildExpression) { + i.setReturn((ChildExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + For i = (For) parent; + + writeChildrenNode(writer, context, i.getReturn(), RETURN); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TFor(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TFor.class); + } + + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, IN, TTypedChildExpression.class); + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, RETURN, TChildExpression.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FormatUtils.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FormatUtils.java new file mode 100644 index 00000000000..9941be9c7ce --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FormatUtils.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import java.util.Objects; + +public class FormatUtils { + + public static String manageDouble(Double d) { + Objects.requireNonNull(d); + long longValue = d.longValue(); + if (d == longValue) { + return String.format("%d", longValue); + } else { + return String.format("%s", d); + } + } + + private FormatUtils() { + // no constructor for utils class. + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionDefinitionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionDefinitionConverter.java new file mode 100644 index 00000000000..03eb811e186 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionDefinitionConverter.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.FunctionDefinition; +import org.kie.dmn.model.api.FunctionKind; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.v1_5.TFunctionDefinition; + +public class FunctionDefinitionConverter extends ExpressionConverter { + + private static final String KIND = "kind"; + public static final String EXPRESSION = "expression"; + public static final String FORMAL_PARAMETER = "formalParameter"; + + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + FunctionDefinition fd = (FunctionDefinition) parent; + + if (FORMAL_PARAMETER.equals(nodeName)) { + fd.getFormalParameter().add((InformationItem) child); + } else if (child instanceof Expression) { + fd.setExpression((Expression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + FunctionDefinition i = (FunctionDefinition) parent; + + String kind = reader.getAttribute(KIND); + if (kind != null) { + i.setKind(FunctionKind.fromValue(kind)); + } + + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + FunctionDefinition fd = (FunctionDefinition) parent; + + for (InformationItem fparam : fd.getFormalParameter()) { + writeChildrenNode(writer, context, fparam, FORMAL_PARAMETER); + } + if (fd.getExpression() != null) writeChildrenNode(writer, context, fd.getExpression(), MarshallingUtils.defineExpressionNodeName(xstream, fd.getExpression())); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + FunctionDefinition fd = (FunctionDefinition) parent; + writer.addAttribute(KIND, fd.getKind().value()); + } + + public FunctionDefinitionConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TFunctionDefinition(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TFunctionDefinition.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionItemConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionItemConverter.java new file mode 100644 index 00000000000..23ba6ee1c71 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/FunctionItemConverter.java @@ -0,0 +1,89 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.FunctionItem; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.v1_5.TFunctionItem; + +public class FunctionItemConverter extends DMNElementConverter { + + private static final String OUTPUT_TYPE_REF = "outputTypeRef"; + private static final String PARAMETERS = "parameters"; + + public FunctionItemConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TFunctionItem.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + FunctionItem ii = (FunctionItem) parent; + + if (PARAMETERS.equals(nodeName)) { + ii.getParameters().add((InformationItem) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + FunctionItem ii = (FunctionItem) parent; + + String typeRef = reader.getAttribute(OUTPUT_TYPE_REF); + ii.setOutputTypeRef(MarshallingUtils.parseQNameString(typeRef)); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TFunctionItem(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + FunctionItem ii = (FunctionItem) parent; + + for (InformationItem ic : ii.getParameters()) { + writeChildrenNode(writer, context, ic, PARAMETERS); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + FunctionItem ii = (FunctionItem) parent; + + if (ii.getOutputTypeRef() != null) { + writer.addAttribute(OUTPUT_TYPE_REF, MarshallingUtils.formatQName(ii.getOutputTypeRef(), ii)); + } + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/GroupConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/GroupConverter.java new file mode 100644 index 00000000000..3b67fb9afa3 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/GroupConverter.java @@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Group; +import org.kie.dmn.model.v1_5.TGroup; + +public class GroupConverter extends ArtifactConverter { + + public static final String NAME = "name"; + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Group grp = (Group) parent; + + String name = reader.getAttribute(NAME); + + grp.setName(name); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Group grp = (Group) parent; + + if (grp.getName() != null) { + writer.addAttribute(NAME, grp.getName()); + } + } + + public GroupConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TGroup(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TGroup.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportConverter.java new file mode 100644 index 00000000000..ce6a37281d6 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportConverter.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Import; +import org.kie.dmn.model.v1_5.TImport; + +public class ImportConverter extends NamedElementConverter { + public static final String NAMESPACE = "namespace"; + public static final String LOCATION_URI = "locationURI"; + public static final String IMPORT_TYPE = "importType"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Import i = (Import) parent; + + String namespace = reader.getAttribute(NAMESPACE); + String locationUri = reader.getAttribute(LOCATION_URI); + String importType = reader.getAttribute(IMPORT_TYPE); + + i.setNamespace(namespace); + i.setLocationURI(locationUri); + i.setImportType(importType); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Import i = (Import) parent; + + if (i.getNamespace() != null) writer.addAttribute(NAMESPACE, i.getNamespace()); + if (i.getLocationURI() != null) writer.addAttribute(LOCATION_URI, i.getLocationURI()); + if (i.getImportType() != null) writer.addAttribute(IMPORT_TYPE, i.getImportType()); + } + + public ImportConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TImport(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TImport.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportedValuesConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportedValuesConverter.java new file mode 100644 index 00000000000..812504d384f --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ImportedValuesConverter.java @@ -0,0 +1,85 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.ImportedValues; +import org.kie.dmn.model.v1_5.TImportedValues; + +public class ImportedValuesConverter extends ImportConverter { + public static final String IMPORTED_ELEMENT = "importedElement"; + public static final String EXPRESSION_LANGUAGE = "expressionLanguage"; + + public ImportedValuesConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + ImportedValues iv = (ImportedValues) parent; + + if (IMPORTED_ELEMENT.equals(nodeName)) { + iv.setImportedElement((String) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + ImportedValues iv = (ImportedValues) parent; + + String expressionLanguage = reader.getAttribute(EXPRESSION_LANGUAGE); + + iv.setExpressionLanguage(expressionLanguage); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + ImportedValues iv = (ImportedValues) parent; + + writeChildrenNode(writer, context, iv.getImportedElement(), IMPORTED_ELEMENT); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + ImportedValues iv = (ImportedValues) parent; + + if (iv.getExpressionLanguage() != null) writer.addAttribute(EXPRESSION_LANGUAGE, iv.getExpressionLanguage()); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TImportedValues(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TImportedValues.class); + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationItemConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationItemConverter.java new file mode 100644 index 00000000000..590825c1b6b --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationItemConverter.java @@ -0,0 +1,75 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.v1_5.TInformationItem; + +public class InformationItemConverter + extends NamedElementConverter { + private static final String TYPE_REF = "typeRef"; + + public InformationItemConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TInformationItem.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement( parent, nodeName, child ); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + InformationItem ii = (InformationItem) parent; + + String typeRef = reader.getAttribute( TYPE_REF ); + ii.setTypeRef( MarshallingUtils.parseQNameString( typeRef ) ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TInformationItem(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + InformationItem ii = (InformationItem) parent; + + if (ii.getTypeRef() != null) { + writer.addAttribute(TYPE_REF, MarshallingUtils.formatQName(ii.getTypeRef(), ii)); + } + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationRequirementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationRequirementConverter.java new file mode 100644 index 00000000000..5c6e008927f --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InformationRequirementConverter.java @@ -0,0 +1,88 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.InformationRequirement; +import org.kie.dmn.model.v1_5.TInformationRequirement; + +public class InformationRequirementConverter extends DMNElementConverter { + + private static final String REQUIRED_INPUT = "requiredInput"; + private static final String REQUIRED_DECISION = "requiredDecision"; + + public InformationRequirementConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TInformationRequirement.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + InformationRequirement ir = (InformationRequirement) parent; + + if ( REQUIRED_INPUT.equals( nodeName ) ) { + ir.setRequiredInput( (DMNElementReference) child ); + } else if ( REQUIRED_DECISION.equals( nodeName ) ) { + ir.setRequiredDecision( (DMNElementReference) child ); + } else { + super.assignChildElement( parent, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TInformationRequirement(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + InformationRequirement ir = (InformationRequirement) parent; + + if ( ir.getRequiredDecision() != null ) { + writeChildrenNode(writer, context, ir.getRequiredDecision(), REQUIRED_DECISION); + } + if ( ir.getRequiredInput() != null ) { + writeChildrenNode(writer, context, ir.getRequiredInput(), REQUIRED_INPUT); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputClauseConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputClauseConverter.java new file mode 100644 index 00000000000..70c7485f24d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputClauseConverter.java @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.InputClause; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.UnaryTests; +import org.kie.dmn.model.v1_5.TInputClause; + +public class InputClauseConverter extends DMNElementConverter { + public static final String INPUT_VALUES = "inputValues"; + public static final String INPUT_EXPRESSION = "inputExpression"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + InputClause ic = (InputClause) parent; + + if (INPUT_EXPRESSION.equals(nodeName)) { + ic.setInputExpression((LiteralExpression) child); + } else if (INPUT_VALUES.equals(nodeName)) { + ic.setInputValues((UnaryTests) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + InputClause ic = (InputClause) parent; + + writeChildrenNode(writer, context, ic.getInputExpression(), INPUT_EXPRESSION); + if (ic.getInputValues() != null) writeChildrenNode(writer, context, ic.getInputValues(), INPUT_VALUES); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + } + + public InputClauseConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TInputClause(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TInputClause.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputDataConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputDataConverter.java new file mode 100644 index 00000000000..62d7da68fc5 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InputDataConverter.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.InputData; +import org.kie.dmn.model.v1_5.TInputData; + +public class InputDataConverter + extends DRGElementConverter { + + private static final String VARIABLE = "variable"; + + public InputDataConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TInputData.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + InputData id = (InputData) parent; + + if ( VARIABLE.equals( nodeName ) ) { + id.setVariable( (InformationItem) child ); + } else { + super.assignChildElement( parent, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TInputData(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + InputData id = (InputData) parent; + + if ( id.getVariable() != null ) { + writeChildrenNode(writer, context, id.getVariable(), VARIABLE); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocableConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocableConverter.java new file mode 100644 index 00000000000..c8926f4c335 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocableConverter.java @@ -0,0 +1,71 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.Invocable; + +public abstract class InvocableConverter extends DRGElementConverter { + + public static final String VARIABLE = "variable"; + + public InvocableConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Invocable bkm = (Invocable) parent; + + if (VARIABLE.equals(nodeName)) { + bkm.setVariable((InformationItem) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + Invocable bkm = (Invocable) parent; + + if (bkm.getVariable() != null) { + writeChildrenNode(writer, context, bkm.getVariable(), VARIABLE); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocationConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocationConverter.java new file mode 100644 index 00000000000..32524a67047 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/InvocationConverter.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Binding; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.Invocation; +import org.kie.dmn.model.v1_5.TInvocation; + +public class InvocationConverter extends ExpressionConverter { + public static final String BINDING = "binding"; + public static final String EXPRESSION = "expression"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Invocation i = (Invocation) parent; + + if (child instanceof Expression) { + i.setExpression((Expression) child); + } else if (BINDING.equals(nodeName)) { + i.getBinding().add((Binding) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Invocation i = (Invocation) parent; + + if (i.getExpression() != null) writeChildrenNode(writer, context, i.getExpression(), MarshallingUtils.defineExpressionNodeName(xstream, i.getExpression())); + for (Binding b : i.getBinding()) { + writeChildrenNode(writer, context, b, BINDING); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + } + + public InvocationConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TInvocation(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TInvocation.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ItemDefinitionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ItemDefinitionConverter.java new file mode 100644 index 00000000000..5be3295fb71 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ItemDefinitionConverter.java @@ -0,0 +1,118 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.FunctionItem; +import org.kie.dmn.model.api.ItemDefinition; +import org.kie.dmn.model.api.UnaryTests; +import org.kie.dmn.model.v1_5.TItemDefinition; + +import javax.xml.namespace.QName; + +public class ItemDefinitionConverter extends NamedElementConverter { + public static final String ITEM_COMPONENT = "itemComponent"; + public static final String ALLOWED_VALUES = "allowedValues"; + public static final String TYPE_CONSTRAINT = "typeConstraint"; + public static final String TYPE_REF = "typeRef"; + public static final String TYPE_LANGUAGE = "typeLanguage"; + public static final String IS_COLLECTION = "isCollection"; + public static final String FUNCTION_ITEM = "functionItem"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + ItemDefinition id = (ItemDefinition) parent; + + if (TYPE_REF.equals(nodeName)) { + id.setTypeRef((QName) child); + } else if (ALLOWED_VALUES.equals(nodeName)) { + id.setAllowedValues((UnaryTests) child); + } else if (TYPE_CONSTRAINT.equals(nodeName)) { + id.setTypeConstraint((UnaryTests) child); + } else if (ITEM_COMPONENT.equals(nodeName)) { + id.getItemComponent().add((ItemDefinition) child); + } else if (FUNCTION_ITEM.equals(nodeName)) { + id.setFunctionItem((FunctionItem) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + ItemDefinition id = (ItemDefinition) parent; + + String typeLanguage = reader.getAttribute(TYPE_LANGUAGE); + String isCollectionValue = reader.getAttribute(IS_COLLECTION); + + id.setTypeLanguage(typeLanguage); + id.setIsCollection(Boolean.valueOf(isCollectionValue)); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + ItemDefinition id = (ItemDefinition) parent; + + if (id.getTypeRef() != null) { + writeChildrenNode(writer, context, id.getTypeRef(), TYPE_REF); + } + if (id.getAllowedValues() != null) { + writeChildrenNode(writer, context, id.getAllowedValues(), ALLOWED_VALUES); + } + if (id.getTypeConstraint() != null) { + writeChildrenNode(writer, context, id.getTypeConstraint(), TYPE_CONSTRAINT); + } + for ( ItemDefinition ic : id.getItemComponent() ) { + writeChildrenNode(writer, context, ic, ITEM_COMPONENT); + } + if (id.getFunctionItem() != null) { + writeChildrenNode(writer, context, id.getFunctionItem(), FUNCTION_ITEM); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + ItemDefinition id = (ItemDefinition) parent; + + if (id.getTypeLanguage() != null) writer.addAttribute(TYPE_LANGUAGE, id.getTypeLanguage()); + writer.addAttribute(IS_COLLECTION, Boolean.valueOf(id.isIsCollection()).toString()); + } + + public ItemDefinitionConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TItemDefinition(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TItemDefinition.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/IteratorConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/IteratorConverter.java new file mode 100644 index 00000000000..1b5cc192a1e --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/IteratorConverter.java @@ -0,0 +1,76 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.Iterator; +import org.kie.dmn.model.api.TypedChildExpression; + +public abstract class IteratorConverter extends ExpressionConverter { + + public static final String IN = "in"; + public static final String ITERATOR_VARIABLE = "iteratorVariable"; + + public IteratorConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Iterator i = (Iterator) parent; + + if (IN.equals(nodeName) && child instanceof TypedChildExpression) { + i.setIn((TypedChildExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + String iteratorVariable = reader.getAttribute( ITERATOR_VARIABLE ); + + if (iteratorVariable != null) { + ((Iterator) parent).setIteratorVariable(iteratorVariable); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Iterator e = (Iterator) parent; + + if (e.getId() != null) { + writer.addAttribute(ITERATOR_VARIABLE, e.getIteratorVariable()); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Iterator i = (Iterator) parent; + + writeChildrenNode(writer, context, i.getIn(), IN); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeRequirementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeRequirementConverter.java new file mode 100644 index 00000000000..443d92b5fae --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeRequirementConverter.java @@ -0,0 +1,80 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.KnowledgeRequirement; +import org.kie.dmn.model.v1_5.TKnowledgeRequirement; + +public class KnowledgeRequirementConverter extends DMNElementConverter { + public static final String REQUIRED_KNOWLEDGE = "requiredKnowledge"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + KnowledgeRequirement kr = (KnowledgeRequirement) parent; + + if (REQUIRED_KNOWLEDGE.equals(nodeName)) { + kr.setRequiredKnowledge((DMNElementReference) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + KnowledgeRequirement kr = (KnowledgeRequirement) parent; + + writeChildrenNode(writer, context, kr.getRequiredKnowledge(), REQUIRED_KNOWLEDGE); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public KnowledgeRequirementConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TKnowledgeRequirement(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TKnowledgeRequirement.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeSourceConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeSourceConverter.java new file mode 100644 index 00000000000..8a3181b89bc --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/KnowledgeSourceConverter.java @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.KnowledgeSource; +import org.kie.dmn.model.v1_5.TKnowledgeSource; + +public class KnowledgeSourceConverter extends DRGElementConverter { + public static final String OWNER = "owner"; + public static final String TYPE = "type"; + public static final String AUTHORITY_REQUIREMENT = "authorityRequirement"; + public static final String LOCATION_URI = "locationURI"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + KnowledgeSource ks = (KnowledgeSource) parent; + + if (AUTHORITY_REQUIREMENT.equals(nodeName)) { + ks.getAuthorityRequirement().add((AuthorityRequirement) child); + } else if (TYPE.equals(nodeName)) { + ks.setType((String) child); + } else if (OWNER.equals(nodeName)) { + ks.setOwner((DMNElementReference) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + KnowledgeSource ks = (KnowledgeSource) parent; + + String locationUri = reader.getAttribute(LOCATION_URI); + + ks.setLocationURI(locationUri); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + KnowledgeSource ks = (KnowledgeSource) parent; + + for ( AuthorityRequirement ar : ks.getAuthorityRequirement() ) { + writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT); + } + if (ks.getType() != null) writeChildrenNode(writer, context, ks.getType(), TYPE); + if (ks.getOwner() != null) writeChildrenNode(writer, context, ks.getOwner(), OWNER); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + KnowledgeSource ks = (KnowledgeSource) parent; + + if (ks.getLocationURI() != null) writer.addAttribute(LOCATION_URI, ks.getLocationURI()); + } + + public KnowledgeSourceConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TKnowledgeSource(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TKnowledgeSource.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/LiteralExpressionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/LiteralExpressionConverter.java new file mode 100644 index 00000000000..27078719af6 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/LiteralExpressionConverter.java @@ -0,0 +1,91 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.ImportedValues; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.v1_5.TLiteralExpression; + +public class LiteralExpressionConverter + extends ExpressionConverter { + + public static final String IMPORTED_VALUES = "importedValues"; + public static final String TEXT = "text"; + public static final String EXPR_LANGUAGE = "expressionLanguage"; + + public LiteralExpressionConverter(XStream xstream) { + super( xstream ); + } + + public boolean canConvert(Class clazz) { + return clazz.equals(TLiteralExpression.class); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + LiteralExpression le = (LiteralExpression)parent; + + if( TEXT.equals( nodeName ) ) { + le.setText( (String) child ); + } else if( IMPORTED_VALUES.equals( nodeName ) ) { + le.setImportedValues( (ImportedValues) child ); + } else { + super.assignChildElement( parent, nodeName, child ); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + LiteralExpression le = (LiteralExpression) parent; + + String exprLanguage = reader.getAttribute( EXPR_LANGUAGE ); + + le.setExpressionLanguage( exprLanguage ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TLiteralExpression(); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + LiteralExpression le = (LiteralExpression) parent; + + if ( le.getText() != null ) writeChildrenNodeAsValue(writer, context, le.getText(), TEXT); + if ( le.getImportedValues() != null ) writeChildrenNode(writer, context, le.getImportedValues(), IMPORTED_VALUES); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + LiteralExpression le = (LiteralExpression) parent; + + if ( le.getExpressionLanguage() != null ) writer.addAttribute(EXPR_LANGUAGE, le.getExpressionLanguage()); + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/MarshallingUtils.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/MarshallingUtils.java new file mode 100644 index 00000000000..47553213fbb --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/MarshallingUtils.java @@ -0,0 +1,125 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.Converter; +import org.kie.dmn.backend.marshalling.v1x.ConverterDefinesExpressionNodeName; +import org.kie.dmn.model.api.Conditional; +import org.kie.dmn.model.api.Context; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.DecisionTable; +import org.kie.dmn.model.api.Every; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.Filter; +import org.kie.dmn.model.api.For; +import org.kie.dmn.model.api.FunctionDefinition; +import org.kie.dmn.model.api.Invocation; +import org.kie.dmn.model.api.List; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.Relation; +import org.kie.dmn.model.api.Some; +import org.kie.dmn.model.api.dmndi.DMNEdge; +import org.kie.dmn.model.api.dmndi.DMNShape; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public final class MarshallingUtils { + + private final static Pattern QNAME_PAT = Pattern.compile("(\\{([^\\}]*)\\})?(([^:]*):)?(.*)"); + + public static QName parseQNameString(String qns) { + if (qns != null) { + Matcher m = QNAME_PAT.matcher(qns); + if (m.matches()) { + if (m.group(4) != null) { + return new QName(m.group(2), m.group(5), m.group(4)); + } else { + return new QName(m.group(2), m.group(5)); + } + } else { + return new QName(qns); + } + } else { + return null; + } + } + + public static String formatQName(QName qname, DMNModelInstrumentedBase parent) { + if (!XMLConstants.DEFAULT_NS_PREFIX.equals(qname.getPrefix())) { + String nsForPrefix = parent.getNamespaceURI(qname.getPrefix()); + if (parent.getURIFEEL().equals(nsForPrefix)) { + return qname.getLocalPart(); // DMN v1.2 feel comes without a prefix. + } else if (parent instanceof DMNShape || parent instanceof DMNEdge) { + return qname.getPrefix() + ":" + qname.getLocalPart(); + } else { + return qname.getPrefix() + "." + qname.getLocalPart(); // DMN v1.2 namespace typeRef lookup is done with dot. + } + } else { + return qname.toString(); + } + } + + public static String defineExpressionNodeName(XStream xstream, Expression e) { + Converter converter = xstream.getConverterLookup().lookupConverterForType(e.getClass()); + if (converter instanceof ConverterDefinesExpressionNodeName) { + ConverterDefinesExpressionNodeName defines = (ConverterDefinesExpressionNodeName) converter; + return defines.defineExpressionNodeName(e); + } else { + return defineExpressionNodeName(e); + } + } + + private static String defineExpressionNodeName(Expression e) { + String nodeName = "expression"; + if (e instanceof Context) { + nodeName = "context"; + } else if (e instanceof DecisionTable) { + nodeName = "decisionTable"; + } else if (e instanceof FunctionDefinition) { + nodeName = "functionDefinition"; + } else if (e instanceof Invocation) { + nodeName = "invocation"; + } else if (e instanceof LiteralExpression) { + nodeName = "literalExpression"; + } else if (e instanceof Relation) { + nodeName = "relation"; + } else if (e instanceof List) { + nodeName = "list"; + } else if (e instanceof For) { + nodeName = "for"; + } else if (e instanceof Every) { + nodeName = "every"; + } else if (e instanceof Some) { + nodeName = "some"; + } else if (e instanceof Conditional) { + nodeName = "conditional"; + } else if (e instanceof Filter) { + nodeName = "filter"; + } + return nodeName; + } + + private MarshallingUtils() { + // Constructing instances is not allowed for this class + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/NamedElementConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/NamedElementConverter.java new file mode 100644 index 00000000000..94618846ff8 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/NamedElementConverter.java @@ -0,0 +1,58 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.NamedElement; + +public abstract class NamedElementConverter + extends DMNElementConverter { + private static final String NAME = "name"; + + public NamedElementConverter(XStream xstream) { + super( xstream ); + } + + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement( parent, nodeName, child ); + } + + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + String name = reader.getAttribute( NAME ); + ((NamedElement) parent).setName( name ); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + + // no children. + } + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + NamedElement ne = (NamedElement) parent; + + writer.addAttribute( NAME , ne.getName() ); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OrganizationUnitConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OrganizationUnitConverter.java new file mode 100644 index 00000000000..98ea22ac4e8 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OrganizationUnitConverter.java @@ -0,0 +1,88 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.OrganizationUnit; +import org.kie.dmn.model.v1_5.TOrganizationUnit; + +public class OrganizationUnitConverter extends BusinessContextElementConverter { + public static final String DECISION_OWNED = "decisionOwned"; + public static final String DECISION_MADE = "decisionMade"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + OrganizationUnit ou = (OrganizationUnit) parent; + + if (DECISION_MADE.equals(nodeName)) { + ou.getDecisionMade().add((DMNElementReference) child); + } else if (DECISION_OWNED.equals(nodeName)) { + ou.getDecisionOwned().add((DMNElementReference) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + OrganizationUnit ou = (OrganizationUnit) parent; + + for (DMNElementReference dm : ou.getDecisionMade()) { + writeChildrenNode(writer, context, dm, DECISION_MADE); + } + for (DMNElementReference downed : ou.getDecisionOwned()) { + writeChildrenNode(writer, context, downed, DECISION_OWNED); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public OrganizationUnitConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TOrganizationUnit(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TOrganizationUnit.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OutputClauseConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OutputClauseConverter.java new file mode 100644 index 00000000000..b7c02538c3d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/OutputClauseConverter.java @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.OutputClause; +import org.kie.dmn.model.api.UnaryTests; +import org.kie.dmn.model.v1_5.TOutputClause; + +public class OutputClauseConverter extends DMNElementConverter { + public static final String DEFAULT_OUTPUT_ENTRY = "defaultOutputEntry"; + public static final String OUTPUT_VALUES = "outputValues"; + public static final String NAME = "name"; + public static final String TYPE_REF ="typeRef"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + OutputClause oc = (OutputClause) parent; + + if (OUTPUT_VALUES.equals(nodeName)) { + oc.setOutputValues((UnaryTests) child); + } else if (DEFAULT_OUTPUT_ENTRY.equals(nodeName)) { + oc.setDefaultOutputEntry((LiteralExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + OutputClause oc = (OutputClause) parent; + + String name = reader.getAttribute(NAME); + String typeRefValue = reader.getAttribute(TYPE_REF); + + oc.setName(name); + if (typeRefValue != null) oc.setTypeRef(MarshallingUtils.parseQNameString(typeRefValue)); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + OutputClause oc = (OutputClause) parent; + + if (oc.getOutputValues() != null) writeChildrenNode(writer, context, oc.getOutputValues(), OUTPUT_VALUES); + if (oc.getDefaultOutputEntry() != null) writeChildrenNode(writer, context, oc.getDefaultOutputEntry(), DEFAULT_OUTPUT_ENTRY); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + OutputClause oc = (OutputClause) parent; + + if (oc.getName() != null) writer.addAttribute(NAME, oc.getName()); + if (oc.getTypeRef() != null) { + writer.addAttribute(TYPE_REF, MarshallingUtils.formatQName(oc.getTypeRef(), oc)); + } + } + + public OutputClauseConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TOutputClause(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TOutputClause.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PerformanceIndicatorConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PerformanceIndicatorConverter.java new file mode 100644 index 00000000000..8bb3a7d6bd5 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PerformanceIndicatorConverter.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.PerformanceIndicator; +import org.kie.dmn.model.v1_5.TPerformanceIndicator; + +public class PerformanceIndicatorConverter extends BusinessContextElementConverter { + public static final String IMPACTING_DECISION = "impactingDecision"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + PerformanceIndicator pi = (PerformanceIndicator) parent; + + if (IMPACTING_DECISION.equals(nodeName)) { + pi.getImpactingDecision().add((DMNElementReference) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + PerformanceIndicator pi = (PerformanceIndicator) parent; + + for ( DMNElementReference id : pi.getImpactingDecision() ) { + writeChildrenNode(writer, context, id, IMPACTING_DECISION); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public PerformanceIndicatorConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TPerformanceIndicator(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TPerformanceIndicator.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PointConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PointConverter.java new file mode 100644 index 00000000000..fc63d0f99e2 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/PointConverter.java @@ -0,0 +1,79 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.dmndi.Point; + +public class PointConverter extends DMNModelInstrumentedBaseConverter { + + + private static final String Y = "y"; + private static final String X = "x"; + + public PointConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Point abs = (Point) parent; + + abs.setX(Double.valueOf(reader.getAttribute(X))); + abs.setY(Double.valueOf(reader.getAttribute(Y))); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + Point abs = (Point) parent; + + writer.addAttribute(X, org.kie.dmn.backend.marshalling.v1_5.xstream.FormatUtils.manageDouble(abs.getX())); + writer.addAttribute(Y, FormatUtils.manageDouble(abs.getY())); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new org.kie.dmn.model.v1_5.dmndi.Point(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(org.kie.dmn.model.v1_5.dmndi.Point.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QNameConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QNameConverter.java new file mode 100644 index 00000000000..b3ee81f480d --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QNameConverter.java @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.converters.Converter; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; + +import javax.xml.namespace.QName; + +/** + * Please note this does not extend the DMNBaseConverter as it just need access to the node value itself. + */ +public class QNameConverter implements Converter { + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals( QName.class ); + } + + @Override + public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext context) { + // DMN v1.2 semantic always local part. + QName qname = (QName) object; + writer.setValue(qname.getLocalPart()); + } + + @Override + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { + // DMN v1.2 semantic always local part. + QName qname = new QName(reader.getValue()); + return qname; + } + +} \ No newline at end of file diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QuantifiedConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QuantifiedConverter.java new file mode 100644 index 00000000000..72add840996 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/QuantifiedConverter.java @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Quantified; +import org.kie.dmn.model.v1_5.TChildExpression; +import org.kie.dmn.model.v1_5.TTypedChildExpression; + +public abstract class QuantifiedConverter extends IteratorConverter { + + public static final String SATISFIES = "satisfies"; + + public QuantifiedConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Quantified i = (Quantified) parent; + + if (SATISFIES.equals(nodeName) && child instanceof ChildExpression) { + i.setSatisfies((ChildExpression) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Quantified i = (Quantified) parent; + + writeChildrenNode(writer, context, i.getSatisfies(), SATISFIES); + } + + protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) { + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, IN, TTypedChildExpression.class); + mvDownConvertAnotherMvUpAssignChildElement(reader, context, parent, SATISFIES, TChildExpression.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RelationConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RelationConverter.java new file mode 100644 index 00000000000..fb70dd07aab --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RelationConverter.java @@ -0,0 +1,89 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.Relation; +import org.kie.dmn.model.v1_5.TRelation; + +public class RelationConverter extends ExpressionConverter { + public static final String EXPRESSION = "expression"; + public static final String ROW = "row"; + public static final String COLUMN = "column"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Relation r = (Relation) parent; + + if (COLUMN.equals(nodeName)) { + r.getColumn().add((InformationItem) child); + } else if (ROW.equals(nodeName)) { + r.getRow().add((org.kie.dmn.model.api.List) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Relation r = (Relation) parent; + + for (InformationItem c : r.getColumn()) { + writeChildrenNode(writer, context, c, COLUMN); + } + for (org.kie.dmn.model.api.List row : r.getRow()) { + writeChildrenNode(writer, context, row, ROW); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + public RelationConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TRelation(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TRelation.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationClauseConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationClauseConverter.java new file mode 100644 index 00000000000..5be1dcf9676 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationClauseConverter.java @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.RuleAnnotationClause; +import org.kie.dmn.model.v1_5.TRuleAnnotationClause; + +public class RuleAnnotationClauseConverter extends DMNModelInstrumentedBaseConverter { + + public static final String NAME = "name"; + + public RuleAnnotationClauseConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + + ((RuleAnnotationClause) parent).setName(reader.getAttribute(NAME)); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + RuleAnnotationClause e = (RuleAnnotationClause) parent; + + if (e.getName() != null) { + writer.addAttribute(NAME, e.getName()); + } + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TRuleAnnotationClause(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TRuleAnnotationClause.class); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationConverter.java new file mode 100644 index 00000000000..c5574a8896a --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/RuleAnnotationConverter.java @@ -0,0 +1,80 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.RuleAnnotation; +import org.kie.dmn.model.v1_5.TRuleAnnotation; + +public class RuleAnnotationConverter extends DMNModelInstrumentedBaseConverter { + + public static final String TEXT = "text"; + + public RuleAnnotationConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + super.assignChildElement(parent, nodeName, child); + RuleAnnotation e = (RuleAnnotation) parent; + + if (TEXT.equals(nodeName)) { + e.setText((String) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + RuleAnnotation r = (RuleAnnotation) parent; + + writeChildrenNode(writer, context, r.getText(), TEXT); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TRuleAnnotation(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TRuleAnnotation.class); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ShapeConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ShapeConverter.java new file mode 100644 index 00000000000..141e8faf404 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/ShapeConverter.java @@ -0,0 +1,72 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.dmndi.Bounds; +import org.kie.dmn.model.api.dmndi.Shape; + +public abstract class ShapeConverter extends DiagramElementConverter { + + private static final String BOUNDS = "Bounds"; + + public ShapeConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Shape abs = (Shape) parent; + + if (child instanceof Bounds) { + abs.setBounds((Bounds) child); + } else { + super.assignChildElement(abs, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + + // no attributes. + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Shape abs = (Shape) parent; + + if (abs.getBounds() != null) { + writeChildrenNode(writer, context, abs.getBounds(), BOUNDS); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + + // no attributes. + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/SomeConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/SomeConverter.java new file mode 100644 index 00000000000..22d5ebffc6a --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/SomeConverter.java @@ -0,0 +1,41 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TSome; + +public class SomeConverter extends QuantifiedConverter { + + public SomeConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TSome(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TSome.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/StyleConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/StyleConverter.java new file mode 100644 index 00000000000..df995a9f255 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/StyleConverter.java @@ -0,0 +1,82 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.backend.marshalling.v1_5.xstream.DMNModelInstrumentedBaseConverter; +import org.kie.dmn.model.api.dmndi.Style; +import org.kie.dmn.model.api.dmndi.Style.Extension; + +public abstract class StyleConverter extends DMNModelInstrumentedBaseConverter { + + private static final String EXTENSION = "extension"; + private static final String ID = "id"; + + public StyleConverter(XStream xstream) { + super(xstream); + } + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + Style style = (Style) parent; + + if (child instanceof Extension) { + style.setExtension((Extension) child); + } else { + super.assignChildElement(style, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + Style style = (Style) parent; + String id = reader.getAttribute(ID); + if (id != null) { + style.setId(id); + } + + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + Style style = (Style) parent; + + if (style.getExtension() != null) { + writeChildrenNode(writer, context, style.getExtension(), EXTENSION); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + Style style = (Style) parent; + + if (style.getId() != null) { + writer.addAttribute(ID, style.getId()); + } + + } + + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TextAnnotationConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TextAnnotationConverter.java new file mode 100644 index 00000000000..2002a5de890 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TextAnnotationConverter.java @@ -0,0 +1,84 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.TextAnnotation; +import org.kie.dmn.model.v1_5.TTextAnnotation; + +public class TextAnnotationConverter extends ArtifactConverter { + public static final String TEXT = "text"; + public static final String TEXT_FORMAT = "textFormat"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + TextAnnotation ta = (TextAnnotation) parent; + + if (TEXT.equals(nodeName)) { + ta.setText((String) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + TextAnnotation ta = (TextAnnotation) parent; + + String textFormat = reader.getAttribute(TEXT_FORMAT); + + ta.setTextFormat(textFormat); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + TextAnnotation ta = (TextAnnotation) parent; + + if (ta.getText() != null) writeChildrenNode(writer, context, ta.getText(), TEXT); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + TextAnnotation ta = (TextAnnotation) parent; + + if (ta.getTextFormat() != null) writer.addAttribute(TEXT_FORMAT, ta.getTextFormat()); + } + + public TextAnnotationConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TTextAnnotation(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TTextAnnotation.class); + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TypedChildExpressionConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TypedChildExpressionConverter.java new file mode 100644 index 00000000000..590fefee26f --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/TypedChildExpressionConverter.java @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.TypedChildExpression; +import org.kie.dmn.model.v1_5.TTypedChildExpression; + +public class TypedChildExpressionConverter extends ChildExpressionConverter { + + public static final String TYPE_REF = "typeRef"; + + public TypedChildExpressionConverter(XStream xstream) { + super( xstream ); + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes( reader, parent ); + String typeRef = reader.getAttribute( TYPE_REF ); + + if (typeRef != null) { + ((TypedChildExpression) parent).setTypeRef(typeRef); + } + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + TypedChildExpression e = (TypedChildExpression) parent; + + if (e.getTypeRef() != null) { + writer.addAttribute(TYPE_REF, e.getTypeRef()); + } + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TTypedChildExpression(); + } + + @Override + public boolean canConvert(Class type) { + return type.equals(TTypedChildExpression.class); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/UnaryTestsConverter.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/UnaryTestsConverter.java new file mode 100644 index 00000000000..ea826d1ce75 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/UnaryTestsConverter.java @@ -0,0 +1,83 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.converters.MarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; +import com.thoughtworks.xstream.io.HierarchicalStreamWriter; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.UnaryTests; +import org.kie.dmn.model.v1_5.TUnaryTests; + +public class UnaryTestsConverter extends ExpressionConverter { + public static final String TEXT = "text"; + public static final String EXPRESSION_LANGUAGE = "expressionLanguage"; + + @Override + protected void assignChildElement(Object parent, String nodeName, Object child) { + UnaryTests ut = (UnaryTests) parent; + + if (TEXT.equals(nodeName)) { + ut.setText((String) child); + } else { + super.assignChildElement(parent, nodeName, child); + } + } + + @Override + protected void assignAttributes(HierarchicalStreamReader reader, Object parent) { + super.assignAttributes(reader, parent); + UnaryTests ut = (UnaryTests) parent; + + String expressionLanguage = reader.getAttribute(EXPRESSION_LANGUAGE); + + ut.setExpressionLanguage(expressionLanguage); + } + + @Override + protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) { + super.writeChildren(writer, context, parent); + UnaryTests ut = (UnaryTests) parent; + + writeChildrenNode(writer, context, ut.getText(), TEXT); + } + + @Override + protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) { + super.writeAttributes(writer, parent); + UnaryTests ut = (UnaryTests) parent; + + if (ut.getExpressionLanguage() != null) writer.addAttribute(EXPRESSION_LANGUAGE, ut.getExpressionLanguage()); + } + + public UnaryTestsConverter(XStream xstream) { + super(xstream); + } + + @Override + protected DMNModelInstrumentedBase createModelObject() { + return new TUnaryTests(); + } + + @Override + public boolean canConvert(Class clazz) { + return clazz.equals(TUnaryTests.class); + } +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/XStreamMarshaller.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/XStreamMarshaller.java new file mode 100644 index 00000000000..4f8905b99b2 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_5/xstream/XStreamMarshaller.java @@ -0,0 +1,403 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5.xstream; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.AbstractPullReader; +import com.thoughtworks.xstream.io.xml.QNameMap; +import com.thoughtworks.xstream.io.xml.StaxDriver; +import com.thoughtworks.xstream.io.xml.StaxWriter; +import com.thoughtworks.xstream.security.TypeHierarchyPermission; +import org.kie.dmn.api.marshalling.DMNExtensionRegister; +import org.kie.dmn.api.marshalling.DMNMarshaller; +import org.kie.dmn.backend.marshalling.CustomStaxReader; +import org.kie.dmn.backend.marshalling.CustomStaxWriter; +import org.kie.dmn.backend.marshalling.v1x.DMNXStream; +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.Definitions; +import org.kie.dmn.model.v1_5.dmndi.Bounds; +import org.kie.dmn.model.v1_5.dmndi.Color; +import org.kie.dmn.model.v1_5.dmndi.DMNDI; +import org.kie.dmn.model.v1_5.dmndi.DMNDecisionServiceDividerLine; +import org.kie.dmn.model.v1_5.dmndi.DMNDiagram; +import org.kie.dmn.model.v1_5.dmndi.DMNEdge; +import org.kie.dmn.model.v1_5.dmndi.DMNLabel; +import org.kie.dmn.model.v1_5.dmndi.DMNShape; +import org.kie.dmn.model.v1_5.dmndi.DMNStyle; +import org.kie.dmn.model.v1_5.dmndi.DiagramElement; +import org.kie.dmn.model.v1_5.dmndi.Dimension; +import org.kie.dmn.model.v1_5.dmndi.Point; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.TArtifact; +import org.kie.dmn.model.v1_5.TAssociation; +import org.kie.dmn.model.v1_5.TAuthorityRequirement; +import org.kie.dmn.model.v1_5.TBinding; +import org.kie.dmn.model.v1_5.TBusinessContextElement; +import org.kie.dmn.model.v1_5.TBusinessKnowledgeModel; +import org.kie.dmn.model.v1_5.TConditional; +import org.kie.dmn.model.v1_5.TContext; +import org.kie.dmn.model.v1_5.TContextEntry; +import org.kie.dmn.model.v1_5.TDMNElement; +import org.kie.dmn.model.v1_5.TDMNElementReference; +import org.kie.dmn.model.v1_5.TDecision; +import org.kie.dmn.model.v1_5.TDecisionRule; +import org.kie.dmn.model.v1_5.TDecisionService; +import org.kie.dmn.model.v1_5.TDecisionTable; +import org.kie.dmn.model.v1_5.TDefinitions; +import org.kie.dmn.model.v1_5.TElementCollection; +import org.kie.dmn.model.v1_5.TEvery; +import org.kie.dmn.model.v1_5.TExpression; +import org.kie.dmn.model.v1_5.TFilter; +import org.kie.dmn.model.v1_5.TFor; +import org.kie.dmn.model.v1_5.TFunctionDefinition; +import org.kie.dmn.model.v1_5.TFunctionItem; +import org.kie.dmn.model.v1_5.TGroup; +import org.kie.dmn.model.v1_5.TImport; +import org.kie.dmn.model.v1_5.TImportedValues; +import org.kie.dmn.model.v1_5.TInformationItem; +import org.kie.dmn.model.v1_5.TInformationRequirement; +import org.kie.dmn.model.v1_5.TInputClause; +import org.kie.dmn.model.v1_5.TInputData; +import org.kie.dmn.model.v1_5.TInvocation; +import org.kie.dmn.model.v1_5.TItemDefinition; +import org.kie.dmn.model.v1_5.TKnowledgeRequirement; +import org.kie.dmn.model.v1_5.TKnowledgeSource; +import org.kie.dmn.model.v1_5.TLiteralExpression; +import org.kie.dmn.model.v1_5.TNamedElement; +import org.kie.dmn.model.v1_5.TOrganizationUnit; +import org.kie.dmn.model.v1_5.TOutputClause; +import org.kie.dmn.model.v1_5.TPerformanceIndicator; +import org.kie.dmn.model.v1_5.TRelation; +import org.kie.dmn.model.v1_5.TRuleAnnotation; +import org.kie.dmn.model.v1_5.TRuleAnnotationClause; +import org.kie.dmn.model.v1_5.TSome; +import org.kie.dmn.model.v1_5.TTextAnnotation; +import org.kie.dmn.model.v1_5.TUnaryTests; +import org.kie.utll.xml.XStreamUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class XStreamMarshaller + implements DMNMarshaller { + + private static Logger logger = LoggerFactory.getLogger( XStreamMarshaller.class ); + private List extensionRegisters = new ArrayList<>(); + + + private static StaxDriver staxDriver; + static { + staxDriver = new StaxDriver() { + public AbstractPullReader createStaxReader(XMLStreamReader in) { + return new CustomStaxReader(getQnameMap(), in); + } + + public StaxWriter createStaxWriter(XMLStreamWriter out, boolean writeStartEndDocument) throws XMLStreamException { + return new CustomStaxWriter(newQNameMap(), out, writeStartEndDocument, isRepairingNamespace(), getNameCoder()); + } + + public QNameMap newQNameMap() { + QNameMap qmap = new QNameMap(); + configureQNameMap( qmap ); + return qmap; + } + }; + QNameMap qmap = new QNameMap(); + configureQNameMap( qmap ); + staxDriver.setQnameMap(qmap); + staxDriver.setRepairingNamespace(false); + } + + public static void configureQNameMap( QNameMap qmap ) { + qmap.setDefaultNamespace(KieDMNModelInstrumentedBase.URI_DMN); + } + + public XStreamMarshaller() { + + } + + public XStreamMarshaller (List extensionRegisters) { + this.extensionRegisters.addAll(extensionRegisters); + } + + + @Override + public Definitions unmarshal(String xml) { + return unmarshal( new StringReader( xml ) ); + } + + @Override + public Definitions unmarshal(Reader isr) { + try { + XStream xStream = newXStream(); + + Definitions def = (Definitions) xStream.fromXML( isr ); + + return def; + } catch ( Exception e ) { + logger.error( "Error unmarshalling DMN model from reader.", e ); + } + return null; + } + + @Override + public String marshal(Object o) { + try ( Writer writer = new StringWriter(); + CustomStaxWriter hsWriter = (CustomStaxWriter) staxDriver.createWriter(writer); ) { + XStream xStream = newXStream(); + if ( o instanceof DMNModelInstrumentedBase ) { + KieDMNModelInstrumentedBase base = (KieDMNModelInstrumentedBase) o; + String dmnPrefix = base.getNsContext().entrySet().stream().filter(kv -> KieDMNModelInstrumentedBase.URI_DMN.equals(kv.getValue())).findFirst().map(Map.Entry::getKey).orElse(""); + hsWriter.getQNameMap().setDefaultPrefix( dmnPrefix ); + } + extensionRegisters.forEach( r -> r.beforeMarshal(o, hsWriter.getQNameMap()) ); + xStream.marshal(o, hsWriter); + hsWriter.flush(); + return writer.toString(); + } catch ( Exception e ) { + logger.error( "Error marshalling DMN model to XML.", e ); + } + return null; + } + + @Override + public void marshal(Object o, Writer out) { + try { + out.write( marshal( o ) ); + } catch ( Exception e ) { + logger.error( "Error marshalling DMN model to XML.", e ); + } + } + + private XStream newXStream() { + XStream xStream = XStreamUtils.createNonTrustingXStream(staxDriver, Definitions.class.getClassLoader(), DMNXStream::from); + xStream.addPermission(new TypeHierarchyPermission(QName.class)); + xStream.addPermission(new TypeHierarchyPermission(KieDMNModelInstrumentedBase.class)); + xStream.addPermission(new TypeHierarchyPermission(org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.class)); + + xStream.alias("artifact", TArtifact.class); + xStream.alias("definitions", TDefinitions.class); + xStream.alias("inputData", TInputData.class); + xStream.alias("decision", TDecision.class); + xStream.alias("variable", TInformationItem.class); + xStream.alias("informationRequirement", TInformationRequirement.class); + xStream.alias("requiredInput", TDMNElementReference.class); + xStream.alias("literalExpression", TLiteralExpression.class); + + xStream.alias("DMNElement", TDMNElement.class); + xStream.alias("allowedValues", TUnaryTests.class); + xStream.alias("artifact", TArtifact.class); + xStream.alias("association", TAssociation.class); + xStream.alias("authorityRequirement", TAuthorityRequirement.class); + xStream.alias("binding", TBinding.class); + xStream.alias("businessContextElement", TBusinessContextElement.class); + xStream.alias("businessKnowledgeModel", TBusinessKnowledgeModel.class); + xStream.alias("column", TInformationItem.class); + xStream.alias("context", TContext.class); + xStream.alias("contextEntry", TContextEntry.class); + xStream.alias("decision", TDecision.class); + xStream.alias("decisionMade", TDMNElementReference.class); + xStream.alias("decisionMaker", TDMNElementReference.class); + xStream.alias("decisionOwned", TDMNElementReference.class); + xStream.alias("decisionOwner", TDMNElementReference.class); + xStream.alias("decisionService", TDecisionService.class); + xStream.alias("decisionTable", TDecisionTable.class); + xStream.alias("defaultOutputEntry", TLiteralExpression.class); + xStream.alias("definitions", TDefinitions.class); + xStream.alias("drgElement", TDMNElementReference.class); + xStream.alias("elementCollection", TElementCollection.class); + xStream.alias("encapsulatedDecision", TDMNElementReference.class); + xStream.alias("encapsulatedLogic", TFunctionDefinition.class); + xStream.alias("expression", TExpression.class); + xStream.alias("formalParameter", TInformationItem.class); + xStream.alias("functionItem", TFunctionItem.class); + xStream.alias("functionDefinition", TFunctionDefinition.class); + xStream.alias("group", TGroup.class); + xStream.alias("impactedPerformanceIndicator", TDMNElementReference.class); + xStream.alias("impactingDecision", TDMNElementReference.class); + xStream.alias("import", TImport.class); + xStream.alias("import", TImport.class); + xStream.alias("importedElement", String.class ); // TODO where? + xStream.alias("importedValues", TImportedValues.class); + xStream.alias("informationItem", TInformationItem.class); + xStream.alias("informationRequirement", TInformationRequirement.class); + xStream.alias("input", TInputClause.class); + xStream.alias("inputData", TInputData.class); + xStream.alias("inputDecision", TDMNElementReference.class); + xStream.alias("inputEntry", TUnaryTests.class); + xStream.alias("inputExpression", TLiteralExpression.class); + xStream.alias("inputValues", TUnaryTests.class); + xStream.alias("invocation", TInvocation.class); + xStream.alias("itemComponent", TItemDefinition.class); + xStream.alias("itemDefinition", TItemDefinition.class); + xStream.alias("knowledgeRequirement", TKnowledgeRequirement.class); + xStream.alias("knowledgeSource", TKnowledgeSource.class); + xStream.alias("literalExpression", TLiteralExpression.class); + xStream.alias("namedElement", TNamedElement.class); + xStream.alias("organizationUnit", TOrganizationUnit.class); + xStream.alias("output", TOutputClause.class); + xStream.alias("outputDecision", TDMNElementReference.class); + xStream.alias("outputEntry", TLiteralExpression.class); + xStream.alias("outputValues", TUnaryTests.class); + xStream.alias("owner", TDMNElementReference.class); + xStream.alias("parameter", TInformationItem.class); + xStream.alias("parameters", TInformationItem.class); + xStream.alias("performanceIndicator", TPerformanceIndicator.class); + xStream.alias("relation", TRelation.class); + xStream.alias("requiredAuthority", TDMNElementReference.class); + xStream.alias("requiredDecision", TDMNElementReference.class); + xStream.alias("requiredInput", TDMNElementReference.class); + xStream.alias("requiredKnowledge", TDMNElementReference.class); + xStream.alias("rule", TDecisionRule.class); + xStream.alias("sourceRef", TDMNElementReference.class); + xStream.alias("supportedObjective", TDMNElementReference.class); + xStream.alias("targetRef", TDMNElementReference.class); + xStream.alias("textAnnotation", TTextAnnotation.class); + xStream.alias("type", String.class ); + xStream.alias("typeConstraint", TUnaryTests.class); + xStream.alias("typeRef", QName.class ); + xStream.alias("usingProcess", TDMNElementReference.class); + xStream.alias("usingTask", TDMNElementReference.class); + xStream.alias("useAlternativeInputDataShape", Boolean.class); + xStream.alias("variable", TInformationItem.class); + xStream.alias("row", org.kie.dmn.model.v1_5.TList.class); + xStream.alias("list", org.kie.dmn.model.v1_5.TList.class); + xStream.alias("extensionElements", TDMNElement.TExtensionElements.class); + + // Manually imported TEXT = String + xStream.alias( LiteralExpressionConverter.TEXT, String.class ); + // unnecessary 'text' key repetition: xStream.alias( TextAnnotationConverter.TEXT, String.class ); + // unnecessary 'text' key repetition: xStream.alias( UnaryTestsConverter.TEXT, String.class ); + xStream.alias( DecisionConverter.QUESTION, String.class ); + xStream.alias( DecisionConverter.ALLOWED_ANSWERS, String.class ); + xStream.alias( DMNElementConverter.DESCRIPTION, String.class ); + // unnecessary 'text' key repetition: xStream.alias("text", xsd:string.class ); + // unnecessary 'text' key repetition: xStream.alias("text", xsd:string.class ); + // unnecessary 'text' key repetition: xStream.alias("text", xsd:string.class ); + // xStream.alias("question", xsd:string.class ); + // xStream.alias("allowedAnswers", xsd:string.class ); + // xStream.alias("description", xsd:string.class ); + + // DMN v1.2: + // Note, to comply with NS for XStream need also to adjust entries inside DMNModelInstrumentedBaseConverter + xStream.alias("annotation", TRuleAnnotationClause.class); + xStream.alias("annotationEntry", TRuleAnnotation.class); + xStream.registerConverter(new RuleAnnotationClauseConverter(xStream)); + xStream.registerConverter(new RuleAnnotationConverter(xStream)); + xStream.alias("DMNDI", DMNDI.class); + xStream.registerConverter(new DMNDIConverter(xStream)); + xStream.alias("DMNDiagram", DMNDiagram.class); + xStream.registerConverter(new DMNDiagramConverter(xStream)); + xStream.alias("DMNStyle", DMNStyle.class); + xStream.registerConverter(new DMNStyleConverter(xStream)); + xStream.alias("Size", Dimension.class); + xStream.registerConverter(new DimensionConverter(xStream)); + xStream.alias("DMNShape", DMNShape.class); + xStream.registerConverter(new DMNShapeConverter(xStream)); + xStream.alias("FillColor", Color.class); + xStream.alias("StrokeColor", Color.class); + xStream.alias("FontColor", Color.class); + xStream.registerConverter(new ColorConverter(xStream)); + xStream.alias("Bounds", Bounds.class); + xStream.registerConverter(new BoundsConverter(xStream)); + xStream.alias("DMNLabel", DMNLabel.class); + xStream.registerConverter(new DMNLabelConverter(xStream)); + xStream.alias("DMNEdge", DMNEdge.class); + xStream.registerConverter(new DMNEdgeConverter(xStream)); + xStream.alias("DMNDecisionServiceDividerLine", DMNDecisionServiceDividerLine.class); + xStream.registerConverter(new DMNDecisionServiceDividerLineConverter(xStream)); + xStream.alias("waypoint", Point.class); + xStream.registerConverter(new PointConverter(xStream)); + xStream.alias("extension", DiagramElement.Extension.class); + xStream.alias(DMNLabelConverter.TEXT, String.class); + + xStream.alias("for", TFor.class); + xStream.alias("every", TEvery.class); + xStream.alias("some", TSome.class); + xStream.alias("conditional", TConditional.class); + xStream.alias("filter", TFilter.class); + + xStream.registerConverter(new AssociationConverter( xStream ) ); + xStream.registerConverter(new AuthorityRequirementConverter( xStream ) ); + xStream.registerConverter(new BindingConverter( xStream ) ); + xStream.registerConverter(new BusinessKnowledgeModelConverter( xStream ) ); + xStream.registerConverter(new ContextConverter( xStream ) ); + xStream.registerConverter(new ContextEntryConverter( xStream ) ); + xStream.registerConverter(new DecisionConverter( xStream ) ); + xStream.registerConverter(new DecisionRuleConverter( xStream ) ); + xStream.registerConverter(new DecisionServiceConverter(xStream)); + xStream.registerConverter(new DecisionTableConverter( xStream ) ); + xStream.registerConverter(new DefinitionsConverter( xStream ) ); + xStream.registerConverter(new DMNElementReferenceConverter( xStream ) ); + xStream.registerConverter(new GroupConverter( xStream ) ); + xStream.registerConverter(new FunctionDefinitionConverter( xStream ) ); + xStream.registerConverter(new ImportConverter( xStream ) ); + xStream.registerConverter(new ImportedValuesConverter( xStream ) ); + xStream.registerConverter(new InformationItemConverter( xStream ) ); + xStream.registerConverter(new InformationRequirementConverter( xStream ) ); + xStream.registerConverter(new InputClauseConverter( xStream ) ); + xStream.registerConverter(new InputDataConverter( xStream ) ); + xStream.registerConverter(new InvocationConverter( xStream ) ); + xStream.registerConverter(new ItemDefinitionConverter( xStream ) ); + xStream.registerConverter(new KnowledgeRequirementConverter( xStream ) ); + xStream.registerConverter(new KnowledgeSourceConverter( xStream ) ); + xStream.registerConverter(new LiteralExpressionConverter( xStream ) ); + xStream.registerConverter(new OrganizationUnitConverter( xStream ) ); + xStream.registerConverter(new OutputClauseConverter( xStream ) ); + xStream.registerConverter(new PerformanceIndicatorConverter( xStream ) ); + xStream.registerConverter(new RelationConverter( xStream ) ); + xStream.registerConverter(new TextAnnotationConverter( xStream ) ); + xStream.registerConverter(new UnaryTestsConverter( xStream ) ); + xStream.registerConverter(new FunctionItemConverter( xStream ) ); + + xStream.registerConverter(new ChildExpressionConverter( xStream ) ); + xStream.registerConverter(new TypedChildExpressionConverter( xStream ) ); + xStream.registerConverter(new ForConverter( xStream ) ); + xStream.registerConverter(new EveryConverter( xStream ) ); + xStream.registerConverter(new SomeConverter( xStream ) ); + xStream.registerConverter(new ConditionalConverter( xStream ) ); + xStream.registerConverter(new FilterConverter( xStream ) ); + + xStream.registerConverter(new QNameConverter()); + xStream.registerConverter(new DMNListConverter( xStream ) ); + xStream.registerConverter(new ElementCollectionConverter( xStream ) ); + xStream.registerConverter(new ExtensionElementsConverter( xStream, extensionRegisters ) ); + xStream.registerConverter(new DiagramElementExtensionConverter(xStream, extensionRegisters)); + + + for(DMNExtensionRegister extensionRegister : extensionRegisters) { + extensionRegister.registerExtensionConverters(xStream); + } + + xStream.ignoreUnknownElements(); + return xStream; + } + +} diff --git a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1x/XStreamMarshaller.java b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1x/XStreamMarshaller.java index 5e7f65c8527..469a6a36ad8 100644 --- a/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1x/XStreamMarshaller.java +++ b/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1x/XStreamMarshaller.java @@ -34,6 +34,7 @@ import org.kie.dmn.api.marshalling.DMNMarshaller; import org.kie.dmn.backend.marshalling.CustomStaxReader; import org.kie.dmn.model.api.Definitions; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,6 +46,7 @@ public class XStreamMarshaller implements DMNMarshaller { private final org.kie.dmn.backend.marshalling.v1_2.xstream.XStreamMarshaller xstream12; private final org.kie.dmn.backend.marshalling.v1_3.xstream.XStreamMarshaller xstream13; private final org.kie.dmn.backend.marshalling.v1_4.xstream.XStreamMarshaller xstream14; + private final org.kie.dmn.backend.marshalling.v1_5.xstream.XStreamMarshaller xstream15; private static final StaxDriver staxDriver = new StaxDriver(); public XStreamMarshaller() { @@ -52,6 +54,7 @@ public XStreamMarshaller() { xstream12 = new org.kie.dmn.backend.marshalling.v1_2.xstream.XStreamMarshaller(); xstream13 = new org.kie.dmn.backend.marshalling.v1_3.xstream.XStreamMarshaller(); xstream14 = new org.kie.dmn.backend.marshalling.v1_4.xstream.XStreamMarshaller(); + xstream15 = new org.kie.dmn.backend.marshalling.v1_5.xstream.XStreamMarshaller(); } public XStreamMarshaller (List extensionRegisters) { @@ -60,6 +63,7 @@ public XStreamMarshaller (List extensionRegisters) { xstream12 = new org.kie.dmn.backend.marshalling.v1_2.xstream.XStreamMarshaller(extensionRegisters); xstream13 = new org.kie.dmn.backend.marshalling.v1_3.xstream.XStreamMarshaller(extensionRegisters); xstream14 = new org.kie.dmn.backend.marshalling.v1_4.xstream.XStreamMarshaller(extensionRegisters); + xstream15 = new org.kie.dmn.backend.marshalling.v1_5.xstream.XStreamMarshaller(extensionRegisters); } @Override @@ -79,11 +83,14 @@ public Definitions unmarshal(String xml) { case DMN_v1_3: result = xstream13.unmarshal(secondStringReader); break; - case UNKNOWN: case DMN_v1_4: - default: result = xstream14.unmarshal(secondStringReader); break; + case UNKNOWN: + case DMN_v1_5: + default: + result = xstream15.unmarshal(secondStringReader); + break; } return result; @@ -94,7 +101,7 @@ public Definitions unmarshal(String xml) { } public enum DMN_VERSION { - UNKNOWN, DMN_v1_1, DMN_v1_2, DMN_v1_3, DMN_v1_4; + UNKNOWN, DMN_v1_1, DMN_v1_2, DMN_v1_3, DMN_v1_4, DMN_v1_5; } public static DMN_VERSION inferDMNVersion(Reader from) { @@ -102,13 +109,15 @@ public static DMN_VERSION inferDMNVersion(Reader from) { XMLStreamReader xmlReader = staxDriver.getInputFactory().createXMLStreamReader(from); CustomStaxReader customStaxReader = new CustomStaxReader(new QNameMap(), xmlReader); DMN_VERSION result = DMN_VERSION.UNKNOWN; - if (customStaxReader.getNsContext().values().stream().anyMatch(s -> org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN.equals(s))) { + if (customStaxReader.getNsContext().values().stream().anyMatch(org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_DMN::equals)) { + result = DMN_VERSION.DMN_v1_5; + } else if (customStaxReader.getNsContext().values().stream().anyMatch(org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN::equals)) { result = DMN_VERSION.DMN_v1_4; - } else if (customStaxReader.getNsContext().values().stream().anyMatch(s -> org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN.equals(s))) { + } else if (customStaxReader.getNsContext().values().stream().anyMatch(org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN::equals)) { result = DMN_VERSION.DMN_v1_3; - } else if (customStaxReader.getNsContext().values().stream().anyMatch(s -> org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN.equals(s))) { + } else if (customStaxReader.getNsContext().values().stream().anyMatch(org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN::equals)) { result = DMN_VERSION.DMN_v1_2; - } else if (customStaxReader.getNsContext().values().stream().anyMatch(s -> org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN.equals(s))) { + } else if (customStaxReader.getNsContext().values().stream().anyMatch(org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN::equals)) { result = DMN_VERSION.DMN_v1_1; } xmlReader.close(); @@ -133,7 +142,9 @@ public Definitions unmarshal(Reader isr) { @Override public String marshal(Object o) { - if (o instanceof org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase) { + if (o instanceof org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase) { + return xstream15.marshal(o); + } else if (o instanceof org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase) { return xstream14.marshal(o); } else if (o instanceof org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase) { return xstream13.marshal(o); @@ -148,7 +159,9 @@ public String marshal(Object o) { @Override public void marshal(Object o, Writer out) { - if (o instanceof org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase) { + if (o instanceof org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase) { + xstream15.marshal(o, out); + } else if (o instanceof org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase) { xstream14.marshal(o, out); } else if (o instanceof org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase) { xstream13.marshal(o, out); diff --git a/kie-dmn/kie-dmn-backend/src/test/java/org/kie/dmn/backend/marshalling/v1_5/UnmarshalMarshalTest.java b/kie-dmn/kie-dmn-backend/src/test/java/org/kie/dmn/backend/marshalling/v1_5/UnmarshalMarshalTest.java new file mode 100644 index 00000000000..de59347f507 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/java/org/kie/dmn/backend/marshalling/v1_5/UnmarshalMarshalTest.java @@ -0,0 +1,258 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.backend.marshalling.v1_5; + +import org.junit.Test; +import org.kie.dmn.api.marshalling.DMNMarshaller; +import org.kie.dmn.backend.marshalling.v1_3.extensions.TrisoExtensionRegister; +import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory; +import org.kie.dmn.model.api.Definitions; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; +import org.xmlunit.builder.DiffBuilder; +import org.xmlunit.builder.Input; +import org.xmlunit.diff.ComparisonResult; +import org.xmlunit.diff.ComparisonType; +import org.xmlunit.diff.Diff; +import org.xmlunit.diff.DifferenceEvaluators; +import org.xmlunit.validation.Languages; +import org.xmlunit.validation.ValidationProblem; +import org.xmlunit.validation.ValidationResult; +import org.xmlunit.validation.Validator; + +import javax.xml.namespace.QName; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; + +public class UnmarshalMarshalTest { + + private static final StreamSource DMN15_SCHEMA_SOURCE = new StreamSource(UnmarshalMarshalTest.class.getResource("/DMN15.xsd").getFile()); + private static final DMNMarshaller MARSHALLER = new org.kie.dmn.backend.marshalling.v1x.XStreamMarshaller(); + protected static final Logger LOG = LoggerFactory.getLogger(UnmarshalMarshalTest.class); + + @Test + public void testv15_simple() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "simple.dmn"); + } + + @Test + public void testv15_ch11example_asFromOMG() throws Exception { + DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new TrisoExtensionRegister())); // as the example from OMG contains example of extension element, preserving (re-using from package of 1.3) + testRoundTrip("org/kie/dmn/backend/marshalling/v1_5/", "Chapter 11 Example.dmn", marshaller, DMN15_SCHEMA_SOURCE); + } + + @Test + public void testv15_financial() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "Financial.dmn"); + } + + @Test + public void testv15_loan_info() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "Loan info.dmn"); + } + + @Test + public void testv15_recommended_loan_product() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "Recommended Loan Products.dmn"); + } + + @Test + public void testv15_for() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "sampleFor.dmn"); + } + + @Test + public void testv15_quantified() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "sampleQuantified.dmn"); + } + + @Test + public void testv15_conditional() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "sampleConditional.dmn"); + } + + @Test + public void testv15_filter() throws Exception { + testRoundTripV15("org/kie/dmn/backend/marshalling/v1_5/", "sampleFilter.dmn"); + } + + public void testRoundTripV15(String subdir, String xmlfile) throws Exception { + testRoundTrip(subdir, xmlfile, MARSHALLER, DMN15_SCHEMA_SOURCE); + } + + public void testRoundTrip(String subdir, String xmlfile, DMNMarshaller marshaller, Source schemaSource) throws Exception { + + File baseOutputDir = new File("target/test-xmlunit/"); + File testClassesBaseDir = new File("target/test-classes/"); + + File inputXMLFile = new File(testClassesBaseDir, subdir + xmlfile); + + FileInputStream fis = new FileInputStream(inputXMLFile); + + Definitions unmarshal = marshaller.unmarshal(new InputStreamReader(fis)); + + Validator v = Validator.forLanguage(Languages.W3C_XML_SCHEMA_NS_URI); + v.setSchemaSource(schemaSource); + ValidationResult validateInputResult = v.validateInstance(new StreamSource(inputXMLFile)); + if (!validateInputResult.isValid()) { + for (ValidationProblem p : validateInputResult.getProblems()) { + LOG.error("{}", p); + } + } + assertThat(validateInputResult.isValid()).isTrue(); + + final File subdirFile = new File(baseOutputDir, subdir); + if (!subdirFile.mkdirs()) { + LOG.warn("mkdirs() failed for File: ", subdirFile.getAbsolutePath()); + } + FileOutputStream sourceFos = new FileOutputStream(new File(baseOutputDir, subdir + "a." + xmlfile)); + Files.copy( + new File(testClassesBaseDir, subdir + xmlfile).toPath(), + sourceFos + ); + sourceFos.flush(); + sourceFos.close(); + + LOG.debug("{}", marshaller.marshal(unmarshal)); + File outputXMLFile = new File(baseOutputDir, subdir + "b." + xmlfile); + try (FileWriter targetFos = new FileWriter(outputXMLFile)) { + marshaller.marshal(unmarshal, targetFos); + } + + // Should also validate output XML: + ValidationResult validateOutputResult = v.validateInstance(new StreamSource(outputXMLFile)); + if (!validateOutputResult.isValid()) { + for (ValidationProblem p : validateOutputResult.getProblems()) { + LOG.error("{}", p); + } + } + assertThat(validateOutputResult.isValid()).isTrue(); + + LOG.debug("\n---\nDefault XMLUnit comparison:"); + Source control = Input.fromFile(inputXMLFile).build(); + Source test = Input.fromFile(outputXMLFile).build(); + Diff allDiffsSimilarAndDifferent = DiffBuilder + .compare(control) + .withTest(test) + .build(); + allDiffsSimilarAndDifferent.getDifferences().forEach(m -> LOG.debug("{}", m)); + + LOG.info("XMLUnit comparison with customized similarity for defaults:"); + // in the following a manual DifferenceEvaluator is needed until XMLUnit is configured for properly parsing the XSD linked inside the XML, + // in order to detect the optional+defaultvalue attributes of xml element which might be implicit in source-test, and explicit in test-serialized. + /* + * $ grep -Eo " + + +DMNDIv1.2: + + */ + Set attrWhichCanDefault = new HashSet(); + attrWhichCanDefault.addAll(Arrays.asList(new QName("expressionLanguage"), + new QName("typeLanguage"), + new QName("isCollection"), + new QName("hitPolicy"), + new QName("preferredOrientation"), + new QName("kind"), + new QName("textFormat"), + new QName("associationDirection"), + new QName("isCollapsed"), + new QName("useAlternativeInputDataShape"))); + Set nodeHavingDefaultableAttr = new HashSet<>(); + nodeHavingDefaultableAttr.addAll(Arrays.asList("definitions", "decisionTable", "itemDefinition", "itemComponent", "encapsulatedLogic", "textAnnotation", "association", "DMNShape", "DMNDiagram")); + Diff checkSimilar = DiffBuilder + .compare(control) + .withTest(test) + .withDifferenceEvaluator( + DifferenceEvaluators.chain(DifferenceEvaluators.Default, + ((comparison, outcome) -> { + if (outcome == ComparisonResult.DIFFERENT && comparison.getType() == ComparisonType.ELEMENT_NUM_ATTRIBUTES) { + if (comparison.getControlDetails().getTarget().getNodeName().equals(comparison.getTestDetails().getTarget().getNodeName()) + && nodeHavingDefaultableAttr.contains(safeStripDMNPRefix(comparison.getControlDetails().getTarget()))) { + return ComparisonResult.SIMILAR; + } + } + // DMNDI/DMNDiagram#documentation is actually deserialized escaped with newlines as by the XML JDK infra. + if (outcome == ComparisonResult.DIFFERENT && comparison.getType() == ComparisonType.ATTR_VALUE) { + if (comparison.getControlDetails().getTarget().getNodeName().equals(comparison.getTestDetails().getTarget().getNodeName()) + && comparison.getControlDetails().getTarget().getNodeType() == Node.ATTRIBUTE_NODE + && comparison.getControlDetails().getTarget().getLocalName().equals("documentation")) { + return ComparisonResult.SIMILAR; + } + } + if (outcome == ComparisonResult.DIFFERENT && comparison.getType() == ComparisonType.ATTR_NAME_LOOKUP) { + boolean testIsDefaulableAttribute = false; + QName whichDefaultableAttr = null; + if (comparison.getControlDetails().getValue() == null && attrWhichCanDefault.contains(comparison.getTestDetails().getValue())) { + for (QName a : attrWhichCanDefault) { + boolean check = comparison.getTestDetails().getXPath().endsWith("@" + a); + if (check) { + testIsDefaulableAttribute = true; + whichDefaultableAttr = a; + } + } + } + if (testIsDefaulableAttribute) { + if (comparison.getTestDetails().getXPath().equals(comparison.getControlDetails().getXPath() + "/@" + whichDefaultableAttr)) { + // TODO missing to check the explicited option attribute has value set to the actual default value. + return ComparisonResult.SIMILAR; + } + } + } + return outcome; + }))) + .ignoreWhitespace() + .checkForSimilar() + .build(); + checkSimilar.getDifferences().forEach(m -> LOG.error("{}", m)); + if (!checkSimilar.getDifferences().iterator().hasNext()) { + LOG.info("[ EMPTY - no diffs using customized similarity ]"); + } + assertThat(checkSimilar.hasDifferences()).as("XML are NOT similar: " + checkSimilar.toString()).isFalse(); + } + + private String safeStripDMNPRefix(Node target) { + if (KieDMNModelInstrumentedBase.URI_DMN.equals(target.getNamespaceURI()) || + KieDMNModelInstrumentedBase.URI_DMNDI.equals(target.getNamespaceURI())) { + return target.getLocalName(); + } + return null; + } +} diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/DMN15.xsd b/kie-dmn/kie-dmn-backend/src/test/resources/DMN15.xsd new file mode 100644 index 00000000000..382388d0e7e --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/DMN15.xsd @@ -0,0 +1,587 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/DMNDI15.xsd b/kie-dmn/kie-dmn-backend/src/test/resources/DMNDI15.xsd new file mode 100644 index 00000000000..87e84f9cf89 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/DMNDI15.xsd @@ -0,0 +1,102 @@ + + + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Chapter 11 Example.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Chapter 11 Example.dmn new file mode 100644 index 00000000000..5e45b1377ab --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Chapter 11 Example.dmn @@ -0,0 +1,3010 @@ + + + + + + + + + + + + string + + "DECLINE","BUREAU","THROUGH" + + + + string + + "INELIGIBLE","ELIGIBLE" + + + + string + + "FULL","MINI","NONE" + + + + string + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + number + + + string + + "S","M" + + + + string + + "EMPLOYED","SELF-EMPLOYED","STUDENT","UNEMPLOYED" + + + + boolean + + + + number + + + number + + + number + + + + + + boolean + + + number + + [0..999], null + + + + + string + + "DECLINE","REFER","ACCEPT" + + + + + string + + "STANDARD LOAN","SPECIAL LOAN" + + + + number + + + number + + + number + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <p><span lang="JA">Determine if&nbsp;an application requiring adjudication should be accepted or declined given the available application data and supporting documents.</span></p> + Should this application that has been referred for adjudication be accepted? + Yes/No + + + + + + + + + + + + + + + + + + + + + + + <p>The collected wisdom of the credit officers as collected in their best practice wiki.</p> + Expertise + + + + <p>Documents associated with a loan that are not processed electronically but are available for manual adjudication.</p> + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Bureau call type&nbsp;</span></strong><span lang="JA">decision logic&nbsp;invokes the Bureau call type&nbsp;</span>table, passing the output of the Pre-bureau risk category decision as the Pre-Bureau Risk Category parameter.</span></p> + How much data should be requested from the credit bureau for this application? + A value from the explicit list "Full", "Mini", "None" + + + + + + + + + + + + Bureau call type table + + + + + Pre-bureau risk category + + + + + + <p><span style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Strategy&nbsp;</span></strong><span lang="JA">decision logic&nbsp;defines a complete, unique-hit decision table deriving Strategy from&nbsp;</span>Eligibility and Bureau call type.</span></p> + What is the appropriate handling strategy for this application? + A value from the explicit list "Decline", "Bureau", "Through" + + + + + + + + + + + + + + + + Eligibility + + + "INELIGIBLE","ELIGIBLE" + + + + + Bureau call type + + + "FULL","MINI","NONE" + + + + + "DECLINE","BUREAU","THROUGH" + + + + + + "INELIGIBLE" + + + - + + + "DECLINE" + + + + + + + + "ELIGIBLE" + + + "FULL", "MINI" + + + "BUREAU" + + + + + + + + "ELIGIBLE" + + + "NONE" + + + "THROUGH" + + + + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Eligibility&nbsp;</span></strong><span lang="JA">decision logic invokes the Eligibility rules business&nbsp;</span>knowledge model, passing Applicant data.Age as the Age parameter, the output of the Pre-bureau risk category decision as the Pre-Bureau Risk Category parameter, and the output of the Pre-bureau affordability decision as the Pre-Bureau Affordability parameter.</span></p> + Does this applicant appear eligible for the loan they applied for given only their application data? + Value from the explicit list "Eligible", "Not Eligible" + + + + + + + + + + + + + + + + + Eligibility rules + + + + + Applicant data.Age + + + + + + Pre-bureau risk category + + + + + + Pre-bureau affordability + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Eligibility rules&nbsp;</span></strong><span lang="JA">decision logic&nbsp;defines a complete, priority-ordered single hit decision table&nbsp;</span>deriving Eligibility from Pre-Bureau Risk Category, Pre-Bureau Affordability and Age.</span></p> + + + + + + + + + Pre-Bureau Risk Category + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + Pre-Bureau Affordability + + + + + Age + + + + + "INELIGIBLE","ELIGIBLE" + + + + + + "DECLINE" + + + - + + + - + + + "INELIGIBLE" + + + + + + + + - + + + false + + + - + + + "INELIGIBLE" + + + + + + + + - + + + - + + + < 18 + + + "INELIGIBLE" + + + + + + + + - + + + - + + + - + + + "ELIGIBLE" + + + + + + + + + + + + + <p>Definitions of the products, their cost structure and eligibility criteria.</p> + Policy + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Routing Rules&nbsp;</span></strong><span lang="JA">decision logic defines a complete, priority-ordered single hit decision table&nbsp;</span>deriving Routing from Post-Bureau Risk Category, Post-Bureau Affordability, Bankrupt and Credit Score.</span></p> + + + + + + + + + + Post-bureau risk category + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + Post-bureau affordability + + + + + Bankrupt + + + + + Credit score + + + null, [0..999] + + + + + "DECLINE","REFER","ACCEPT" + + + + + + - + + + false + + + - + + + - + + + "DECLINE" + + + + + + + + - + + + - + + + true + + + - + + + "DECLINE" + + + + + + + + "HIGH" + + + - + + + - + + + - + + + "REFER" + + + + + + + + - + + + - + + + - + + + < 580 + + + "REFER" + + + + + + + + - + + + - + + + - + + + - + + + "ACCEPT" + + + + + + + + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Routing&nbsp;</span></strong><span lang="JA">decision logic invokes the Routing rules business&nbsp;</span>knowledge model, passing Bureau data . Bankrupt as the Bankrupt parameter, Bureau data . CreditScore as the Credit Score parameter, the output of the Post-bureau risk category decision as the Post-Bureau Risk Category parameter, and the output of the Post-bureau affordability decision as the Post-Bureau Affordability parameter. Note that if Bureau data is null (due to the THROUGH strategy bypassing the Collect bureau data task) the Bankrupt and Credit Score parameters will be null.</span></p> + How this should this applicant be routed given all available data? + A value from the explicit list "Decline", "Refer for Adjudication", "Accept without Review" + + + + + + + + + + + + + + + + + + + + + Routing rules + + + + + Bureau data.Bankrupt + + + + + + Bureau data.CreditScore + + + + + + Post-bureau risk category + + + + + + Post-bureau affordability + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Bureau call type table&nbsp;</span></strong><span lang="JA">decision logic defines a complete, unique-hit decision table deriving&nbsp;</span>Bureau Call Type from Pre-Bureau Risk Category.</span></p> + + + + + + + Pre-Bureau Risk Category + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + "FULL","MINI","NONE" + + + + + + "HIGH", "MEDIUM" + + + "FULL" + + + + + + + + "LOW" + + + "MINI" + + + + + + + + "VERY LOW", "DECLINE" + + + "NONE" + + + + + + + + + + + + + <p>Overall risk management approach for the financial institution including its approach to&nbsp;application risk, credit contingencies and credit risk scoring.</p> + Policy + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"></span><span lang="JA">The&nbsp;</span><strong><span lang="JA">Credit contingency factor table&nbsp;</span></strong><span lang="JA"><span style="font-size: 10pt; font-family: arial, helvetica, sans-serif;">decision</span> logic defines a complete, unique-hit decision table&nbsp;</span>deriving Credit contingency factor from Risk Category.</p> +<p>&nbsp;</p> + + + + + + + Risk Category + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + + + "HIGH", "DECLINE" + + + 0.6 + + + + + + + + "MEDIUM" + + + 0.7 + + + + + + + + "LOW", "VERY LOW" + + + 0.8 + + + + + + + + + + + + + <p>Internal spreadsheet showing the relationship of income, payments, expenses, risk and affordability.</p> + Policy + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Affordability calculation&nbsp;</span></strong><span lang="JA">decision logic defines a boxed function deriving Affordability from&nbsp;</span>Monthly Income, Monthly Repayments, Monthly Expenses and Required Monthly Installment. One step in this calculation derives Credit contingency factor by invoking the Credit contingency factor table business</span></p> + + + + + + + + + + + + Monthly Income - (Monthly Repayments + Monthly Expenses) + + + + + + + Credit contingency factor table + + + + + Risk Category + + + + + + + + if Disposable Income * Credit Contingency Factor > Required Monthly Installment +then true +else false + + + + + Affordability + + + + + + + + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Pre-bureau affordability&nbsp;</span></strong><span lang="JA">decision logic&nbsp;invokes the&nbsp;</span>Affordability calculation business knowledge model, passing Applicant data.Monthly.Income as the Monthly Income parameter, Applicant data.Monthly.Repayments as the Monthly Repayments parameter, Applicant data.Monthly.Expenses as the Monthly Expenses parameter, the output of the Pre-bureau risk category decision as the Risk Category parameter, and the output of the Required monthly installment decision as the Required Monthly Installment parameter.</span></p> + Can the applicant afford the loan they applied for given only their application data? + Yes/No + + + + + + + + + + + + + + + + + Affordability calculation + + + + + Applicant data.Monthly.Income + + + + + + Applicant data.Monthly.Repayments + + + + + + Applicant data.Monthly.Expenses + + + + + + Pre-bureau risk category + + + + + + Required monthly installment + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Post-bureau affordability&nbsp;</span></strong><span lang="JA">decision logic invokes the&nbsp;</span>Affordability calculation business knowledge model, passing Applicant data.Monthly.Income as the Monthly Income parameter, Applicant data.Monthly.Repayments as the Monthly Repayments parameter, Applicant data.Monthly.Expenses as the Monthly Expenses parameter, the output of the Post-bureau risk category decision as the Risk Category parameter, and the output of the Required monthly installment decision as the Required Monthly Installment parameter.</span></p> + Can the applicant afford the loan they applied for given all available data? + Yes/No + + + + + + + + + + + + + + + + + Affordability calculation + + + + + Applicant data.Monthly.Income + + + + + + Applicant data.Monthly.Repayments + + + + + + Applicant data.Monthly.Expenses + + + + + + Post-bureau risk category + + + + + + Required monthly installment + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Post-bureau risk category&nbsp;</span></strong><span lang="JA">decision logic invokes the Post-bureau&nbsp;</span>risk category business knowledge model, passing Applicant data.ExistingCustomer as the Existing Customer parameter, Bureau data.CreditScore as the Credit Score parameter, and the output of the Application risk score decision as the Application Risk Score parameter. Note that if Bureau data is null (due to the THROUGH strategy bypassing the Collect bureau data task) the Credit Score parameter will be null.</span></p> + Which risk category is most appropriate for this applicant given all available data? + A value from the explicit list "Decline", "High Risk", "Medium Risk", "Low Risk", "Very Low Risk" + + + + + + + + + + + + + + + + + Post-bureau risk category table + + + + + Applicant data.ExistingCustomer + + + + + + Bureau data.CreditScore + + + + + + Application risk score + + + + + + <p>External credit score and bankruptcy information provided by a bureau.</p> + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Post-bureau risk category table&nbsp;</span></strong><span lang="JA">decision logic defines a complete, unique-hit decision table&nbsp;</span>deriving Post-Bureau Risk Category from Existing Customer, Application Risk Score and Credit Score.</span></p> + + + + + + + + + Existing Customer + + + + + Application Risk Score + + + + + Credit Score + + + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + + false + + + < 120 + + + < 590 + + + "HIGH" + + + + + + + + false + + + < 120 + + + [590..610] + + + "MEDIUM" + + + + + + + + false + + + < 120 + + + > 610 + + + "LOW" + + + + + + + + false + + + [120..130] + + + < 600 + + + "HIGH" + + + + + + + + false + + + [120..130] + + + [600..625] + + + "MEDIUM" + + + + + + + + false + + + [120..130] + + + > 625 + + + "LOW" + + + + + + + + false + + + > 130 + + + - + + + "VERY LOW" + + + + + + + + true + + + <= 100 + + + < 580 + + + "HIGH" + + + + + + + + true + + + <= 100 + + + [580..600] + + + "MEDIUM" + + + + + + + + true + + + <= 100 + + + > 600 + + + "LOW" + + + + + + + + true + + + > 100 + + + < 590 + + + "HIGH" + + + + + + + + true + + + > 100 + + + [590..615] + + + "MEDIUM" + + + + + + + + true + + + > 100 + + + > 615 + + + "LOW" + + + + + + + + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Pre-Bureau Risk Category&nbsp;</span></strong><span lang="JA">decision logic&nbsp;invokes the Pre-bureau&nbsp;</span>risk category table business knowledge model, passing Applicant data.ExistingCustomer as the Existing Customer parameter and the output of the Application risk score decision as the Application Risk Score parameter.</span></p> + Which risk category is most appropriate for this applicant given only their application data? + Value from explicit list "Decline", "High Risk", "Medium Risk", "Low Risk", "Very Low Risk" + + + + + + + + + + + + + + Pre-bureau risk category table + + + + + Applicant data.ExistingCustomer + + + + + + Application risk score + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Pre-bureau risk category table&nbsp;</span></strong><span lang="JA">decision logic defines a complete, unique-hit decision table&nbsp;</span>deriving Pre-bureau risk category from Existing Customer and Application Risk Score.</span></p> + + + + + + + + Existing Customer + + + + + Application Risk Score + + + + + "DECLINE","HIGH","MEDIUM","LOW","VERY LOW" + + + + + + false + + + < 100 + + + "HIGH" + + + + + + + + false + + + [100..120) + + + "MEDIUM" + + + + + + + + false + + + [120..130] + + + "LOW" + + + + + + + + false + + + > 130 + + + "VERY LOW" + + + + + + + + true + + + < 80 + + + "DECLINE" + + + + + + + + true + + + [80..90) + + + "HIGH" + + + + + + + + true + + + [90..110] + + + "MEDIUM" + + + + + + + + true + + + > 110 + + + "LOW" + + + + + + + + + + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Application Risk Score&nbsp;</span></strong><span lang="JA">decision logic invokes the Application&nbsp;</span>risk score model business knowledge model, passing Applicant data.Age as the Age parameter, Applicant data.MaritalStatus as the Marital Status parameter and Applicant data.EmploymentStatus as the Employment Status parameter.</span></p> + What is the risk score for this applicant? + A number greater than 70 and less than 150 + + + + + + + + + + + + Application risk score model + + + + + Applicant data.Age + + + + + + Applicant data.MaritalStatus + + + + + + Applicant data.EmploymentStatus + + + + + + <p>Credit risk scorecard analysis to determine the relevant factors for application risk scoring</p> + + + + + + + + + + Analytic Insight + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Application risk score model&nbsp;</span></strong><span lang="JA">decision logic&nbsp;defines a complete, no-order multiple-hit table&nbsp;</span>with aggregation, deriving Application risk score from Age, Marital Status and Employment Status, as the sum of the Partial scores of all matching rows (this is therefore a predictive scorecard represented as a decision table).</span></p> + + + + + + + + + Age + + + [18..120] + + + + + Marital Status + + + "S","M" + + + + + Employment Status + + + "UNEMPLOYED","STUDENT","EMPLOYED","SELF-EMPLOYED" + + + + + + + [18..22) + + + - + + + - + + + 32 + + + + + + + + [22..26) + + + - + + + - + + + 35 + + + + + + + + [26..36) + + + - + + + - + + + 40 + + + + + + + + [36..50) + + + - + + + - + + + 43 + + + + + + + + >=50 + + + - + + + - + + + 48 + + + + + + + + - + + + "S" + + + - + + + 25 + + + + + + + + - + + + "M" + + + - + + + 45 + + + + + + + + - + + + - + + + "UNEMPLOYED" + + + 15 + + + + + + + + - + + + - + + + "STUDENT" + + + 18 + + + + + + + + - + + + - + + + "EMPLOYED" + + + 45 + + + + + + + + - + + + - + + + "SELF-EMPLOYED" + + + 36 + + + + + + + + + + + + + <p>Information about the applicant including personal information, marital status and household income/expenses.</p> + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Required monthly installment&nbsp;</span></strong><span lang="JA">decision logic invokes the&nbsp;</span>Installment calculation business knowledge model, passing Requested product.ProductType as the Product Type parameter, Requested product.Rate as the Rate parameter, Requested product.Term as the Term parameter, and Requested product.Amount as the Amount parameter.</span></p> + What is the minimum monthly installment payment required for this loan product? + A dollar amount greater than zero + + + + + + + + + + + Installment calculation + + + + + Requested product.ProductType + + + + + + Requested product.Rate + + + + + + Requested product.Term + + + + + + Requested product.Amount + + + + + + <p>Details of the loan the applicant has applied for.</p> + + + + <p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span lang="JA">The&nbsp;</span><strong><span lang="JA">Installment calculation&nbsp;</span></strong><span lang="JA">decision logic&nbsp;defines a boxed function deriving monthly installment&nbsp;</span>from Product Type, Rate, Term and Amount.</span></p> + + + + + + + + + + + if Product Type = "STANDARD LOAN" +then 20.00 +else if Product Type = "SPECIAL LOAN" +then 25.00 +else null + + + + + + Financial.PMT(Rate, Term, Amount) + + + + + Monthly Repayment + Monthly Fee + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <p>Information about historical loan defaults.</p> + + + + The credit risk scorecard is built from past applicants' data and information about those loans that defaulted. It must conform to the overall risk management strategy. + + + <p>Individuals in the Retail Banking organization responsible for manual adjudication of loans.</p> + + + + <p>Organization responsible for defining loan and other banking products, how those products are priced, sold and tracked for profitability.</p> + + + + + + <p>Organization within the bank responsible for defining credit risk strategies and policies and providing tools for managing against these.</p> + + + + + + + + + + <p>Organization responsible for credit risk models and the use of data to predict credit risk for customers and loan applicants.</p> + + + + <p>The percentage of loans accepted in a calendar month.</p> + + + + + + <p>The percentage of loans that did not require a credit officer to review the case in a calendar month.</p> + + + + + <p>The total value of Loans written in a calendar month</p> + + + + + + <p>By end of the current year, have an auto-adjudication rate of at least 90 percent</p> + + + + + <p>The total cost charged by the bureau for all Bureau Data requested while originating Loans in a calendar month.</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Financial.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Financial.dmn new file mode 100644 index 00000000000..c8bb039b236 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Financial.dmn @@ -0,0 +1,46 @@ + + + + + + + + + <p><span lang="JA">Standard calculation of monthly installment&nbsp;</span>from Rate, Term and Amount.</p> + + + + + + + (Amount *Rate/12) / (1 - (1 + Rate/12)**-Term) + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Loan info.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Loan info.dmn new file mode 100644 index 00000000000..e551b3de704 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Loan info.dmn @@ -0,0 +1,767 @@ + + + + + string + + + string + + + number + + + number + + + tAssets + + + tLiabilities + + + + + tAssetType + + + string + + + number + + + + tAsset + + + string + + "Checking Savings Brokerage account","Real Estate","Other Liquid","Other Non-Liquid" + + + + + tLiabilityType + + + string + + + number + + + number + + + boolean + + + + tLiability + + + string + + "Credit card","Auto loan","Student loan","Lease","Lien","Real estate loan","Alimony child support","Other" + + + "Credit card","Auto loan","Student loan","Lease","Lien","Real estate loan","Alimony child support","Other" + + + + string + + "Fixed rate","Variable rate" + + + + + string + + + tProductName + + "Fixed30-NoPoints","Fixed30-Standard","Fixed15-NoPoints","Fixed15-Standard","ARM5/1-NoPoints","ARM5/1-Standard" + + + + tAmortizationType + + + tPercent + + + tPercent + + + number + + + number + + + + + + string + + + string + + + string + + + string + + + string + + + + number + + + number + + + number + + + number + + + + number + + + number + + + number + + [300..850] + + + + string + + "Fixed30-NoPoints","Fixed30-Standard","Fixed15-NoPoints","Fixed15-Standard","ARM5/1-NoPoints","ARM5/1-Standard" + + + + + number + + + number + + + tPercent + + + number + + + number + + + tPercent + + + tPercent + + + number + + + number + + + + + tProductName + + "Fixed30-NoPoints","Fixed30-Standard","Fixed15-NoPoints","Fixed15-Standard","ARM5/1-NoPoints","ARM5/1-Standard" + + + + tAmortizationType + + "Fixed rate","Variable rate" + + + + tPercent + + + number + + + tPercent + + + tPercent + + + number + + + number + + + number + + + number + + + number + + + number + + + number + + + number + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + decimal((Property.Purchase Price - Down Payment)*Loan Product.Points Pct/100,2) + + + + + + Property.Purchase Price - Down Payment + Loan Product.Fees Amount + Points Amount + + + + + + decimal(100*Note Amount/Property.Purchase Price,2) + + + + + + decimal(0.02*Note Amount,2) + + + + + + Note Amount - Loan Product.Fees Amount - Points Amount - Closing Costs + + + + + + Loan Product.Best Rate Pct + Rate Adjustment(Credit Score, LTV) + + + + + + if Loan Product.Type="Variable rate" then Interest Rate Percent+2 else Interest Rate Percent + + + + + + + payment + + + + + Note Amount + + + + + + Interest Rate Percent/100 + + + + + + Loan Product.Term + + + + + + + + + payment + + + + + Note Amount + + + + + + Qualifying Rate Percent/100 + + + + + + Loan Product.Term + + + + + + + + + + + + + + + + + + Credit Score + + + [300..850] + + + + + LTV + + + + + + + >=660 + + + <=60 + + + 0 + + + + + + + + [620..660) + + + <=60 + + + 0.125 + + + + + + + + >=700 + + + >60 + + + 0.125 + + + + + + + + [660..700) + + + (60..70] + + + 0.125 + + + + + + + + [620..660) + + + (60..70] + + + 0.25 + + + + + + + + [680..700) + + + >70 + + + 0.25 + + + + + + + + [640..680) + + + >70 + + + 0.375 + + + + + + + + [620..640) + + + (70..80] + + + 0.375 + + + + + + + + [620..640) + + + >80 + + + 0.5 + + + + + + + + <620 + + + - + + + 0.5 + + + + + + + + + + + + + + + + decimal(p*r/12/(1-(1+r/12)**-n),2) + + + + + + + + + + + + + + + + + + + + + + Loan Product.Product Name + + + + + + Loan Product.Type + + + + + + Loan Data.LTV + + + + + + Loan Data.Note Amount + + + + + + Loan Data.Interest Rate Percent + + + + + + Loan Data.Qualifying Rate Percent + + + + + + Loan Data.Monthly Payment + + + + + + Loan Data.Qualifying Payment + + + + + + Loan Data.Points Amount + + + + + + Loan Product.Fees Amount + + + + + + Loan Data.Funds Toward Purchase + + + + + + Down Payment + + + + + + Loan Data.Closing Costs + + + + + + Property.Purchase Price - Funds Toward Purchase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Recommended Loan Products.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Recommended Loan Products.dmn new file mode 100644 index 00000000000..0ad2f5e6a58 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/Recommended Loan Products.dmn @@ -0,0 +1,1421 @@ + + + + + + string + + + string + + + number + + + number + + + tAssets + + + tLiabilities + + + + + tAssetType + + + string + + + number + + + + tAsset + + + string + + "Checking Savings Brokerage account","Real Estate","Other Liquid","Other Non-Liquid" + + + + + tLiabilityType + + + string + + + number + + + number + + + boolean + + + + tLiability + + + string + + "Credit card","Auto loan","Student loan","Lease","Lien","Real estate loan","Alimony child support","Other" + + + + string + + "Fixed rate","Variable rate" + + + + + tAmortizationType + + + number + + + number + + + number + + + number + + + + + + string + + + string + + + string + + + string + + + string + + + + number + + + number + + + number + + + number + + + + number + + + number + + + number + + [300..850] + + + + string + + "Affordable","Marginal","Unaffordable" + + + + string + + "Fixed30-NoPoints","Fixed30-Standard","Fixed15-NoPoints","Fixed15-Standard","ARM5/1-NoPoints","ARM5/1-Standard" + + + + + string + + + tProductName + + "Fixed30-NoPoints","Fixed30-Standard","Fixed30-LowestRate","Fixed15-NoPoints","Fixed15-Standard","ARM5/1-NoPoints","ARM5/1-Standard" + + + + tAmortizationType + + "Fixed rate","Variable rate" + + + + tPercent + + + tPercent + + + number + + + number + + + + tLoanProduct + + + + tProductName + + + tAmortizationType + + + tPercent + + + number + + + tPercent + + + tPercent + + + number + + + number + + + number + + + number + + + number + + + number + + + number + + + number + + + + tLoanInfoRow + + + tTableRow + + + string + + "Low","Medium","High" + + + + + tAffordability + + + number + + + tLTVCategory + + + + + tPercent + + + tAffordability + + "Affordable","Marginal","Unaffordable" + + + + tLTVCategory + + "Low","Medium","High" + + + + number + + + number + + + + + number + + + number + + + number + + + tPercent + + + number + + + number + + + number + + + number + + + + + string + + + number + + [1..5] + + + + + tLenderRating + + + string + + "Best","Good","Not Recommended","Ineligible" + + + + + string + + + number + + + tPercent + + + number + + + tPercent + + + tPercent + + + number + + + number + + + number + + + tCreditScore + + [300..850] + + + + tRecommendation + + "Best","Good","Not Recommended","Ineligible" + + + + + + string + + + string + + + string + + + string + + + string + + + string + + + string + + + string + + + string + + + tCreditScore + + + string + + + + tformattedrow_1 + + + + string + + + string + + + string + + + string + + + string + + + tCreditScore + + [300..850] + + + + string + + + + + + + + + + + + + + + + + + + + + + + + DTI + + + + + LTV + + + + + Reserves + + + + + [300..850] + + + + + + <=36 + + + <=75 + + + >2 + + + 620 + + + + + + + + <=36 + + + <=75 + + + >0 + + + 640 + + + + + + + + <=36 + + + (75..95] + + + >6 + + + 660 + + + + + + + + <=36 + + + (75..95] + + + >0 + + + 680 + + + + + + + + (36..45] + + + <=75 + + + >6 + + + 660 + + + + + + + + (36..45] + + + <=75 + + + >0 + + + 680 + + + + + + + + (36..45] + + + (75..95] + + + >6 + + + 700 + + + + + + + + (36..45] + + + (75..95] + + + >0 + + + 720 + + + + + + + + + + + + + + + + + + + + + "Lender A" + + + "Fixed30-NoPoints" + + + "Fixed rate" + + + 3.95 + + + 0 + + + 1925 + + + 360 + + + + + "Lender C" + + + "Fixed30-Standard" + + + "Fixed rate" + + + 3.75 + + + 0.972 + + + 1975 + + + 360 + + + + + "Lender A" + + + "Fixed15-NoPoints" + + + "Fixed rate" + + + 3.625 + + + 0 + + + 816 + + + 180 + + + + + "Lender C" + + + "Fixed15-Standard" + + + "Fixed rate" + + + 3.25 + + + 0.767 + + + 1975 + + + 180 + + + + + "Lender B" + + + "ARM5/1-NoPoints" + + + "Variable rate" + + + 3.875 + + + 0 + + + 1776 + + + 360 + + + + + "Lender B" + + + "ARM5/1-Standard" + + + "Variable rate" + + + 3.625 + + + 0.667 + + + 1975 + + + 360 + + + + + + + + + + + + + + + + + + + + + + + for x in Loan Products return Services.Loan Info Service(x,Down Payment,Property,Credit Score) + + + + + + + + + + + + + + + + + + + + + + + + + + + for i in 1..count(Loan Products) return Eligibility(Loan Products[i], Borrower, Loan Info Table[i], +Property, Credit Score, Lender Ratings) + + + + + + + + + + + + + + + + Eligibility Parameters(Loan Product, Borrower, Loan Info, +Property, Credit Score) + + + + + + Min Credit Score(Params.DTI Pct, Loan Info.LTV, Params.Reserves) + + + + + + if Required Credit Score != null then +Credit Score >= Required Credit Score else false + + + + + + + + Loan Product + + + + + Eligible + + + + + "Best","Good","Not Recommended","Ineligible" + + + + + + count(Ratings[Lender Name=?.Lender Name and Customer Rating > 4] )>0 + + + true + + + "Best" + + + + + + + + count(Ratings[Lender Name=?.Lender Name and Customer Rating in [3..4]] )>0 + + + true + + + "Good" + + + + + + + + count(Ratings[Lender Name=?.Lender Name and Customer Rating <3] )>0 + + + true + + + "Not Recommended" + + + + + + + + - + + + - + + + "Ineligible" + + + + + + + + + + + + + + Loan Product.Lender Name + " - " + Loan Product.Product Name + + + + + + Loan Info.Note Amount + + + + + + Loan Info.Initial Rate Pct + + + + + + Loan Info.Initial Monthly Payment + + + + + + Loan Info.LTV + + + + + + Params.DTI Pct + + + + + + Loan Info.Cash to Close + + + + + + Params.Liquid Assets After Closing + + + + + + Params.Reserves + + + + + + Required Credit Score + + + + + + Recommendation + + + + + + + Table Row + + + + + + + + + + + + + + + + + + + + + + + + + + + if x.Recommendation != "Ineligible" and y.Recommendation != "Ineligible" +then x.Monthly Payment<y.Monthly Payment +else if x.Recommendation != "Ineligible" and y.Recommendation = "Ineligible" +then true else false + + + + + + + sort(Eligibility Table, precedes) + + + + + for row in Sorted Table return Format Row(row) + + + + + + + + + + + + + + + + + sum([Loan Info.Qualifying Monthly Payment, Property.Monthly Tax Payment, +Property.Monthly Insurance Payment, Property.Monthly HOA Condo Fee][item != null]) + + + + + + sum(Borrower.Liabilities[Type!="Real estate loan" and To be paid off +=false].Monthly payment) + + + + + + sum([Borrower.Employment Income, Borrower.Other Income][item != null]) + + + + + + decimal((Housing Expense+Non-Housing Debt Payments)/Income*100,2) + + + + + + sum(Borrower.Assets[Type="Checking Savings Brokerage account" +or Type="Other Liquid"].Value) + + + + + + sum(Borrower.Liabilities[Type!="Real estate loan" +and To be paid off=true].Balance[item!=null]) + + + + + + Liquid Assets Before Closing - Debts Paid Off By Closing - Loan Info.Cash to Close + + + + + + decimal(Liquid Assets After Closing/Housing Expense,2) + + + + + + + + + + + + + + + + + + + + + + + "java.lang.String" + + + + + + "format( java.lang.String, [Ljava.lang.Object; )" + + + + + + + + + + + + row.Product + + + + + + string format("$%,4.2f", row.Note Amount) + + + + + + string format(" %,4.2f", row.Interest Rate Pct) + + + + + + string format("$%,4.2f", row.Monthly Payment) + + + + + + string format("$%,4.2f", row.Cash to Close) + + + + + + row.Required Credit Score + + + + + + row.Recommendation + + + + + + + formatted row + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleConditional.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleConditional.dmn new file mode 100644 index 00000000000..860467eca9a --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleConditional.dmn @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + 47 > 0 + + + + + "Hello World" + + + + + "wat" + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFilter.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFilter.dmn new file mode 100644 index 00000000000..42ed34e16c6 --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFilter.dmn @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + [1,2,3,4] + + + + + item>2 + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFor.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFor.dmn new file mode 100644 index 00000000000..54669c1dbaa --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleFor.dmn @@ -0,0 +1,47 @@ + + + + + + + + [1,2,3] + + + + + itVal+1 + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleQuantified.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleQuantified.dmn new file mode 100644 index 00000000000..5917ce270bb --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/sampleQuantified.dmn @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + [1,2,3] + + + + + x > 0 + + + + + + + + + + [1,2,3] + + + + + x > 0 + + + + + + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/simple.dmn b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/simple.dmn new file mode 100644 index 00000000000..e0f7a9e340c --- /dev/null +++ b/kie-dmn/kie-dmn-backend/src/test/resources/org/kie/dmn/backend/marshalling/v1_5/simple.dmn @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + "Hello, "+name + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java new file mode 100644 index 00000000000..9c17a476005 --- /dev/null +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNTypeRegistryV15.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.core.compiler; + +import org.kie.dmn.api.core.DMNType; +import org.kie.dmn.core.impl.SimpleTypeImpl; +import org.kie.dmn.feel.lang.types.BuiltInType; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +import javax.xml.namespace.QName; +import java.util.Map; + +public class DMNTypeRegistryV15 extends DMNTypeRegistryAbstract { + + private static final DMNType UNKNOWN = new SimpleTypeImpl(KieDMNModelInstrumentedBase.URI_FEEL, + BuiltInType.UNKNOWN.getName(), + null, true, null, null, + BuiltInType.UNKNOWN ); + + public DMNTypeRegistryV15(Map aliases) { + super(aliases); + } + + @Override + public DMNType unknown() { + return UNKNOWN; + } + + @Override + protected String feelNS() { + return KieDMNModelInstrumentedBase.URI_FEEL; + } +} diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java index 4a30c066419..4a15ef4d199 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java @@ -83,6 +83,7 @@ public static ImportType whichImportType(Import _import) { case org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN: case org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN: case org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN: + case org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_DMN: return ImportType.DMN; case NamespaceConsts.PMML_3_0: case NamespaceConsts.PMML_3_1: diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java index d16dc55d9f4..fafcb18b5df 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNModelImpl.java @@ -64,6 +64,7 @@ import org.kie.dmn.core.compiler.DMNTypeRegistryV12; import org.kie.dmn.core.compiler.DMNTypeRegistryV13; import org.kie.dmn.core.compiler.DMNTypeRegistryV14; +import org.kie.dmn.core.compiler.DMNTypeRegistryV15; import org.kie.dmn.core.pmml.DMNImportPMMLInfo; import org.kie.dmn.core.util.DefaultDMNMessagesManager; import org.kie.dmn.model.api.DMNModelInstrumentedBase; @@ -124,8 +125,10 @@ private void wireTypeRegistry(Definitions definitions) { types = new DMNTypeRegistryV12(Collections.unmodifiableMap(importAliases)); } else if (definitions instanceof org.kie.dmn.model.v1_3.TDefinitions) { types = new DMNTypeRegistryV13(Collections.unmodifiableMap(importAliases)); - } else { + } else if (definitions instanceof org.kie.dmn.model.v1_4.TDefinitions) { types = new DMNTypeRegistryV14(Collections.unmodifiableMap(importAliases)); + } else { + types = new DMNTypeRegistryV15(Collections.unmodifiableMap(importAliases)); } } diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/typesafe/DMNTypeUtils.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/typesafe/DMNTypeUtils.java index e04f2a4dd34..b177ba51b7b 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/typesafe/DMNTypeUtils.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/typesafe/DMNTypeUtils.java @@ -36,7 +36,8 @@ public static boolean isFEELBuiltInType(DMNType dmnType) { return dmnType.getNamespace().equals(org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_FEEL) || dmnType.getNamespace().equals(org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_FEEL) || dmnType.getNamespace().equals(org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_FEEL) || - dmnType.getNamespace().equals(org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_FEEL) + dmnType.getNamespace().equals(org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_FEEL) || + dmnType.getNamespace().equals(org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_FEEL) ; } diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java index fc4344da9f3..b3c8d02b027 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNInputRuntimeTest.java @@ -294,7 +294,7 @@ public void testDMNInputDataNodeTypeTest() { // DROOLS-1569 final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("DMNInputDataNodeTypeTest.dmn", this.getClass()); final String MODEL_NAMESPACE = "http://www.trisotech.com/definitions/_17396034-163a-48aa-9a7f-c6eb17f9cc6c"; - final String FEEL_NAMESPACE = org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_FEEL; + final String FEEL_NAMESPACE = org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_FEEL; final DMNModel dmnModel = runtime.getModel(MODEL_NAMESPACE, "DMNInputDataNodeTypeTest"); assertThat(dmnModel).isNotNull(); assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNStronglyTypedSupportTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNStronglyTypedSupportTest.java index 61df43f1f47..24dc9de7b42 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNStronglyTypedSupportTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNStronglyTypedSupportTest.java @@ -70,7 +70,7 @@ public void testDMNInputDataNodeTypeTest() { // DROOLS-1569 final DMNRuntime runtime = createRuntime("DMNInputDataNodeTypeTest.dmn", this.getClass()); final String MODEL_NAMESPACE = "http://www.trisotech.com/definitions/_17396034-163a-48aa-9a7f-c6eb17f9cc6c"; - final String FEEL_NAMESPACE = org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_FEEL; + final String FEEL_NAMESPACE = org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_FEEL; final DMNModel dmnModel = runtime.getModel(MODEL_NAMESPACE, "DMNInputDataNodeTypeTest"); assertThat(dmnModel).isNotNull(); assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNTypeTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNTypeTest.java index c14427732cd..3c603b87836 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNTypeTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNTypeTest.java @@ -26,12 +26,12 @@ import org.junit.Test; import org.kie.dmn.api.core.DMNType; import org.kie.dmn.core.compiler.DMNTypeRegistry; -import org.kie.dmn.core.compiler.DMNTypeRegistryV11; +import org.kie.dmn.core.compiler.DMNTypeRegistryV15; import org.kie.dmn.core.impl.CompositeTypeImpl; import org.kie.dmn.core.impl.SimpleTypeImpl; import org.kie.dmn.feel.FEEL; import org.kie.dmn.feel.lang.types.BuiltInType; -import org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; import static org.assertj.core.api.Assertions.assertThat; import static org.kie.dmn.core.util.DynamicTypeUtils.entry; @@ -39,7 +39,7 @@ public class DMNTypeTest { - private static final DMNTypeRegistry typeRegistry = new DMNTypeRegistryV11(Collections.emptyMap()); + private static final DMNTypeRegistry typeRegistry = new DMNTypeRegistryV15(Collections.emptyMap()); private static final DMNType FEEL_STRING = typeRegistry.resolveType(KieDMNModelInstrumentedBase.URI_FEEL, "string"); private static final DMNType FEEL_NUMBER = typeRegistry.resolveType(KieDMNModelInstrumentedBase.URI_FEEL, "number"); diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/incrementalcompilation/WBCompilationTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/incrementalcompilation/WBCompilationTest.java index c98f39803d6..91a77f011b3 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/incrementalcompilation/WBCompilationTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/incrementalcompilation/WBCompilationTest.java @@ -34,7 +34,7 @@ public class WBCompilationTest { static final String DMN_1 = "\n" + - "\n" + + "\n" + " \n" + " \n" + " \n" + @@ -65,9 +65,9 @@ public class WBCompilationTest { ""; static final String DMN_2 = "\n" + - "\n" + + "\n" + " \n" + - " \n" + + " \n" + " \n" + " \n" + " \n" + diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/stronglytyped/JavadocTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/stronglytyped/JavadocTest.java index b6274a70165..e6c0af2648b 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/stronglytyped/JavadocTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/stronglytyped/JavadocTest.java @@ -69,67 +69,67 @@ public void testDateAndTime() throws Exception { String inputSet = sourceMap.get("InputSet"); CompilationUnit cu = StaticJavaParser.parse(inputSet); - assertJavadoc(cu, "dateTimeString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "Timezone", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "oneHour", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); - assertJavadoc(cu, "Month", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Year", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Hours", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "timeString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "dateString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "Seconds", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Day", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Minutes", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "durationString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); + assertJavadoc(cu, "dateTimeString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "Timezone", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "oneHour", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); + assertJavadoc(cu, "Month", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Year", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Hours", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "timeString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "dateString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "Seconds", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Day", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Minutes", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "durationString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); String outputSet = sourceMap.get("OutputSet"); cu = StaticJavaParser.parse(outputSet); - assertJavadoc(cu, "Timezone", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "Date_45Time", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : date and time }"); - assertJavadoc(cu, "Hours", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Time", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : time }"); - assertJavadoc(cu, "Minutes", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Date_45Time2", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : date and time }"); - assertJavadoc(cu, "years", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "dateTimeString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "oneHour", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); - assertJavadoc(cu, "d1seconds", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Month", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "cDay", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "sumDurations", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); - assertJavadoc(cu, "cYear", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "cSecond", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "dateString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "cTimezone", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "durationString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "cHour", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Year", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Time2", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : time }"); - assertJavadoc(cu, "timeString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : string }"); - assertJavadoc(cu, "Time3", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : time }"); - assertJavadoc(cu, "hoursInDuration", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "dtDuration1", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); - assertJavadoc(cu, "Seconds", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "dtDuration2", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); - assertJavadoc(cu, "Day", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "cMonth", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "cMinute", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "ymDuration2", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : days and time duration }"); + assertJavadoc(cu, "Timezone", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "Date_45Time", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : date and time }"); + assertJavadoc(cu, "Hours", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Time", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : time }"); + assertJavadoc(cu, "Minutes", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Date_45Time2", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : date and time }"); + assertJavadoc(cu, "years", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "dateTimeString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "oneHour", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); + assertJavadoc(cu, "d1seconds", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Month", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "cDay", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "sumDurations", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); + assertJavadoc(cu, "cYear", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "cSecond", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "dateString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "cTimezone", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "durationString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "cHour", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Year", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Time2", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : time }"); + assertJavadoc(cu, "timeString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : string }"); + assertJavadoc(cu, "Time3", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : time }"); + assertJavadoc(cu, "hoursInDuration", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "dtDuration1", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); + assertJavadoc(cu, "Seconds", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "dtDuration2", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); + assertJavadoc(cu, "Day", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "cMonth", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "cMinute", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "ymDuration2", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : days and time duration }"); String tDateVariants = sourceMap.get("TDateVariants"); cu = StaticJavaParser.parse(tDateVariants); - assertJavadoc(cu, "fromString", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : date }"); - assertJavadoc(cu, "fromDateTime", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : date }"); - assertJavadoc(cu, "fromYearMonthDay", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : date }"); + assertJavadoc(cu, "fromString", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : date }"); + assertJavadoc(cu, "fromDateTime", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : date }"); + assertJavadoc(cu, "fromYearMonthDay", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : date }"); String tDateTimeComponents = sourceMap.get("TDateTimeComponents"); cu = StaticJavaParser.parse(tDateTimeComponents); - assertJavadoc(cu, "Year", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Month", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Day", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Hour", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Minute", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); - assertJavadoc(cu, "Second", "DMNType{ http://www.omg.org/spec/DMN/20180521/FEEL/ : number }"); + assertJavadoc(cu, "Year", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Month", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Day", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Hour", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Minute", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); + assertJavadoc(cu, "Second", "DMNType{ https://www.omg.org/spec/DMN/20230324/FEEL/ : number }"); } private void assertJavadoc(CompilationUnit cu, String field, String expectedJavadocComment) { diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-filter.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-filter.dmn index aa3d69a4a4c..121f91344f3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-filter.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-filter.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-artificial-attributes.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-artificial-attributes.dmn index 7b469557024..3544d1fabbd 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-artificial-attributes.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-artificial-attributes.dmn @@ -17,10 +17,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-itIT.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-itIT.dmn index d2a600ef5f1..d5f25c09978 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-itIT.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string-itIT.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string.dmn index 9a178f59d0e..10daebf1314 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0001-input-data-string.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number-scientific-notation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number-scientific-notation.dmn index 82b075cdd61..54b84a8c86d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number-scientific-notation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number-scientific-notation.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number.dmn index ed5919beef0..1318dcb01ca 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0002-input-data-number.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0003-input-data-string-allowed-values.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0003-input-data-string-allowed-values.dmn index 9fe78a6b3fb..aa736d23ed4 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0003-input-data-string-allowed-values.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0003-input-data-string-allowed-values.dmn @@ -17,10 +17,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0004-lending.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0004-lending.dmn index 9bae4202045..658400c75f6 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0004-lending.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0004-lending.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-bad-example.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-bad-example.dmn index 8429b2657fa..66d0e2eb1df 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-bad-example.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-bad-example.dmn @@ -2,10 +2,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-singleton-lists.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-singleton-lists.dmn index 00eda8d27e0..6432b57499c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-singleton-lists.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-singleton-lists.dmn @@ -2,10 +2,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-uninterpreted.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-uninterpreted.dmn index 1b894dab66c..46279e8678f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-uninterpreted.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0019-flight-rebooking-uninterpreted.dmn @@ -2,10 +2,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0020-vacation-days.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0020-vacation-days.dmn index a9b6534e5e5..99defc06568 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0020-vacation-days.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/0020-vacation-days.dmn @@ -2,10 +2,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/20180731-pr1997.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/20180731-pr1997.dmn index 60d66fd017b..254b6a5a9e3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/20180731-pr1997.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/20180731-pr1997.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Collect_Hit_Policy.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Collect_Hit_Policy.dmn index 6d7d8566d27..f2c9e8b02da 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Collect_Hit_Policy.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Collect_Hit_Policy.dmn @@ -2,10 +2,10 @@ - + - + date and time("2019-01-01T01:00-09:00").time offset.hours @@ -17,7 +17,7 @@ - + Date and Time Variable.time offset.hours @@ -28,7 +28,7 @@ - + time("19:00:00-11:00").time offset.hours @@ -40,7 +40,7 @@ - + Time Variable.time offset.hours diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DMNInputDataNodeTypeTest.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DMNInputDataNodeTypeTest.dmn index 26027b63e01..21e76d39a43 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DMNInputDataNodeTypeTest.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DMNInputDataNodeTypeTest.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DTABLE_NON_PRIORITY_MISSING_OUTVALS.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DTABLE_NON_PRIORITY_MISSING_OUTVALS.dmn index 4ede5818d69..0ad97abe0b7 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DTABLE_NON_PRIORITY_MISSING_OUTVALS.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/DTABLE_NON_PRIORITY_MISSING_OUTVALS.dmn @@ -15,9 +15,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Decide with symbols.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Decide with symbols.dmn index 61153311234..7210877831c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Decide with symbols.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Decide with symbols.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Dinner.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Dinner.dmn index 9e3ad7ddfba..367b735ff04 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Dinner.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Dinner.dmn @@ -2,10 +2,10 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Ex_4_3simplified.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Ex_4_3simplified.dmn index 9e55b38fdad..481dfcccb98 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Ex_4_3simplified.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Ex_4_3simplified.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/First DT not stopping.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/First DT not stopping.dmn index 4407501e291..34a7cae9d55 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/First DT not stopping.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/First DT not stopping.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/FunctionDefinition.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/FunctionDefinition.dmn index e1b1b843d17..7b819b8cefa 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/FunctionDefinition.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/FunctionDefinition.dmn @@ -17,10 +17,10 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/List_of_Vowels.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/List_of_Vowels.dmn index e4482c827d3..2b491fb8b1c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/List_of_Vowels.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/List_of_Vowels.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/OpInNames2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/OpInNames2.dmn index 1701a95a140..6f3750b5a58 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/OpInNames2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/OpInNames2.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Order.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Order.dmn index 36209878d73..14b088fb47b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Order.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Order.dmn @@ -1,5 +1,5 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/PersonListHelloBKM.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/PersonListHelloBKM.dmn index 0a811e802fa..2128248528d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/PersonListHelloBKM.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/PersonListHelloBKM.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/RecommenderHitPolicy1_allowNull_itemDef.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/RecommenderHitPolicy1_allowNull_itemDef.dmn index 5d0933e0efc..bf959f7956a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/RecommenderHitPolicy1_allowNull_itemDef.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/RecommenderHitPolicy1_allowNull_itemDef.dmn @@ -1,5 +1,5 @@ - + number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Recursive.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Recursive.dmn index ab80decfa6a..334883185c6 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Recursive.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Recursive.dmn @@ -17,10 +17,10 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Table61ForAliasFeelType.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Table61ForAliasFeelType.dmn index eb8ea9e8572..29cca27d7c9 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Table61ForAliasFeelType.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Table61ForAliasFeelType.dmn @@ -1,4 +1,4 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/TimeFromDate.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/TimeFromDate.dmn index 4a955361bb5..d004a265053 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/TimeFromDate.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/TimeFromDate.dmn @@ -2,10 +2,10 @@ - diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Union_of_letters.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Union_of_letters.dmn index d92dc0e776f..32c0aee8050 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Union_of_letters.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/Union_of_letters.dmn @@ -2,9 +2,9 @@ - + @@ -20,7 +20,7 @@ - + { m: <<18 }.m(16) @@ -32,7 +32,7 @@ - + { m: <18 }.m(16) diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/WrongConstraintsInItemDefinition.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/WrongConstraintsInItemDefinition.dmn index eb803a27eca..8ae2d3c73cd 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/WrongConstraintsInItemDefinition.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/WrongConstraintsInItemDefinition.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/alphasupport.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/alphasupport.dmn index 9b36e5d206d..1c70fc5885a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/alphasupport.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/alphasupport.dmn @@ -1,5 +1,5 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/an-simpletable-multipletests.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/an-simpletable-multipletests.dmn index 686b2f24154..9b8a907d1b3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/an-simpletable-multipletests.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/alphanetwork/an-simpletable-multipletests.dmn @@ -30,9 +30,9 @@ + xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"> - + @@ -28,6 +28,6 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/anot.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/anot.dmn index a4904c147a9..d15354e616c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/anot.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/anot.dmn @@ -2,9 +2,9 @@ - + string @@ -8,7 +8,7 @@ "Hello World" - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub1.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub1.dmn index cea52baac68..c8acd0e902d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub1.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub1.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub2.dmn index a2bb46a8a17..b1ca43765d6 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/arithmeticSub2.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/assignNullToAllowedValues.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/assignNullToAllowedValues.dmn index a7e3629bae8..bf23dfeb758 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/assignNullToAllowedValues.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/assignNullToAllowedValues.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/bkmWithDotsInName.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/bkmWithDotsInName.dmn index 36d1b9997bb..4c597f551a5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/bkmWithDotsInName.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/bkmWithDotsInName.dmn @@ -1,5 +1,5 @@ - + model to help test https://issues.redhat.com/browse/DROOLS-5314 diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/business-knowledge-model-required-input.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/business-knowledge-model-required-input.dmn index 08146173bba..2ce2d0b3146 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/business-knowledge-model-required-input.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/business-knowledge-model-required-input.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/cItemDef.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/cItemDef.dmn index e4c787416d3..00c5d111433 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/cItemDef.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/cItemDef.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/calculation1.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/calculation1.dmn index 50705667fae..30d542895e5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/calculation1.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/calculation1.dmn @@ -2,10 +2,10 @@ - + number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Greetings.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Greetings.dmn index 570af623dc8..201b573f472 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Greetings.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Greetings.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Standard Deviation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Standard Deviation.dmn index 32f846b0f7a..e8ef9133a23 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Standard Deviation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/Standard Deviation.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/invokeJavaReturnArrayPrimitives.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/invokeJavaReturnArrayPrimitives.dmn index fd16bb675e7..c3da44560cc 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/invokeJavaReturnArrayPrimitives.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/invokeJavaReturnArrayPrimitives.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/license.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/license.dmn index fdb37df9765..380af12b319 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/license.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/license.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL.dmn index f93509f51b3..d0a25e162ca 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL2.dmn index c7a8d5f6221..f478f19af77 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/personCL2.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/sumWithBKM.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/sumWithBKM.dmn index e28419f51d9..da6cb75cd21 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/sumWithBKM.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/classloader/sumWithBKM.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compilationThrowsNPE.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compilationThrowsNPE.dmn index 8cd99993e9a..ebbaffbc1c1 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compilationThrowsNPE.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compilationThrowsNPE.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/customModelCount.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/customModelCount.dmn index 8d54cef7c5d..a616c576e73 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/customModelCount.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/customModelCount.dmn @@ -1,8 +1,8 @@ - + - + customModelCount() diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/just_47.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/just_47.dmn index 6fb402e7ad1..d5eb166dbfd 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/just_47.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/compiler/profiles/just_47.dmn @@ -2,9 +2,9 @@ \ No newline at end of file + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSWithImportRequiredInput20180920.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSWithImportRequiredInput20180920.dmn index 83ab8868e55..6e1df39e5d9 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSWithImportRequiredInput20180920.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSWithImportRequiredInput20180920.dmn @@ -1,9 +1,9 @@ - + [] - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DStypecheck.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DStypecheck.dmn index 2f5fd6c66ec..c9aca762998 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DStypecheck.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DStypecheck.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSxy.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSxy.dmn index 1acd1d5553c..47a8e1158a3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSxy.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/DSxy.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/Decision-Services-singleton-or-multiple-output-decisions.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/Decision-Services-singleton-or-multiple-output-decisions.dmn index 0fade0b26a0..04b46407967 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/Decision-Services-singleton-or-multiple-output-decisions.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/Decision-Services-singleton-or-multiple-output-decisions.dmn @@ -2,9 +2,9 @@ + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004bkmBoxedInvocation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004bkmBoxedInvocation.dmn index 51a8bee21f6..288df90cdef 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004bkmBoxedInvocation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004bkmBoxedInvocation.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004boxedInvocation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004boxedInvocation.dmn index f05c2c19b4e..f078efbc712 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004boxedInvocation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importing0004boxedInvocation.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDS.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDS.dmn index dd63b194d92..1fe835eb181 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDS.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDS.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSbkmBoxedInvocation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSbkmBoxedInvocation.dmn index 0a6e94d496a..81dafa58037 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSbkmBoxedInvocation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSbkmBoxedInvocation.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSboxedInvocation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSboxedInvocation.dmn index 08e45b1113f..91647310064 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSboxedInvocation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/importingMyHelloDSboxedInvocation.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/mixtype-DS.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/mixtype-DS.dmn index 26a66b96a8f..9d4c65d236a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/mixtype-DS.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisionservices/mixtype-DS.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable-default-value.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable-default-value.dmn index f1db4d2ac32..b7a0b1f9e15 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable-default-value.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable-default-value.dmn @@ -30,9 +30,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable/dtevent.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable/dtevent.dmn index 8360584244f..20178f5d23f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable/dtevent.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/decisiontable/dtevent.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/dmcommunity_challenge_2017_03.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/dmcommunity_challenge_2017_03.dmn index a90577ddad7..ffda1f0b0cf 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/dmcommunity_challenge_2017_03.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/dmcommunity_challenge_2017_03.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools1502-noprefix.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools1502-noprefix.dmn index 730f9fea941..40d13b9516f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools1502-noprefix.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools1502-noprefix.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools2125.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools2125.dmn index bc80b22d418..617e800aeb9 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools2125.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/drools2125.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/duplicate.0001-input-data-string.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/duplicate.0001-input-data-string.dmn index 9a178f59d0e..10daebf1314 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/duplicate.0001-input-data-string.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/duplicate.0001-input-data-string.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/empty_decision.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/empty_decision.dmn index 7c0739dfd55..5546a8cadeb 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/empty_decision.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/empty_decision.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/exceptionInContextEntry.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/exceptionInContextEntry.dmn index 93e63e597b2..0953697f00c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/exceptionInContextEntry.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/exceptionInContextEntry.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Y.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Y.dmn index 093733e2df7..8b7fb6a267f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Y.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Y.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Yboxed.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Yboxed.dmn index 524b8219f77..8cf5bdbad4a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Yboxed.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/Yboxed.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/basicRecursion.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/basicRecursion.dmn index 3a702d8735b..129422c4d7c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/basicRecursion.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/extra/basicRecursion.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/forTypeCheckTest.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/forTypeCheckTest.dmn index 95cdad6ff34..32439dc933b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/forTypeCheckTest.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/forTypeCheckTest.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn index c60143d047f..5ba2839631e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/hardcoded_function_definition.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/hardcoded_function_definition.dmn index 98862e44a47..7b7fd057106 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/hardcoded_function_definition.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/hardcoded_function_definition.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModel.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModel.dmn index 2512487b07d..212567e6001 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModel.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModel.dmn @@ -1,5 +1,5 @@ - + Returns true if first argument was bigger than second. False otherwise. diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModelNamedWithDots.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModelNamedWithDots.dmn index cf669a79659..34a2a04723b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModelNamedWithDots.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/ComparatorModelNamedWithDots.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Do_invoke_hello_with_2_bkms.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Do_invoke_hello_with_2_bkms.dmn index e43cfaeef15..ef7b234ae51 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Do_invoke_hello_with_2_bkms.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Do_invoke_hello_with_2_bkms.dmn @@ -2,10 +2,10 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_ComparatorModel_and_alias_with_dots.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_ComparatorModel_and_alias_with_dots.dmn index 55dc214bf57..1f96cf76028 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_ComparatorModel_and_alias_with_dots.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_ComparatorModel_and_alias_with_dots.dmn @@ -1,7 +1,7 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_Spell_Greeting.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_Spell_Greeting.dmn index e93541c7655..5676e125bf4 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_Spell_Greeting.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/Import_Spell_Greeting.dmn @@ -2,10 +2,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/L3_Do_say_hello.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/L3_Do_say_hello.dmn index 6af2509738a..7c01756170a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/L3_Do_say_hello.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/L3_Do_say_hello.dmn @@ -2,11 +2,11 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/baseSum.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/baseSum.dmn index 4fff4c31488..f96ddb0204c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/baseSum.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/baseSum.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/importingSum.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/importingSum.dmn index 1b3d9ec7a34..22efbba8c3f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/importingSum.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/importingSum.dmn @@ -1,6 +1,6 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof base model.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof base model.dmn index 553668f7e40..40977f0d67c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof base model.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof base model.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof checks.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof checks.dmn index 06c20e8b474..3ff4875d3ba 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof checks.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/instanceof checks.dmn @@ -1,7 +1,7 @@ - + - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/use join.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/use join.dmn index 4fec1ecd1ca..d693b36383d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/use join.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/imports/use join.dmn @@ -1,7 +1,7 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incomplete_expression.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incomplete_expression.dmn index 4b96f189c85..4a1e940f9c1 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incomplete_expression.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incomplete_expression.dmn @@ -2,9 +2,9 @@ - + - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-100/air-conditioning-data-types.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-100/air-conditioning-data-types.dmn index 7da208f1de0..b2c211d236a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-100/air-conditioning-data-types.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-100/air-conditioning-data-types.dmn @@ -1,5 +1,5 @@ - + number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-control.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-control.dmn index 480ced8e2ea..6d510e1f6fb 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-control.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-control.dmn @@ -1,7 +1,7 @@ - + - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-data-types.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-data-types.dmn index 7da208f1de0..b2c211d236a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-data-types.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/import-itemdef-101/air-conditioning-data-types.dmn @@ -1,5 +1,5 @@ - + number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/v1/20180731-pr1997.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/v1/20180731-pr1997.dmn index 60d66fd017b..254b6a5a9e3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/v1/20180731-pr1997.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/incrementalcompilation/v1/20180731-pr1997.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/comparablePeriod.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/comparablePeriod.dmn index 60215869c33..a8ae7504e47 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/comparablePeriod.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/comparablePeriod.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/numberRESTinLIST.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/numberRESTinLIST.dmn index 84c58419c6c..5dd905eadb5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/numberRESTinLIST.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/internal/utils/numberRESTinLIST.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invalid-variable-names.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invalid-variable-names.dmn index 45089eec591..3a3bcc87be9 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invalid-variable-names.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invalid-variable-names.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokeJavaReturnArray.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokeJavaReturnArray.dmn index 1071a3e8c18..91784eb3b20 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokeJavaReturnArray.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokeJavaReturnArray.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokingAFunctionOnALiteralContext.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokingAFunctionOnALiteralContext.dmn index 656b1542441..04fc4df4b37 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokingAFunctionOnALiteralContext.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/invokingAFunctionOnALiteralContext.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDef-dependency.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDef-dependency.dmn index 4e92eebadbe..4f57cd52055 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDef-dependency.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDef-dependency.dmn @@ -2,9 +2,9 @@ + xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"> string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDefXmlns_model.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDefXmlns_model.dmn index 3dca7139692..f5635279f5b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDefXmlns_model.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/itemDefXmlns_model.dmn @@ -1,6 +1,6 @@ + xmlns:dmn="https://www.omg.org/spec/DMN/20230324/MODEL/"> string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javaPojoCharUtilDate.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javaPojoCharUtilDate.dmn index 2ec083c80bc..0d3a3db44d1 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javaPojoCharUtilDate.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javaPojoCharUtilDate.dmn @@ -1,5 +1,5 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/java_function_context.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/java_function_context.dmn index 434508584b3..b097340d61f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/java_function_context.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/java_function_context.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocInnerComposite.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocInnerComposite.dmn index 24e0cce5fb1..caac1080e86 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocInnerComposite.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocInnerComposite.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocSimple.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocSimple.dmn index 56569100868..b9c04b77841 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocSimple.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/javadocSimple.dmn @@ -1,4 +1,4 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/just_now.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/just_now.dmn index 06c8a617ea0..e5026bd7ae1 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/just_now.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/just_now.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/list_containment_DT.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/list_containment_DT.dmn index d5aeef5a6de..bb49300c4a6 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/list_containment_DT.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/list_containment_DT.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nestingFnDef.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nestingFnDef.dmn index bdeecaef825..84cad3bef35 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nestingFnDef.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nestingFnDef.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/noExpr.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/noExpr.dmn index 52d6617bb93..1aa9508a943 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/noExpr.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/noExpr.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notInvocable.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notInvocable.dmn index dc3111c8b57..661d9e6d915 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notInvocable.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notInvocable.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notypecheck/sqrtstring.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notypecheck/sqrtstring.dmn index fd3604ef971..4ff2c4e1683 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notypecheck/sqrtstring.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/notypecheck/sqrtstring.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nowGT1970.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nowGT1970.dmn index 203f9fd00ac..8f44c830b8e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nowGT1970.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nowGT1970.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/null_values.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/null_values.dmn index 742542aed38..123201c70b0 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/null_values.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/null_values.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nullrelation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nullrelation.dmn index 1da467b9648..dc5a4a57199 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nullrelation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/nullrelation.dmn @@ -3,8 +3,8 @@ xmlns:dc="http://www.omg.org/spec/DMN/20151101/DC" xmlns:di="http://www.omg.org/spec/DMN/20151101/DI" xmlns:dmndi="http://www.omg.org/spec/DMN/20151101/DMNDI" - xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" - xmlns:semantic="http://www.omg.org/spec/DMN/20180521/MODEL/" + xmlns:feel="https://www.omg.org/spec/DMN/20230324/FEEL/" + xmlns:semantic="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:tc="http://www.omg.org/spec/DMN/20160719/testcase" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/out-of-order-items.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/out-of-order-items.dmn index 63b23b64026..31279892151 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/out-of-order-items.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/out-of-order-items.dmn @@ -17,10 +17,10 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/personInReq1.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/personInReq1.dmn index 6c6e5468d1c..c0f54389c61 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/personInReq1.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/personInReq1.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree.dmn index 4f50f4a1822..d35fe32ec52 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree_no_output.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree_no_output.dmn index 1167d936283..516a7516c28 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree_no_output.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml/KiePMMLNewTree_no_output.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml_function_context.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml_function_context.dmn index 7121e4b6931..774733f7f0c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml_function_context.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/pmml_function_context.dmn @@ -2,9 +2,9 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/questionmarkunarytest/qmarkMultivalue.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/questionmarkunarytest/qmarkMultivalue.dmn index 4b285d72a19..379575c03fc 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/questionmarkunarytest/qmarkMultivalue.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/questionmarkunarytest/qmarkMultivalue.dmn @@ -17,9 +17,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/relation_with_empty_cell.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/relation_with_empty_cell.dmn index 8363a5b520d..c0eb0f046fb 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/relation_with_empty_cell.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/relation_with_empty_cell.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/singletonlist_fuction_call.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/singletonlist_fuction_call.dmn index e1f242bf29f..5497b8ed95a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/singletonlist_fuction_call.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/singletonlist_fuction_call.dmn @@ -2,9 +2,9 @@ +xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"> number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/strictMode.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/strictMode.dmn index 685cd007e08..d9a3bd00f4e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/strictMode.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/strictMode.dmn @@ -2,10 +2,10 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/NSEW.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/NSEW.dmn index 3112b9b61b4..8b8bc24502f 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/NSEW.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/NSEW.dmn @@ -1,4 +1,4 @@ - + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/OneOfEachType.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/OneOfEachType.dmn index b08363988a8..95b02885c95 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/OneOfEachType.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/OneOfEachType.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn index 109d4689e12..b24fed0d258 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/Traffic Violation.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/a.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/a.dmn index a01314cd630..b0657264b13 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/a.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/a.dmn @@ -1,5 +1,5 @@ - + @@ -42,7 +42,7 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflict.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflict.dmn index 9f870d9073c..7f2cb95ea53 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflict.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflict.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictItemDef.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictItemDef.dmn index 63d25bb39c9..f3bd4062113 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictItemDef.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictItemDef.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictWithInputAndDecision.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictWithInputAndDecision.dmn index 93d2bbada47..db72bb1bb08 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictWithInputAndDecision.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/capitalLetterConflictWithInputAndDecision.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_imported.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_imported.dmn index f408e1172b5..093077c9f88 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_imported.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_imported.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_importing.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_importing.dmn index 901e24c34ae..330e1f3cec0 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_importing.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/class_importing.dmn @@ -1,7 +1,7 @@ - + - + string @@ -18,7 +18,7 @@ - + imported class.L1name + imported class.class.L2name + class.name diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collections.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collections.dmn index d7f95477f38..d5db53bfdb3 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collections.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collections.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collectionsPassTypedObject.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collectionsPassTypedObject.dmn index 994109f5e8a..79e4b413662 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collectionsPassTypedObject.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/collectionsPassTypedObject.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/duplicateName.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/duplicateName.dmn index 295a8fd3641..55c7f43e6a5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/duplicateName.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/duplicateName.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/fixInnerComposite.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/fixInnerComposite.dmn index 1d4b0195ef5..d56dced714c 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/fixInnerComposite.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/fixInnerComposite.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerComposite.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerComposite.dmn index 8a6363420ba..e790591bc3e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerComposite.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerComposite.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerCompositeCollection.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerCompositeCollection.dmn index 9146e328e0a..072944d26f6 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerCompositeCollection.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/innerCompositeCollection.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/inputAny.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/inputAny.dmn index 4f7bafbcde0..b37446dac63 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/inputAny.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/inputAny.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/javaKeywords.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/javaKeywords.dmn index beff850c68c..3b85f95ee89 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/javaKeywords.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/javaKeywords.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/listBasic.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/listBasic.dmn index a898a890279..d1d5ee9930d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/listBasic.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/listBasic.dmn @@ -1,4 +1,4 @@ - + number diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/nextDays.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/nextDays.dmn index b6476ce3157..a9c54cb0a08 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/nextDays.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/nextDays.dmn @@ -1,4 +1,4 @@ - + date diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/recursiveEmployee.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/recursiveEmployee.dmn index 78d05e0030e..ac7ac1f4acc 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/recursiveEmployee.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/recursiveEmployee.dmn @@ -1,5 +1,5 @@ - + string @@ -25,7 +25,7 @@ - + "reports to " + an Employee.manager.full name diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/shareTypeForInputAndOutput.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/shareTypeForInputAndOutput.dmn index e462dee991f..ced5531659a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/shareTypeForInputAndOutput.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/shareTypeForInputAndOutput.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfCol.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfCol.dmn index a1fb348fd03..140fd70ef25 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfCol.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfCol.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfColOfCol.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfColOfCol.dmn index a3c01ca8967..00013059ca5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfColOfCol.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelColOfColOfCol.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelCompositeCollection.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelCompositeCollection.dmn index ae1545921c0..b25c2ac9d57 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelCompositeCollection.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/stronglytyped/topLevelCompositeCollection.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/structure-containtment.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/structure-containtment.dmn index 19ee93f2a91..c21bfbe7f3a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/structure-containtment.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/structure-containtment.dmn @@ -1,5 +1,5 @@ - + tEmployee diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/test20180601.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/test20180601.dmn index 34bbd15764f..920f3f4b3a8 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/test20180601.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/test20180601.dmn @@ -2,9 +2,9 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/testHyphenInPropertyOfCollectionForAccessorMultiple.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/testHyphenInPropertyOfCollectionForAccessorMultiple.dmn index 9f4d653685f..cd7d37b9908 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/testHyphenInPropertyOfCollectionForAccessorMultiple.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/testHyphenInPropertyOfCollectionForAccessorMultiple.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/today_function_test.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/today_function_test.dmn index 4a87b332498..81d2db087f9 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/today_function_test.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/today_function_test.dmn @@ -2,10 +2,10 @@ + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType2.dmn index de4046275df..10585d7a5e2 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType2.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType3.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType3.dmn index 80f7ac0a01c..0dbe3f84373 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType3.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType3.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType4.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType4.dmn index 0a54329a9a8..5cd32905168 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType4.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/bkmWrongFnType4.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/circular3.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/circular3.dmn index 3cd4c876bb3..a520ed1c005 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/circular3.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/circular3.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType.dmn index bf8bf36fa44..ad0334e3d2a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType2.dmn index d5c52812e34..f8acef87f3e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType2.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType3.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType3.dmn index 273ff371017..8e28351b04e 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType3.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType3.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType4.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType4.dmn index 7f62a093571..a97e804c944 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType4.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType4.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType5.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType5.dmn index 3e0f0737a57..67c504f51a7 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType5.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType5.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType6.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType6.dmn index 3955afdec93..039e8882dbf 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType6.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType6.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType7.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType7.dmn index 71d949247ad..66564732edb 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType7.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/dsWrongFnType7.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType1.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType1.dmn index c895578d327..f7a210f044d 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType1.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType1.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType2.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType2.dmn index 1702948fc0c..79bdae3b6e5 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType2.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType2.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType3.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType3.dmn index 9abb069f759..98eb88cd7a8 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType3.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/typeref/wireGenFnType3.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/uniqueNoMatch.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/uniqueNoMatch.dmn index 495b7d46ce8..e619318dbba 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/uniqueNoMatch.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/uniqueNoMatch.dmn @@ -3,9 +3,9 @@ xmlns:activiti="http://activiti.org/schema/1.0/dmn" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" - xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" - xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" - xmlns:semantic="http://www.omg.org/spec/DMN/20180521/MODEL/" + xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" + xmlns:feel="https://www.omg.org/spec/DMN/20230324/FEEL/" + xmlns:semantic="https://www.omg.org/spec/DMN/20230324/MODEL/" exporter="dmn-js (https://demo.bpmn.io/dmn)" exporterVersion="6.2.1" id="decision-a2c4d313-1b0c-420e-a6b1-7956f9787ab8" diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/unknown_variable1.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/unknown_variable1.dmn index ded95f55bc0..14b0123b61a 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/unknown_variable1.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/unknown_variable1.dmn @@ -2,9 +2,9 @@ diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_app.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_app.dmn index bc9a2673e2e..4577cc5612b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_app.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_app.dmn @@ -1,7 +1,7 @@ - + - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_route.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_route.dmn index 4f3b24850c4..28c9dadcf43 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_route.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/wbcommonservicesbackend_route.dmn @@ -1,5 +1,5 @@ - + diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/weekday-on-date.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/weekday-on-date.dmn index 2ad348136b4..ede7a38562b 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/weekday-on-date.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/weekday-on-date.dmn @@ -2,9 +2,9 @@ + string diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/yearMonthDuration.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/yearMonthDuration.dmn index 267e5f09153..673980d2385 100644 --- a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/yearMonthDuration.dmn +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/yearMonthDuration.dmn @@ -2,9 +2,9 @@ getItemComponent(); String getTypeLanguage(); diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/api/dmndi/DMNDiagram.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/api/dmndi/DMNDiagram.java index c6072e5a397..80160ddf1cc 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/api/dmndi/DMNDiagram.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/api/dmndi/DMNDiagram.java @@ -23,10 +23,13 @@ public interface DMNDiagram extends Diagram { - public Dimension getSize(); + Dimension getSize(); - public void setSize(Dimension value); + void setSize(Dimension value); - public List getDMNDiagramElement(); + List getDMNDiagramElement(); + Boolean getUseAlternativeInputDataShape(); + + void setUseAlternativeInputDataShape(Boolean value); } diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_1/TItemDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_1/TItemDefinition.java index 9ca8d6664a0..a017354d89b 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_1/TItemDefinition.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_1/TItemDefinition.java @@ -56,6 +56,16 @@ public void setAllowedValues(final UnaryTests value) { this.allowedValues = value; } + @Override + public UnaryTests getTypeConstraint() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setTypeConstraint(UnaryTests value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + @Override public List getItemComponent() { return this.itemComponent; diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/TItemDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/TItemDefinition.java index 2f584fda419..899ca184203 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/TItemDefinition.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/TItemDefinition.java @@ -58,6 +58,16 @@ public void setAllowedValues(UnaryTests value) { this.allowedValues = value; } + @Override + public UnaryTests getTypeConstraint() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setTypeConstraint(UnaryTests value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + @Override public List getItemComponent() { if (itemComponent == null) { diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/dmndi/DMNDiagram.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/dmndi/DMNDiagram.java index 5afed613ea2..2de314d38e0 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/dmndi/DMNDiagram.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_2/dmndi/DMNDiagram.java @@ -83,4 +83,14 @@ public List getDMNDiagramElement() { return this.dmnDiagramElement; } + @Override + public Boolean getUseAlternativeInputDataShape() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setUseAlternativeInputDataShape(Boolean value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + } diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/TItemDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/TItemDefinition.java index 06c02feee28..347847b2597 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/TItemDefinition.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/TItemDefinition.java @@ -59,6 +59,16 @@ public void setAllowedValues(UnaryTests value) { this.allowedValues = value; } + @Override + public UnaryTests getTypeConstraint() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setTypeConstraint(UnaryTests value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + @Override public List getItemComponent() { if (itemComponent == null) { diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/dmndi/DMNDiagram.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/dmndi/DMNDiagram.java index 56c12fed1f6..375435be744 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/dmndi/DMNDiagram.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_3/dmndi/DMNDiagram.java @@ -83,4 +83,14 @@ public List getDMNDiagramElement() { return this.dmnDiagramElement; } + @Override + public Boolean getUseAlternativeInputDataShape() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setUseAlternativeInputDataShape(Boolean value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + } diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_4/TItemDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_4/TItemDefinition.java index c3d11455279..1e414aa0768 100644 --- a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_4/TItemDefinition.java +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_4/TItemDefinition.java @@ -59,6 +59,16 @@ public void setAllowedValues(UnaryTests value) { this.allowedValues = value; } + @Override + public UnaryTests getTypeConstraint() { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + + @Override + public void setTypeConstraint(UnaryTests value) { + throw new UnsupportedOperationException("Since DMNv1.5"); + } + @Override public List getItemComponent() { if (itemComponent == null) { diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/KieDMNModelInstrumentedBase.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/KieDMNModelInstrumentedBase.java new file mode 100644 index 00000000000..eb71defa15d --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/KieDMNModelInstrumentedBase.java @@ -0,0 +1,159 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNModelInstrumentedBase; +import org.kie.dmn.model.api.RowLocation; + +import javax.xml.namespace.QName; +import javax.xml.stream.Location; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +public abstract class KieDMNModelInstrumentedBase implements DMNModelInstrumentedBase { + + public static final String URI_DMN = "https://www.omg.org/spec/DMN/20230324/MODEL/"; + public static final String URI_FEEL = "https://www.omg.org/spec/DMN/20230324/FEEL/"; + + public static final String URI_KIE = "https://www.drools.org/kie/dmn/1.5"; + public static final String URI_DMNDI = "https://www.omg.org/spec/DMN/20230324/DMNDI/"; + public static final String URI_DI = "http://www.omg.org/spec/DMN/20180521/DI/"; + public static final String URI_DC = "http://www.omg.org/spec/DMN/20180521/DC/"; + + private Map nsContext; + + private DMNModelInstrumentedBase parent; + private final List children = new ArrayList<>(); + private Location location; + private Map additionalAttributes = new HashMap<>(); + + public String getIdentifierString() { + if( this instanceof TNamedElement && ((TNamedElement)this).getName() != null ) { + return ((TNamedElement)this).getName(); + } else if( this instanceof TDMNElement && ((TDMNElement)this).getId() != null ) { + return ((TDMNElement)this).getId(); + } else { + return "[unnamed "+getClass().getSimpleName()+"]"; + } + } + + public DMNModelInstrumentedBase getParentDRDElement() { + if( this instanceof TDRGElement + || (this instanceof TArtifact) + || (this instanceof TItemDefinition && parent != null && parent instanceof TDefinitions)) { + return this; + } else if( parent != null ) { + return parent.getParentDRDElement(); + } else { + return null; + } + } + + @Override + public Map getNsContext() { + if (nsContext == null) { + nsContext = new HashMap<>(); + } + return nsContext; + } + + @Override + public String getNamespaceURI( String prefix ) { + if( this.nsContext != null && this.nsContext.containsKey( prefix ) ) { + return this.nsContext.get( prefix ); + } + if( this.parent != null ) { + return parent.getNamespaceURI( prefix ); + } + return null; + } + + public Optional getPrefixForNamespaceURI( String namespaceURI ) { + if( this.nsContext != null && this.nsContext.containsValue(namespaceURI) ) { + return this.nsContext.entrySet().stream().filter(kv -> kv.getValue().equals(namespaceURI)).findFirst().map(Map.Entry::getKey); + } + if( this.parent != null ) { + return parent.getPrefixForNamespaceURI( namespaceURI ); + } + return Optional.empty(); + } + + public void setAdditionalAttributes(Map additionalAttributes) { + this.additionalAttributes = additionalAttributes; + } + + public Map getAdditionalAttributes() { + return additionalAttributes; + } + + public DMNModelInstrumentedBase getParent() { + return parent; + } + + public void setParent(DMNModelInstrumentedBase parent) { + this.parent = parent; + } + + /* + * children element references are populated during deserialization, enabling fast access for Validation. + */ + public List getChildren() { + return Collections.unmodifiableList(children); + } + + public void addChildren(DMNModelInstrumentedBase child) { + this.children.add(child); + } + + @Override + public void setLocation(Location location) { + this.location = new RowLocation(location); + } + + /** + * Returns an approximated location of the XML origin for this DMN Model node. + */ + @Override + public Location getLocation() { + return location; + } + + @Override + public String getURIFEEL() { + return URI_FEEL; + } + + @Override + public List findAllChildren(Class clazz) { + if (clazz.isInstance(this)) { + T obj = (T) this; + return Collections.singletonList(obj); + } + List results = new ArrayList<>(); + for (DMNModelInstrumentedBase c : getChildren()) { + results.addAll(c.findAllChildren(clazz)); + } + return results; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TArtifact.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TArtifact.java new file mode 100644 index 00000000000..ff9a92b7f34 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TArtifact.java @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Artifact; + +public class TArtifact extends TDMNElement implements Artifact { + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAssociation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAssociation.java new file mode 100644 index 00000000000..903186e701b --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAssociation.java @@ -0,0 +1,65 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Association; +import org.kie.dmn.model.api.AssociationDirection; +import org.kie.dmn.model.api.DMNElementReference; + +public class TAssociation extends TArtifact implements Association { + + protected DMNElementReference sourceRef; + protected DMNElementReference targetRef; + protected AssociationDirection associationDirection; + + @Override + public DMNElementReference getSourceRef() { + return sourceRef; + } + + @Override + public void setSourceRef(DMNElementReference value) { + this.sourceRef = value; + } + + @Override + public DMNElementReference getTargetRef() { + return targetRef; + } + + @Override + public void setTargetRef(DMNElementReference value) { + this.targetRef = value; + } + + @Override + public AssociationDirection getAssociationDirection() { + if (associationDirection == null) { + return AssociationDirection.NONE; + } else { + return associationDirection; + } + } + + @Override + public void setAssociationDirection(AssociationDirection value) { + this.associationDirection = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAuthorityRequirement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAuthorityRequirement.java new file mode 100644 index 00000000000..d9fc621f410 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TAuthorityRequirement.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; + +public class TAuthorityRequirement extends TDMNElement implements AuthorityRequirement { + + protected DMNElementReference requiredDecision; + protected DMNElementReference requiredInput; + protected DMNElementReference requiredAuthority; + + @Override + public DMNElementReference getRequiredDecision() { + return requiredDecision; + } + + @Override + public void setRequiredDecision(DMNElementReference value) { + this.requiredDecision = value; + } + + @Override + public DMNElementReference getRequiredInput() { + return requiredInput; + } + + @Override + public void setRequiredInput(DMNElementReference value) { + this.requiredInput = value; + } + + @Override + public DMNElementReference getRequiredAuthority() { + return requiredAuthority; + } + + @Override + public void setRequiredAuthority(DMNElementReference value) { + this.requiredAuthority = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBinding.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBinding.java new file mode 100644 index 00000000000..d081ed16cb9 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBinding.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Binding; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; + +public class TBinding extends KieDMNModelInstrumentedBase implements Binding { + + protected InformationItem parameter; + protected Expression expression; + + @Override + public InformationItem getParameter() { + return parameter; + } + + @Override + public void setParameter(InformationItem value) { + this.parameter = value; + } + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessContextElement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessContextElement.java new file mode 100644 index 00000000000..a26fd7421d5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessContextElement.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.BusinessContextElement; + +public class TBusinessContextElement extends TNamedElement implements BusinessContextElement { + + protected String uri; + + @Override + public String getURI() { + return uri; + } + + @Override + public void setURI(String value) { + this.uri = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessKnowledgeModel.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessKnowledgeModel.java new file mode 100644 index 00000000000..5ef0836398f --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TBusinessKnowledgeModel.java @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.BusinessKnowledgeModel; +import org.kie.dmn.model.api.FunctionDefinition; +import org.kie.dmn.model.api.KnowledgeRequirement; + +import java.util.ArrayList; +import java.util.List; + +public class TBusinessKnowledgeModel extends TInvocable implements BusinessKnowledgeModel { + + protected FunctionDefinition encapsulatedLogic; + protected List knowledgeRequirement; + protected List authorityRequirement; + + @Override + public FunctionDefinition getEncapsulatedLogic() { + return encapsulatedLogic; + } + + @Override + public void setEncapsulatedLogic(FunctionDefinition value) { + this.encapsulatedLogic = value; + } + + @Override + public List getKnowledgeRequirement() { + if (knowledgeRequirement == null) { + knowledgeRequirement = new ArrayList<>(); + } + return this.knowledgeRequirement; + } + + @Override + public List getAuthorityRequirement() { + if (authorityRequirement == null) { + authorityRequirement = new ArrayList<>(); + } + return this.authorityRequirement; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TChildExpression.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TChildExpression.java new file mode 100644 index 00000000000..62566352106 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TChildExpression.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Expression; + +public class TChildExpression extends KieDMNModelInstrumentedBase implements ChildExpression { + + protected Expression expression; + + protected String id; + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + + public String getId() { + return id; + } + + public void setId(String value) { + this.id = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TConditional.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TConditional.java new file mode 100644 index 00000000000..a727ec9bf10 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TConditional.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Conditional; + +public class TConditional extends TExpression implements Conditional { + + private ChildExpression ifExp; + private ChildExpression thenExp; + private ChildExpression elseExp; + + @Override + public ChildExpression getIf() { + return ifExp; + } + + @Override + public ChildExpression getThen() { + return thenExp; + } + + @Override + public ChildExpression getElse() { + return elseExp; + } + + @Override + public void setIf(ChildExpression value) { + this.ifExp = value; + } + + @Override + public void setThen(ChildExpression value) { + this.thenExp = value; + } + + @Override + public void setElse(ChildExpression value) { + this.elseExp = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContext.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContext.java new file mode 100644 index 00000000000..6a7e3ec0c82 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContext.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Context; +import org.kie.dmn.model.api.ContextEntry; + +import java.util.ArrayList; +import java.util.List; + +public class TContext extends TExpression implements Context { + + protected List contextEntry; + + @Override + public List getContextEntry() { + if (contextEntry == null) { + contextEntry = new ArrayList<>(); + } + return this.contextEntry; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContextEntry.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContextEntry.java new file mode 100644 index 00000000000..0fc35af26ff --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TContextEntry.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ContextEntry; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; + +public class TContextEntry extends TDMNElement implements ContextEntry { + + protected InformationItem variable; + protected Expression expression; + + @Override + public InformationItem getVariable() { + return variable; + } + + @Override + public void setVariable(InformationItem value) { + this.variable = value; + } + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElement.java new file mode 100644 index 00000000000..3b658e185ec --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElement.java @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElement; + +import java.util.ArrayList; +import java.util.List; + +public class TDMNElement extends KieDMNModelInstrumentedBase implements DMNElement { + + protected String description; + protected ExtensionElements extensionElements; + protected String id; + protected String label; + + @Override + public String getDescription() { + return description; + } + + @Override + public void setDescription(String value) { + this.description = value; + } + + @Override + public ExtensionElements getExtensionElements() { + return extensionElements; + } + + @Override + public void setExtensionElements(ExtensionElements value) { + this.extensionElements = value; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String value) { + this.id = value; + } + + @Override + public String getLabel() { + return label; + } + + @Override + public void setLabel(String value) { + this.label = value; + } + + public static class TExtensionElements extends KieDMNModelInstrumentedBase implements ExtensionElements { + + protected List any; + + @Override + public List getAny() { + if (any == null) { + any = new ArrayList<>(); + } + return this.any; + } + + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElementReference.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElementReference.java new file mode 100644 index 00000000000..8949c60eda3 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDMNElementReference.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; + +public class TDMNElementReference extends KieDMNModelInstrumentedBase implements DMNElementReference { + + private String href; + + @Override + public String getHref() { + return href; + } + + @Override + public void setHref(String value) { + this.href = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDRGElement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDRGElement.java new file mode 100644 index 00000000000..fb04559c85a --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDRGElement.java @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DRGElement; + +public class TDRGElement extends TNamedElement implements DRGElement { + + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecision.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecision.java new file mode 100644 index 00000000000..5042b9ab27d --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecision.java @@ -0,0 +1,160 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.Decision; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.InformationRequirement; +import org.kie.dmn.model.api.KnowledgeRequirement; + +import java.util.ArrayList; +import java.util.List; + +public class TDecision extends TDRGElement implements Decision { + + protected String question; + protected String allowedAnswers; + protected InformationItem variable; + protected List informationRequirement; + protected List knowledgeRequirement; + protected List authorityRequirement; + protected List supportedObjective; + protected List impactedPerformanceIndicator; + protected List decisionMaker; + protected List decisionOwner; + protected List usingProcess; + protected List usingTask; + protected Expression expression; + + @Override + public String getQuestion() { + return question; + } + + @Override + public void setQuestion(String value) { + this.question = value; + } + + @Override + public String getAllowedAnswers() { + return allowedAnswers; + } + + @Override + public void setAllowedAnswers(String value) { + this.allowedAnswers = value; + } + + @Override + public InformationItem getVariable() { + return variable; + } + + @Override + public void setVariable(InformationItem value) { + this.variable = value; + } + + @Override + public List getInformationRequirement() { + if (informationRequirement == null) { + informationRequirement = new ArrayList<>(); + } + return this.informationRequirement; + } + + @Override + public List getKnowledgeRequirement() { + if (knowledgeRequirement == null) { + knowledgeRequirement = new ArrayList<>(); + } + return this.knowledgeRequirement; + } + + @Override + public List getAuthorityRequirement() { + if (authorityRequirement == null) { + authorityRequirement = new ArrayList<>(); + } + return this.authorityRequirement; + } + + @Override + public List getSupportedObjective() { + if (supportedObjective == null) { + supportedObjective = new ArrayList<>(); + } + return this.supportedObjective; + } + + @Override + public List getImpactedPerformanceIndicator() { + if (impactedPerformanceIndicator == null) { + impactedPerformanceIndicator = new ArrayList<>(); + } + return this.impactedPerformanceIndicator; + } + + @Override + public List getDecisionMaker() { + if (decisionMaker == null) { + decisionMaker = new ArrayList<>(); + } + return this.decisionMaker; + } + + @Override + public List getDecisionOwner() { + if (decisionOwner == null) { + decisionOwner = new ArrayList<>(); + } + return this.decisionOwner; + } + + @Override + public List getUsingProcess() { + if (usingProcess == null) { + usingProcess = new ArrayList<>(); + } + return this.usingProcess; + } + + @Override + public List getUsingTask() { + if (usingTask == null) { + usingTask = new ArrayList<>(); + } + return this.usingTask; + } + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionRule.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionRule.java new file mode 100644 index 00000000000..3d975962203 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionRule.java @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DecisionRule; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.RuleAnnotation; +import org.kie.dmn.model.api.UnaryTests; + +import java.util.ArrayList; +import java.util.List; + +public class TDecisionRule extends TDMNElement implements DecisionRule { + + protected List inputEntry; + protected List outputEntry; + protected List annotationEntry; + + @Override + public List getInputEntry() { + if (inputEntry == null) { + inputEntry = new ArrayList<>(); + } + return this.inputEntry; + } + + @Override + public List getOutputEntry() { + if (outputEntry == null) { + outputEntry = new ArrayList<>(); + } + return this.outputEntry; + } + + @Override + public List getAnnotationEntry() { + if (annotationEntry == null) { + annotationEntry = new ArrayList<>(); + } + return this.annotationEntry; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionService.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionService.java new file mode 100644 index 00000000000..0d43b534a1c --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionService.java @@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.DecisionService; + +import java.util.ArrayList; +import java.util.List; + +public class TDecisionService extends TInvocable implements DecisionService { + + protected List outputDecision; + protected List encapsulatedDecision; + protected List inputDecision; + protected List inputData; + + @Override + public List getOutputDecision() { + if (outputDecision == null) { + outputDecision = new ArrayList<>(); + } + return this.outputDecision; + } + + @Override + public List getEncapsulatedDecision() { + if (encapsulatedDecision == null) { + encapsulatedDecision = new ArrayList<>(); + } + return this.encapsulatedDecision; + } + + @Override + public List getInputDecision() { + if (inputDecision == null) { + inputDecision = new ArrayList<>(); + } + return this.inputDecision; + } + + @Override + public List getInputData() { + if (inputData == null) { + inputData = new ArrayList<>(); + } + return this.inputData; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTable.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTable.java new file mode 100644 index 00000000000..01bee2bd5a5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTable.java @@ -0,0 +1,124 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.BuiltinAggregator; +import org.kie.dmn.model.api.DecisionRule; +import org.kie.dmn.model.api.DecisionTable; +import org.kie.dmn.model.api.DecisionTableOrientation; +import org.kie.dmn.model.api.HitPolicy; +import org.kie.dmn.model.api.InputClause; +import org.kie.dmn.model.api.OutputClause; +import org.kie.dmn.model.api.RuleAnnotationClause; + +import java.util.ArrayList; +import java.util.List; + +public class TDecisionTable extends TExpression implements DecisionTable { + + protected List input; + protected List output; + protected List annotation; + protected List rule; + protected HitPolicy hitPolicy; + protected BuiltinAggregator aggregation; + protected DecisionTableOrientation preferredOrientation; + protected String outputLabel; + + @Override + public List getInput() { + if (input == null) { + input = new ArrayList<>(); + } + return this.input; + } + + @Override + public List getOutput() { + if (output == null) { + output = new ArrayList<>(); + } + return this.output; + } + + @Override + public List getAnnotation() { + if (annotation == null) { + annotation = new ArrayList<>(); + } + return this.annotation; + } + + @Override + public List getRule() { + if (rule == null) { + rule = new ArrayList<>(); + } + return this.rule; + } + + @Override + public HitPolicy getHitPolicy() { + if (hitPolicy == null) { + return HitPolicy.UNIQUE; + } else { + return hitPolicy; + } + } + + @Override + public void setHitPolicy(HitPolicy value) { + this.hitPolicy = value; + } + + @Override + public BuiltinAggregator getAggregation() { + return aggregation; + } + + @Override + public void setAggregation(BuiltinAggregator value) { + this.aggregation = value; + } + + @Override + public DecisionTableOrientation getPreferredOrientation() { + if (preferredOrientation == null) { + return DecisionTableOrientation.RULE_AS_ROW; + } else { + return preferredOrientation; + } + } + + @Override + public void setPreferredOrientation(DecisionTableOrientation value) { + this.preferredOrientation = value; + } + + @Override + public String getOutputLabel() { + return outputLabel; + } + + @Override + public void setOutputLabel(String value) { + this.outputLabel = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTableOrientation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTableOrientation.java new file mode 100644 index 00000000000..e748f3ca136 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDecisionTableOrientation.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +public enum TDecisionTableOrientation { + + RULE_AS_ROW("Rule-as-Row"), + RULE_AS_COLUMN("Rule-as-Column"), + CROSS_TABLE("CrossTable"); + private final String value; + + TDecisionTableOrientation(String v) { + value = v; + } + + public String value() { + return value; + } + + public static TDecisionTableOrientation fromValue(String v) { + for (TDecisionTableOrientation c: TDecisionTableOrientation.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDefinitions.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDefinitions.java new file mode 100644 index 00000000000..ea108d1b44e --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TDefinitions.java @@ -0,0 +1,196 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Artifact; +import org.kie.dmn.model.api.BusinessContextElement; +import org.kie.dmn.model.api.DRGElement; +import org.kie.dmn.model.api.DecisionService; +import org.kie.dmn.model.api.Definitions; +import org.kie.dmn.model.api.ElementCollection; +import org.kie.dmn.model.api.Import; +import org.kie.dmn.model.api.ItemDefinition; +import org.kie.dmn.model.api.dmndi.DMNDI; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class TDefinitions extends TNamedElement implements Definitions { + + public static final String DEFAULT_EXPRESSION_LANGUAGE = URI_FEEL; + + public static final String DEFAULT_TYPE_LANGUAGE = URI_FEEL; + + protected List _import; + protected List itemDefinition; + protected List drgElement; + protected List artifact; + protected List elementCollection; + protected List businessContextElement; + protected DMNDI dmndi; + protected String expressionLanguage; + protected String typeLanguage; + protected String namespace; + protected String exporter; + protected String exporterVersion; + + @Override + public List getImport() { + if (_import == null) { + _import = new ArrayList<>(); + } + return this._import; + } + + @Override + public List getItemDefinition() { + if (itemDefinition == null) { + itemDefinition = new ArrayList<>(); + } + return this.itemDefinition; + } + + @Override + public List getDrgElement() { + if (drgElement == null) { + drgElement = new ArrayList<>(); + } + return this.drgElement; + } + + @Override + public List getArtifact() { + if (artifact == null) { + artifact = new ArrayList<>(); + } + return this.artifact; + } + + @Override + public List getElementCollection() { + if (elementCollection == null) { + elementCollection = new ArrayList<>(); + } + return this.elementCollection; + } + + @Override + public List getBusinessContextElement() { + if (businessContextElement == null) { + businessContextElement = new ArrayList<>(); + } + return this.businessContextElement; + } + + @Override + public DMNDI getDMNDI() { + return dmndi; + } + + @Override + public void setDMNDI(DMNDI value) { + this.dmndi = value; + } + + @Override + public String getExpressionLanguage() { + if (expressionLanguage == null) { + return DEFAULT_EXPRESSION_LANGUAGE; + } else { + return expressionLanguage; + } + } + + @Override + public String getTypeLanguage() { + if (typeLanguage == null) { + return DEFAULT_TYPE_LANGUAGE; + } else { + return typeLanguage; + } + } + + @Override + public void setExpressionLanguage(String value) { + this.expressionLanguage = value; + } + + @Override + public void setTypeLanguage(String value) { + this.typeLanguage = value; + } + + @Override + public String getNamespace() { + return namespace; + } + + @Override + public void setNamespace(String value) { + this.namespace = value; + } + + @Override + public String getExporter() { + return exporter; + } + + @Override + public void setExporter(String value) { + this.exporter = value; + } + + @Override + public String getExporterVersion() { + return exporterVersion; + } + + @Override + public void setExporterVersion(String value) { + this.exporterVersion = value; + } + + /** + * Implementing support for internal model + */ + @Override + public List getDecisionService() { + return drgElement.stream().filter(DecisionService.class::isInstance).map(DecisionService.class::cast).collect(Collectors.toList()); + } + + public void normalize() { + for (ItemDefinition itemDefinition : this.getItemDefinition()) { + processQNameURIs(itemDefinition); + } + } + + private static void processQNameURIs(ItemDefinition iDef) { + final QName typeRef = iDef.getTypeRef(); + if (typeRef != null && XMLConstants.NULL_NS_URI.equals(typeRef.getNamespaceURI())) { + final String namespace = iDef.getNamespaceURI(typeRef.getPrefix()); + iDef.setTypeRef(new QName(namespace, typeRef.getLocalPart(), typeRef.getPrefix())); + } + for (ItemDefinition comp : iDef.getItemComponent()) { + processQNameURIs(comp); + } + } +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TElementCollection.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TElementCollection.java new file mode 100644 index 00000000000..fa3b7ae60f5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TElementCollection.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.ElementCollection; + +import java.util.ArrayList; +import java.util.List; + +public class TElementCollection extends TNamedElement implements ElementCollection { + + protected List drgElement; + + @Override + public List getDrgElement() { + if (drgElement == null) { + drgElement = new ArrayList<>(); + } + return this.drgElement; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TEvery.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TEvery.java new file mode 100644 index 00000000000..473bb73e147 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TEvery.java @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Every; + +public class TEvery extends TQuantified implements Every { + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TExpression.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TExpression.java new file mode 100644 index 00000000000..1e9584bf337 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TExpression.java @@ -0,0 +1,42 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Expression; + +import javax.xml.namespace.QName; + +public class TExpression extends TDMNElement implements Expression { + + /** + * align with internal model + */ + protected QName typeRef; + + @Override + public QName getTypeRef() { + return this.typeRef; + } + + @Override + public void setTypeRef(QName value) { + this.typeRef = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFilter.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFilter.java new file mode 100644 index 00000000000..3c0a9efbb30 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFilter.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Filter; + +public class TFilter extends TExpression implements Filter { + + private ChildExpression in; + private ChildExpression match; + + @Override + public ChildExpression getIn() { + return in; + } + + @Override + public ChildExpression getMatch() { + return match; + } + + @Override + public void setIn(ChildExpression value) { + this.in = value; + } + + @Override + public void setMatch(ChildExpression value) { + this.match = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFor.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFor.java new file mode 100644 index 00000000000..1c4a7dd3e0c --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFor.java @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.For; + +public class TFor extends TIterator implements For { + + protected ChildExpression _return; + + public ChildExpression getReturn() { + return _return; + } + + public void setReturn(ChildExpression value) { + this._return = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionDefinition.java new file mode 100644 index 00000000000..7bb5caa5773 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionDefinition.java @@ -0,0 +1,67 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.FunctionDefinition; +import org.kie.dmn.model.api.FunctionKind; +import org.kie.dmn.model.api.InformationItem; + +import java.util.ArrayList; +import java.util.List; + +public class TFunctionDefinition extends TExpression implements FunctionDefinition { + + protected List formalParameter; + protected Expression expression; + protected FunctionKind kind; + + @Override + public List getFormalParameter() { + if (formalParameter == null) { + formalParameter = new ArrayList<>(); + } + return this.formalParameter; + } + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + + @Override + public FunctionKind getKind() { + if (kind == null) { + return FunctionKind.FEEL; + } else { + return kind; + } + } + + @Override + public void setKind(FunctionKind value) { + this.kind = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionItem.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionItem.java new file mode 100644 index 00000000000..65608b455a8 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TFunctionItem.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.FunctionItem; +import org.kie.dmn.model.api.InformationItem; + +import javax.xml.namespace.QName; +import java.util.ArrayList; +import java.util.List; + +public class TFunctionItem extends TDMNElement implements FunctionItem { + + protected List parameters; + protected QName outputTypeRef; + + @Override + public List getParameters() { + if (parameters == null) { + parameters = new ArrayList<>(); + } + return this.parameters; + } + + @Override + public QName getOutputTypeRef() { + return outputTypeRef; + } + + @Override + public void setOutputTypeRef(QName value) { + this.outputTypeRef = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TGroup.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TGroup.java new file mode 100644 index 00000000000..5247a94c960 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TGroup.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Group; + +public class TGroup extends TArtifact implements Group { + + protected String name; + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String value) { + this.name = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImport.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImport.java new file mode 100644 index 00000000000..a869dc8a57f --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImport.java @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Import; + +public class TImport extends TNamedElement implements Import { + + protected String namespace; + protected String locationURI; + protected String importType; + + @Override + public String getNamespace() { + return namespace; + } + + @Override + public void setNamespace(String value) { + this.namespace = value; + } + + @Override + public String getLocationURI() { + return locationURI; + } + + @Override + public void setLocationURI(String value) { + this.locationURI = value; + } + + @Override + public String getImportType() { + return importType; + } + + @Override + public void setImportType(String value) { + this.importType = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImportedValues.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImportedValues.java new file mode 100644 index 00000000000..166901e4a0f --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TImportedValues.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ImportedValues; + +public class TImportedValues extends TImport implements ImportedValues { + + protected String importedElement; + protected String expressionLanguage; + + @Override + public String getImportedElement() { + return importedElement; + } + + @Override + public void setImportedElement(String value) { + this.importedElement = value; + } + + @Override + public String getExpressionLanguage() { + return expressionLanguage; + } + + @Override + public void setExpressionLanguage(String value) { + this.expressionLanguage = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationItem.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationItem.java new file mode 100644 index 00000000000..514128bb3d2 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationItem.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.InformationItem; + +import javax.xml.namespace.QName; + +public class TInformationItem extends TNamedElement implements InformationItem { + + protected QName typeRef; + + @Override + public QName getTypeRef() { + return this.typeRef; + } + + @Override + public void setTypeRef(QName value) { + this.typeRef = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationRequirement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationRequirement.java new file mode 100644 index 00000000000..96edf27b0fe --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInformationRequirement.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.InformationRequirement; + +public class TInformationRequirement extends TDMNElement implements InformationRequirement { + + protected DMNElementReference requiredDecision; + protected DMNElementReference requiredInput; + + @Override + public DMNElementReference getRequiredDecision() { + return requiredDecision; + } + + @Override + public void setRequiredDecision(DMNElementReference value) { + this.requiredDecision = value; + } + + @Override + public DMNElementReference getRequiredInput() { + return requiredInput; + } + + @Override + public void setRequiredInput(DMNElementReference value) { + this.requiredInput = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputClause.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputClause.java new file mode 100644 index 00000000000..98037307685 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputClause.java @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.InputClause; +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.UnaryTests; + +public class TInputClause extends TDMNElement implements InputClause { + + protected LiteralExpression inputExpression; + protected UnaryTests inputValues; + + @Override + public LiteralExpression getInputExpression() { + return inputExpression; + } + + @Override + public void setInputExpression(LiteralExpression value) { + this.inputExpression = value; + } + + @Override + public UnaryTests getInputValues() { + return inputValues; + } + + @Override + public void setInputValues(UnaryTests value) { + this.inputValues = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputData.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputData.java new file mode 100644 index 00000000000..b037b94f70d --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInputData.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.InputData; + +public class TInputData extends TDRGElement implements InputData { + + protected InformationItem variable; + + @Override + public InformationItem getVariable() { + return variable; + } + + @Override + public void setVariable(InformationItem value) { + this.variable = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocable.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocable.java new file mode 100644 index 00000000000..7f5962857ec --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocable.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.Invocable; + +public class TInvocable extends TDRGElement implements Invocable { + + protected InformationItem variable; + + @Override + public InformationItem getVariable() { + return variable; + } + + @Override + public void setVariable(InformationItem value) { + this.variable = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocation.java new file mode 100644 index 00000000000..608f9507066 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TInvocation.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Binding; +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.Invocation; + +import java.util.ArrayList; +import java.util.List; + +public class TInvocation extends TExpression implements Invocation { + + protected Expression expression; + protected List binding; + + @Override + public Expression getExpression() { + return expression; + } + + @Override + public void setExpression(Expression value) { + this.expression = value; + } + + @Override + public List getBinding() { + if (binding == null) { + binding = new ArrayList<>(); + } + return this.binding; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TItemDefinition.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TItemDefinition.java new file mode 100644 index 00000000000..8c8a61139b3 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TItemDefinition.java @@ -0,0 +1,113 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.FunctionItem; +import org.kie.dmn.model.api.ItemDefinition; +import org.kie.dmn.model.api.UnaryTests; + +import javax.xml.namespace.QName; +import java.util.ArrayList; +import java.util.List; + +public class TItemDefinition extends TNamedElement implements ItemDefinition { + + /** + * align to internal model + */ + protected QName typeRef; + protected UnaryTests allowedValues; + protected UnaryTests typeConstraint; + protected List itemComponent; + protected FunctionItem functionItem; + protected String typeLanguage; + protected Boolean isCollection; + + @Override + public QName getTypeRef() { + return typeRef; + } + + @Override + public void setTypeRef(final QName value) { + this.typeRef = value; + } + + @Override + public UnaryTests getAllowedValues() { + return allowedValues; + } + + @Override + public void setAllowedValues(UnaryTests value) { + this.allowedValues = value; + } + + @Override + public UnaryTests getTypeConstraint() { + return typeConstraint; + } + + @Override + public void setTypeConstraint(UnaryTests value) { + this.typeConstraint = value; + } + + @Override + public List getItemComponent() { + if (itemComponent == null) { + itemComponent = new ArrayList<>(); + } + return this.itemComponent; + } + + @Override + public String getTypeLanguage() { + return typeLanguage; + } + + @Override + public void setTypeLanguage(String value) { + this.typeLanguage = value; + } + + @Override + public boolean isIsCollection() { + if (isCollection == null) { + return false; + } else { + return isCollection; + } + } + + @Override + public void setIsCollection(Boolean value) { + this.isCollection = value; + } + + @Override + public FunctionItem getFunctionItem() { + return functionItem; + } + + @Override + public void setFunctionItem(FunctionItem value) { + this.functionItem = value; + } +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TIterator.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TIterator.java new file mode 100644 index 00000000000..ee8b9802818 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TIterator.java @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Iterator; +import org.kie.dmn.model.api.TypedChildExpression; + +public class TIterator extends TExpression implements Iterator { + + protected TypedChildExpression in; + + protected String iteratorVariable; + + public TypedChildExpression getIn() { + return in; + } + + public void setIn(TypedChildExpression value) { + this.in = value; + } + + public String getIteratorVariable() { + return iteratorVariable; + } + + public void setIteratorVariable(String value) { + this.iteratorVariable = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeRequirement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeRequirement.java new file mode 100644 index 00000000000..df277c343e5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeRequirement.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.KnowledgeRequirement; + +public class TKnowledgeRequirement extends TDMNElement implements KnowledgeRequirement { + + protected DMNElementReference requiredKnowledge; + + @Override + public DMNElementReference getRequiredKnowledge() { + return requiredKnowledge; + } + + @Override + public void setRequiredKnowledge(DMNElementReference value) { + this.requiredKnowledge = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeSource.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeSource.java new file mode 100644 index 00000000000..1c0c11c83b9 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TKnowledgeSource.java @@ -0,0 +1,73 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.AuthorityRequirement; +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.KnowledgeSource; + +import java.util.ArrayList; +import java.util.List; + +public class TKnowledgeSource extends TDRGElement implements KnowledgeSource { + + protected List authorityRequirement; + protected String type; + protected DMNElementReference owner; + protected String locationURI; + + @Override + public List getAuthorityRequirement() { + if (authorityRequirement == null) { + authorityRequirement = new ArrayList<>(); + } + return this.authorityRequirement; + } + + @Override + public String getType() { + return type; + } + + @Override + public void setType(String value) { + this.type = value; + } + + @Override + public DMNElementReference getOwner() { + return owner; + } + + @Override + public void setOwner(DMNElementReference value) { + this.owner = value; + } + + @Override + public String getLocationURI() { + return locationURI; + } + + @Override + public void setLocationURI(String value) { + this.locationURI = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TList.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TList.java new file mode 100644 index 00000000000..07a74b541be --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TList.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Expression; +import org.kie.dmn.model.api.List; + +import java.util.ArrayList; + +public class TList extends TExpression implements List { + + protected java.util.List expression; + + @Override + public java.util.List getExpression() { + if (expression == null) { + expression = new ArrayList<>(); + } + return this.expression; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TLiteralExpression.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TLiteralExpression.java new file mode 100644 index 00000000000..96feeaf5011 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TLiteralExpression.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ImportedValues; +import org.kie.dmn.model.api.LiteralExpression; + +public class TLiteralExpression extends TExpression implements LiteralExpression { + + protected String text; + protected ImportedValues importedValues; + protected String expressionLanguage; + + @Override + public String getText() { + return text; + } + + @Override + public void setText(String value) { + this.text = value; + } + + @Override + public ImportedValues getImportedValues() { + return importedValues; + } + + @Override + public void setImportedValues(ImportedValues value) { + this.importedValues = value; + } + + @Override + public String getExpressionLanguage() { + return expressionLanguage; + } + + @Override + public void setExpressionLanguage(String value) { + this.expressionLanguage = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TNamedElement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TNamedElement.java new file mode 100644 index 00000000000..15279df70c6 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TNamedElement.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.NamedElement; + +public class TNamedElement extends TDMNElement implements NamedElement { + + protected String name; + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String value) { + this.name = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOrganizationUnit.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOrganizationUnit.java new file mode 100644 index 00000000000..b3d0d5fd8ed --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOrganizationUnit.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.OrganizationUnit; + +import java.util.ArrayList; +import java.util.List; + +public class TOrganizationUnit extends TBusinessContextElement implements OrganizationUnit { + + protected List decisionMade; + protected List decisionOwned; + + @Override + public List getDecisionMade() { + if (decisionMade == null) { + decisionMade = new ArrayList<>(); + } + return this.decisionMade; + } + + @Override + public List getDecisionOwned() { + if (decisionOwned == null) { + decisionOwned = new ArrayList<>(); + } + return this.decisionOwned; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOutputClause.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOutputClause.java new file mode 100644 index 00000000000..a61a689c5b6 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TOutputClause.java @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.LiteralExpression; +import org.kie.dmn.model.api.OutputClause; +import org.kie.dmn.model.api.UnaryTests; + +import javax.xml.namespace.QName; + +public class TOutputClause extends TDMNElement implements OutputClause { + + protected UnaryTests outputValues; + protected LiteralExpression defaultOutputEntry; + protected String name; + /** + * align to internal model + */ + protected QName typeRef; + + @Override + public UnaryTests getOutputValues() { + return outputValues; + } + + @Override + public void setOutputValues(UnaryTests value) { + this.outputValues = value; + } + + @Override + public LiteralExpression getDefaultOutputEntry() { + return defaultOutputEntry; + } + + @Override + public void setDefaultOutputEntry(LiteralExpression value) { + this.defaultOutputEntry = value; + } + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String value) { + this.name = value; + } + + @Override + public QName getTypeRef() { + return typeRef; + } + + @Override + public void setTypeRef(QName value) { + this.typeRef = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TPerformanceIndicator.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TPerformanceIndicator.java new file mode 100644 index 00000000000..6aaa27a450f --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TPerformanceIndicator.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.DMNElementReference; +import org.kie.dmn.model.api.PerformanceIndicator; + +import java.util.ArrayList; +import java.util.List; + +public class TPerformanceIndicator extends TBusinessContextElement implements PerformanceIndicator { + + protected List impactingDecision; + + @Override + public List getImpactingDecision() { + if (impactingDecision == null) { + impactingDecision = new ArrayList<>(); + } + return this.impactingDecision; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TQuantified.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TQuantified.java new file mode 100644 index 00000000000..0c09e360857 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TQuantified.java @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.ChildExpression; +import org.kie.dmn.model.api.Quantified; + +public class TQuantified extends TIterator implements Quantified { + + protected ChildExpression satisfies; + + public ChildExpression getSatisfies() { + return satisfies; + } + + public void setSatisfies(ChildExpression value) { + this.satisfies = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRelation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRelation.java new file mode 100644 index 00000000000..b821f70550d --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRelation.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.InformationItem; +import org.kie.dmn.model.api.List; +import org.kie.dmn.model.api.Relation; + +import java.util.ArrayList; + +public class TRelation extends TExpression implements Relation { + + protected java.util.List column; + protected java.util.List row; + + @Override + public java.util.List getColumn() { + if (column == null) { + column = new ArrayList<>(); + } + return this.column; + } + + @Override + public java.util.List getRow() { + if (row == null) { + row = new ArrayList<>(); + } + return this.row; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotation.java new file mode 100644 index 00000000000..e269541166e --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotation.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.RuleAnnotation; + +public class TRuleAnnotation extends KieDMNModelInstrumentedBase implements RuleAnnotation { + + protected String text; + + @Override + public String getText() { + return text; + } + + @Override + public void setText(String value) { + this.text = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotationClause.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotationClause.java new file mode 100644 index 00000000000..9610687fd29 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TRuleAnnotationClause.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.RuleAnnotationClause; + +public class TRuleAnnotationClause extends KieDMNModelInstrumentedBase implements RuleAnnotationClause { + + protected String name; + + @Override + public String getName() { + return name; + } + + @Override + public void setName(String value) { + this.name = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TSome.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TSome.java new file mode 100644 index 00000000000..bc5f72255d5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TSome.java @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.Some; + +public class TSome extends TQuantified implements Some { + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTextAnnotation.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTextAnnotation.java new file mode 100644 index 00000000000..b0898f3e970 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTextAnnotation.java @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.TextAnnotation; + +public class TTextAnnotation extends TArtifact implements TextAnnotation { + + + private static final String DEFAULT_TEXT_FORMAT = "text/plain"; + + private String text; + private String textFormat; + + @Override + public String getText() { + return text; + } + + @Override + public void setText(final String value) { + this.text = value; + } + + @Override + public String getTextFormat() { + if (textFormat == null) { + return DEFAULT_TEXT_FORMAT; + } else { + return textFormat; + } + } + + @Override + public void setTextFormat(final String value) { + this.textFormat = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTypedChildExpression.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTypedChildExpression.java new file mode 100644 index 00000000000..898f2c2834e --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TTypedChildExpression.java @@ -0,0 +1,37 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.TypedChildExpression; + +public class TTypedChildExpression extends TChildExpression implements TypedChildExpression { + + protected String typeRef; + + @Override + public String getTypeRef() { + return typeRef; + } + + @Override + public void setTypeRef(String value) { + this.typeRef = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TUnaryTests.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TUnaryTests.java new file mode 100644 index 00000000000..27b99f547e5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/TUnaryTests.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5; + +import org.kie.dmn.model.api.UnaryTests; + +public class TUnaryTests extends TExpression implements UnaryTests { + + protected String text; + protected String expressionLanguage; + + @Override + public String getText() { + return text; + } + + @Override + public void setText(String value) { + this.text = value; + } + + @Override + public String getExpressionLanguage() { + return expressionLanguage; + } + + @Override + public void setExpressionLanguage(String value) { + this.expressionLanguage = value; + } +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Bounds.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Bounds.java new file mode 100644 index 00000000000..e60e04ea7ba --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Bounds.java @@ -0,0 +1,94 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +public class Bounds extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.Bounds { + + protected double x; + protected double y; + protected double width; + protected double height; + + /** + * Gets the value of the x property. + * + */ + public double getX() { + return x; + } + + /** + * Sets the value of the x property. + * + */ + public void setX(double value) { + this.x = value; + } + + /** + * Gets the value of the y property. + * + */ + public double getY() { + return y; + } + + /** + * Sets the value of the y property. + * + */ + public void setY(double value) { + this.y = value; + } + + /** + * Gets the value of the width property. + * + */ + public double getWidth() { + return width; + } + + /** + * Sets the value of the width property. + * + */ + public void setWidth(double value) { + this.width = value; + } + + /** + * Gets the value of the height property. + * + */ + public double getHeight() { + return height; + } + + /** + * Sets the value of the height property. + * + */ + public void setHeight(double value) { + this.height = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Color.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Color.java new file mode 100644 index 00000000000..c0d48232b0b --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Color.java @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +public class Color extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.Color { + + protected int red; + protected int green; + protected int blue; + + /** + * Gets the value of the red property. + * + */ + public int getRed() { + return red; + } + + /** + * Sets the value of the red property. + * + */ + public void setRed(int value) { + this.red = value; + } + + /** + * Gets the value of the green property. + * + */ + public int getGreen() { + return green; + } + + /** + * Sets the value of the green property. + * + */ + public void setGreen(int value) { + this.green = value; + } + + /** + * Gets the value of the blue property. + * + */ + public int getBlue() { + return blue; + } + + /** + * Sets the value of the blue property. + * + */ + public void setBlue(int value) { + this.blue = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDI.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDI.java new file mode 100644 index 00000000000..5d11abdd2e8 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDI.java @@ -0,0 +1,123 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.api.dmndi.DMNDiagram; +import org.kie.dmn.model.api.dmndi.DMNStyle; +import org.kie.dmn.model.api.dmndi.DiagramElement; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.kie.dmn.model.v1_5.dmndi.Style.IDREFStubStyle; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + + +public class DMNDI extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.DMNDI { + + protected List dmnDiagram; + protected List dmnStyle; + + /** + * Gets the value of the dmnDiagram property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the dmnDiagram property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getDMNDiagram().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link DMNDiagram } + * + * + */ + @Override + public List getDMNDiagram() { + if (dmnDiagram == null) { + dmnDiagram = new ArrayList<>(); + } + return this.dmnDiagram; + } + + /** + * Gets the value of the dmnStyle property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the dmnStyle property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getDMNStyle().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link DMNStyle } + * + * + */ + @Override + public List getDMNStyle() { + if (dmnStyle == null) { + dmnStyle = new ArrayList<>(); + } + return this.dmnStyle; + } + + @Override + public void normalize() { + if (dmnStyle == null || dmnDiagram == null) { + return; + } + Map styleById = dmnStyle.stream().collect(Collectors.toMap(DMNStyle::getId, Function.identity())); + for (DMNDiagram diagram : dmnDiagram) { + for (DiagramElement element : diagram.getDMNDiagramElement()) { + replaceSharedStyleIfStubbed(element, styleById); + if (element instanceof DMNShape) { + DMNShape dmnShape = (DMNShape) element; + replaceSharedStyleIfStubbed(dmnShape.getDMNLabel(), styleById); + } + } + } + } + + private void replaceSharedStyleIfStubbed(DiagramElement element, Map styleById) { + if (element.getSharedStyle() instanceof IDREFStubStyle) { + DMNStyle locatedStyle = styleById.get(element.getSharedStyle().getId()); + element.setSharedStyle(locatedStyle); + } + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDecisionServiceDividerLine.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDecisionServiceDividerLine.java new file mode 100644 index 00000000000..6d94c8f1162 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDecisionServiceDividerLine.java @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +public class DMNDecisionServiceDividerLine extends Edge implements org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine { + + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDiagram.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDiagram.java new file mode 100644 index 00000000000..e78187e0677 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNDiagram.java @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import jakarta.xml.bind.JAXBElement; + +import java.util.ArrayList; +import java.util.List; + +public class DMNDiagram extends Diagram implements org.kie.dmn.model.api.dmndi.DMNDiagram { + + protected org.kie.dmn.model.api.dmndi.Dimension size; + protected List dmnDiagramElement; + protected boolean useAlternativeInputDataShape = false; + + /** + * Gets the value of the size property. + * + * @return + * possible object is + * {@link Dimension } + * + */ + public org.kie.dmn.model.api.dmndi.Dimension getSize() { + return size; + } + + /** + * Sets the value of the size property. + * + * @param value + * allowed object is + * {@link Dimension } + * + */ + public void setSize(org.kie.dmn.model.api.dmndi.Dimension value) { + this.size = value; + } + + /** + * Gets the value of the dmnDiagramElement property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the dmnDiagramElement property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getDMNDiagramElement().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link DMNShape }{@code >} + * {@link JAXBElement }{@code <}{@link DiagramElement }{@code >} + * {@link JAXBElement }{@code <}{@link DMNEdge }{@code >} + * + * + */ + public List getDMNDiagramElement() { + if (dmnDiagramElement == null) { + dmnDiagramElement = new ArrayList<>(); + } + return this.dmnDiagramElement; + } + + @Override + public Boolean getUseAlternativeInputDataShape() { + return useAlternativeInputDataShape; + } + + @Override + public void setUseAlternativeInputDataShape(Boolean value) { + this.useAlternativeInputDataShape = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNEdge.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNEdge.java new file mode 100644 index 00000000000..e1568600033 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNEdge.java @@ -0,0 +1,98 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import javax.xml.namespace.QName; + +public class DMNEdge extends Edge implements org.kie.dmn.model.api.dmndi.DMNEdge { + + protected org.kie.dmn.model.api.dmndi.DMNLabel dmnLabel; + protected QName dmnElementRef; + protected QName sourceElement; + protected QName targetElement; + + /** + * Gets the value of the dmnLabel property. + * + * @return + * possible object is + * {@link DMNLabel } + * + */ + public org.kie.dmn.model.api.dmndi.DMNLabel getDMNLabel() { + return dmnLabel; + } + + /** + * Sets the value of the dmnLabel property. + * + * @param value + * allowed object is + * {@link DMNLabel } + * + */ + public void setDMNLabel(org.kie.dmn.model.api.dmndi.DMNLabel value) { + this.dmnLabel = value; + } + + /** + * Gets the value of the dmnElementRef property. + * + * @return + * possible object is + * {@link QName } + * + */ + public QName getDmnElementRef() { + return dmnElementRef; + } + + /** + * Sets the value of the dmnElementRef property. + * + * @param value + * allowed object is + * {@link QName } + * + */ + public void setDmnElementRef(QName value) { + this.dmnElementRef = value; + } + + @Override + public QName getSourceElement() { + return sourceElement; + } + + @Override + public void setSourceElement(QName value) { + this.sourceElement = value; + } + + @Override + public QName getTargetElement() { + return targetElement; + } + + @Override + public void setTargetElement(QName value) { + this.targetElement = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNLabel.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNLabel.java new file mode 100644 index 00000000000..2845a1bb751 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNLabel.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +public class DMNLabel extends Shape implements org.kie.dmn.model.api.dmndi.DMNLabel { + + protected String text; + + /** + * Gets the value of the text property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getText() { + return text; + } + + /** + * Sets the value of the text property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setText(String value) { + this.text = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNShape.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNShape.java new file mode 100644 index 00000000000..e999af6a711 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNShape.java @@ -0,0 +1,155 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import javax.xml.namespace.QName; + +public class DMNShape extends Shape implements org.kie.dmn.model.api.dmndi.DMNShape { + + protected org.kie.dmn.model.api.dmndi.DMNLabel dmnLabel; + protected org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine dmnDecisionServiceDividerLine; + protected QName dmnElementRef; + protected Boolean isListedInputData; + protected Boolean isCollapsed; + + /** + * Gets the value of the dmnLabel property. + * + * @return + * possible object is + * {@link DMNLabel } + * + */ + public org.kie.dmn.model.api.dmndi.DMNLabel getDMNLabel() { + return dmnLabel; + } + + /** + * Sets the value of the dmnLabel property. + * + * @param value + * allowed object is + * {@link DMNLabel } + * + */ + public void setDMNLabel(org.kie.dmn.model.api.dmndi.DMNLabel value) { + this.dmnLabel = value; + } + + /** + * Gets the value of the dmnDecisionServiceDividerLine property. + * + * @return + * possible object is + * {@link DMNDecisionServiceDividerLine } + * + */ + public org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine getDMNDecisionServiceDividerLine() { + return dmnDecisionServiceDividerLine; + } + + /** + * Sets the value of the dmnDecisionServiceDividerLine property. + * + * @param value + * allowed object is + * {@link DMNDecisionServiceDividerLine } + * + */ + public void setDMNDecisionServiceDividerLine(org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine value) { + this.dmnDecisionServiceDividerLine = value; + } + + /** + * Gets the value of the dmnElementRef property. + * + * @return + * possible object is + * {@link QName } + * + */ + public QName getDmnElementRef() { + return dmnElementRef; + } + + /** + * Sets the value of the dmnElementRef property. + * + * @param value + * allowed object is + * {@link QName } + * + */ + public void setDmnElementRef(QName value) { + this.dmnElementRef = value; + } + + /** + * Gets the value of the isListedInputData property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isIsListedInputData() { + return isListedInputData; + } + + /** + * Sets the value of the isListedInputData property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsListedInputData(Boolean value) { + this.isListedInputData = value; + } + + /** + * Gets the value of the isCollapsed property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public boolean isIsCollapsed() { + if (isCollapsed == null) { + return false; + } else { + return isCollapsed; + } + } + + /** + * Sets the value of the isCollapsed property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setIsCollapsed(Boolean value) { + this.isCollapsed = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNStyle.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNStyle.java new file mode 100644 index 00000000000..9ac2a453b36 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DMNStyle.java @@ -0,0 +1,301 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.api.dmndi.AlignmentKind; + +public class DMNStyle extends Style implements org.kie.dmn.model.api.dmndi.DMNStyle { + + protected org.kie.dmn.model.api.dmndi.Color fillColor; + protected org.kie.dmn.model.api.dmndi.Color strokeColor; + protected org.kie.dmn.model.api.dmndi.Color fontColor; + protected String fontFamily; + protected Double fontSize; + protected Boolean fontItalic; + protected Boolean fontBold; + protected Boolean fontUnderline; + protected Boolean fontStrikeThrough; + protected AlignmentKind labelHorizontalAlignement; + protected AlignmentKind labelVerticalAlignment; + + /** + * Gets the value of the fillColor property. + * + * @return + * possible object is + * {@link Color } + * + */ + public org.kie.dmn.model.api.dmndi.Color getFillColor() { + return fillColor; + } + + /** + * Sets the value of the fillColor property. + * + * @param value + * allowed object is + * {@link Color } + * + */ + public void setFillColor(org.kie.dmn.model.api.dmndi.Color value) { + this.fillColor = value; + } + + /** + * Gets the value of the strokeColor property. + * + * @return + * possible object is + * {@link Color } + * + */ + public org.kie.dmn.model.api.dmndi.Color getStrokeColor() { + return strokeColor; + } + + /** + * Sets the value of the strokeColor property. + * + * @param value + * allowed object is + * {@link Color } + * + */ + public void setStrokeColor(org.kie.dmn.model.api.dmndi.Color value) { + this.strokeColor = value; + } + + /** + * Gets the value of the fontColor property. + * + * @return + * possible object is + * {@link Color } + * + */ + public org.kie.dmn.model.api.dmndi.Color getFontColor() { + return fontColor; + } + + /** + * Sets the value of the fontColor property. + * + * @param value + * allowed object is + * {@link Color } + * + */ + public void setFontColor(org.kie.dmn.model.api.dmndi.Color value) { + this.fontColor = value; + } + + /** + * Gets the value of the fontFamily property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFontFamily() { + return fontFamily; + } + + /** + * Sets the value of the fontFamily property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFontFamily(String value) { + this.fontFamily = value; + } + + /** + * Gets the value of the fontSize property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getFontSize() { + return fontSize; + } + + /** + * Sets the value of the fontSize property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setFontSize(Double value) { + this.fontSize = value; + } + + /** + * Gets the value of the fontItalic property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isFontItalic() { + return fontItalic; + } + + /** + * Sets the value of the fontItalic property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setFontItalic(Boolean value) { + this.fontItalic = value; + } + + /** + * Gets the value of the fontBold property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isFontBold() { + return fontBold; + } + + /** + * Sets the value of the fontBold property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setFontBold(Boolean value) { + this.fontBold = value; + } + + /** + * Gets the value of the fontUnderline property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isFontUnderline() { + return fontUnderline; + } + + /** + * Sets the value of the fontUnderline property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setFontUnderline(Boolean value) { + this.fontUnderline = value; + } + + /** + * Gets the value of the fontStrikeThrough property. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isFontStrikeThrough() { + return fontStrikeThrough; + } + + /** + * Sets the value of the fontStrikeThrough property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setFontStrikeThrough(Boolean value) { + this.fontStrikeThrough = value; + } + + /** + * Gets the value of the labelHorizontalAlignement property. + * + * @return + * possible object is + * {@link AlignmentKind } + * + */ + public AlignmentKind getLabelHorizontalAlignement() { + return labelHorizontalAlignement; + } + + /** + * Sets the value of the labelHorizontalAlignement property. + * + * @param value + * allowed object is + * {@link AlignmentKind } + * + */ + public void setLabelHorizontalAlignement(AlignmentKind value) { + this.labelHorizontalAlignement = value; + } + + /** + * Gets the value of the labelVerticalAlignment property. + * + * @return + * possible object is + * {@link AlignmentKind } + * + */ + public AlignmentKind getLabelVerticalAlignment() { + return labelVerticalAlignment; + } + + /** + * Sets the value of the labelVerticalAlignment property. + * + * @param value + * allowed object is + * {@link AlignmentKind } + * + */ + public void setLabelVerticalAlignment(AlignmentKind value) { + this.labelVerticalAlignment = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Diagram.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Diagram.java new file mode 100644 index 00000000000..6d5bc10f809 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Diagram.java @@ -0,0 +1,99 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +public abstract class Diagram extends DiagramElement implements org.kie.dmn.model.api.dmndi.Diagram { + + protected String name; + protected String documentation; + protected Double resolution; + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the documentation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDocumentation() { + return documentation; + } + + /** + * Sets the value of the documentation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDocumentation(String value) { + this.documentation = value; + } + + /** + * Gets the value of the resolution property. + * + * @return + * possible object is + * {@link Double } + * + */ + public Double getResolution() { + return resolution; + } + + /** + * Sets the value of the resolution property. + * + * @param value + * allowed object is + * {@link Double } + * + */ + public void setResolution(Double value) { + this.resolution = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DiagramElement.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DiagramElement.java new file mode 100644 index 00000000000..e7e62438c51 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/DiagramElement.java @@ -0,0 +1,147 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import jakarta.xml.bind.JAXBElement; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +import java.util.ArrayList; +import java.util.List; + +public abstract class DiagramElement extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.DiagramElement { + + protected org.kie.dmn.model.api.dmndi.DiagramElement.Extension extension; + protected org.kie.dmn.model.api.dmndi.Style style; + protected org.kie.dmn.model.api.dmndi.Style sharedStyle; + protected String id; + + /** + * Gets the value of the extension property. + * + * @return + * possible object is + * {@link Extension } + * + */ + public org.kie.dmn.model.api.dmndi.DiagramElement.Extension getExtension() { + return extension; + } + + /** + * Sets the value of the extension property. + * + * @param value + * allowed object is + * {@link Extension } + * + */ + public void setExtension(org.kie.dmn.model.api.dmndi.DiagramElement.Extension value) { + this.extension = value; + } + + /** + * an optional locally-owned style for this diagram element. + * + * @return + * possible object is + * {@link JAXBElement }{@code <}{@link DMNStyle }{@code >} + * {@link JAXBElement }{@code <}{@link Style }{@code >} + * + */ + public org.kie.dmn.model.api.dmndi.Style getStyle() { + return style; + } + + /** + * Sets the value of the style property. + * + * @param value + * allowed object is + * {@link JAXBElement }{@code <}{@link DMNStyle }{@code >} + * {@link JAXBElement }{@code <}{@link Style }{@code >} + * + */ + public void setStyle(org.kie.dmn.model.api.dmndi.Style value) { + this.style = value; + } + + /** + * Gets the value of the sharedStyle property. + * + * @return + * possible object is + * {@link Object } + * + */ + public org.kie.dmn.model.api.dmndi.Style getSharedStyle() { + return sharedStyle; + } + + /** + * Sets the value of the sharedStyle property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setSharedStyle(org.kie.dmn.model.api.dmndi.Style value) { + this.sharedStyle = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + + public static class Extension extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.DiagramElement.Extension { + + protected List any; + + public List getAny() { + if (any == null) { + any = new ArrayList<>(); + } + return this.any; + } + + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Dimension.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Dimension.java new file mode 100644 index 00000000000..de1794410b3 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Dimension.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +public class Dimension extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.Dimension { + + protected double width; + protected double height; + + /** + * Gets the value of the width property. + * + */ + public double getWidth() { + return width; + } + + /** + * Sets the value of the width property. + * + */ + public void setWidth(double value) { + this.width = value; + } + + /** + * Gets the value of the height property. + * + */ + public double getHeight() { + return height; + } + + /** + * Sets the value of the height property. + * + */ + public void setHeight(double value) { + this.height = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Edge.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Edge.java new file mode 100644 index 00000000000..79258c0b6fd --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Edge.java @@ -0,0 +1,57 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import java.util.ArrayList; +import java.util.List; + +public abstract class Edge extends DiagramElement implements org.kie.dmn.model.api.dmndi.Edge { + + protected List waypoint; + + /** + * Gets the value of the waypoint property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the waypoint property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getWaypoint().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Point } + * + * + */ + public List getWaypoint() { + if (waypoint == null) { + waypoint = new ArrayList<>(); + } + return this.waypoint; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Point.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Point.java new file mode 100644 index 00000000000..52203f24b08 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Point.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +public class Point extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.Point { + + protected double x; + protected double y; + + /** + * Gets the value of the x property. + * + */ + public double getX() { + return x; + } + + /** + * Sets the value of the x property. + * + */ + public void setX(double value) { + this.x = value; + } + + /** + * Gets the value of the y property. + * + */ + public double getY() { + return y; + } + + /** + * Sets the value of the y property. + * + */ + public void setY(double value) { + this.y = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Shape.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Shape.java new file mode 100644 index 00000000000..5088e382d54 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Shape.java @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +public abstract class Shape extends DiagramElement implements org.kie.dmn.model.api.dmndi.Shape { + + protected org.kie.dmn.model.api.dmndi.Bounds bounds; + + /** + * the optional bounds of the shape relative to the origin of its nesting plane. + * + * @return + * possible object is + * {@link Bounds } + * + */ + public org.kie.dmn.model.api.dmndi.Bounds getBounds() { + return bounds; + } + + /** + * Sets the value of the bounds property. + * + * @param value + * allowed object is + * {@link Bounds } + * + */ + public void setBounds(org.kie.dmn.model.api.dmndi.Bounds value) { + this.bounds = value; + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Style.java b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Style.java new file mode 100644 index 00000000000..393e2e7ccf5 --- /dev/null +++ b/kie-dmn/kie-dmn-model/src/main/java/org/kie/dmn/model/v1_5/dmndi/Style.java @@ -0,0 +1,125 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.dmn.model.v1_5.dmndi; + +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; +import org.w3c.dom.Element; + +import java.util.ArrayList; +import java.util.List; + + +public abstract class Style extends KieDMNModelInstrumentedBase implements org.kie.dmn.model.api.dmndi.Style { + + protected org.kie.dmn.model.api.dmndi.Style.Extension extension; + protected String id; + + /** + * Gets the value of the extension property. + * + * @return + * possible object is + * {@link Extension } + * + */ + public org.kie.dmn.model.api.dmndi.Style.Extension getExtension() { + return extension; + } + + /** + * Sets the value of the extension property. + * + * @param value + * allowed object is + * {@link Extension } + * + */ + public void setExtension(org.kie.dmn.model.api.dmndi.Style.Extension value) { + this.extension = value; + } + + /** + * Gets the value of the id property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Sets the value of the id property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + public static class Extension implements org.kie.dmn.model.api.dmndi.Style.Extension { + + protected List any; + + /** + * Gets the value of the any property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the any property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getAny().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link Element } + * + * + */ + public List getAny() { + if (any == null) { + any = new ArrayList<>(); + } + return this.any; + } + + } + + public static class IDREFStubStyle extends Style { + + public IDREFStubStyle(String id) { + this.id = id; + } + } + +} diff --git a/kie-dmn/kie-dmn-model/src/main/resources/META-INF/native-image/org.kie/kie-dmn-model/reflect-config.json b/kie-dmn/kie-dmn-model/src/main/resources/META-INF/native-image/org.kie/kie-dmn-model/reflect-config.json index 5d824efb195..e67c751cd30 100644 --- a/kie-dmn/kie-dmn-model/src/main/resources/META-INF/native-image/org.kie/kie-dmn-model/reflect-config.json +++ b/kie-dmn/kie-dmn-model/src/main/resources/META-INF/native-image/org.kie/kie-dmn-model/reflect-config.json @@ -1969,5 +1969,653 @@ "allPublicMethods": true, "allDeclaredClasses": true, "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Bounds", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Color", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNDI", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNDecisionServiceDividerLine", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNDiagram", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNEdge", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNLabel", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNShape", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DMNStyle", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Diagram", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DiagramElement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.DiagramElement$Extension", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Dimension", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Edge", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Point", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Shape", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Style", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.dmndi.Style$IDREFStubStyle", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TArtifact", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TAssociation", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TAuthorityRequirement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TBinding", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TBusinessContextElement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TBusinessKnowledgeModel", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TChildExpression", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TConditional", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TContext", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TContextEntry", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDMNElement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDMNElement$TExtensionElements", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDMNElementReference", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDRGElement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDecision", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDecisionRule", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDecisionService", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDecisionTable", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TDefinitions", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TElementCollection", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TEvery", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TExpression", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TFilter", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TFor", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TFunctionDefinition", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TFunctionItem", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TGroup", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TImport", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TImportedValues", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInformationItem", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInformationRequirement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInputClause", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInputData", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInvocable", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TInvocation", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TItemDefinition", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TIterator", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TKnowledgeRequirement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TKnowledgeSource", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TList", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TLiteralExpression", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TNamedElement", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TOrganizationUnit", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TOutputClause", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TPerformanceIndicator", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TQuantified", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TRelation", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TRuleAnnotation", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TRuleAnnotationClause", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TSome", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TTextAnnotation", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TTypedChildExpression", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "org.kie.dmn.model.v1_5.TUnaryTests", + "allDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true } ] diff --git a/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/DMNValidatorImpl.java b/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/DMNValidatorImpl.java index 0a5df20a656..2f7cfb291e2 100644 --- a/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/DMNValidatorImpl.java +++ b/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/DMNValidatorImpl.java @@ -140,6 +140,20 @@ public class DMNValidatorImpl implements DMNValidator { } } + static final Schema schemav1_5; + static { + try { + schemav1_5 = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) + .newSchema(new Source[]{new StreamSource(DMNValidatorImpl.class.getResourceAsStream("org/omg/spec/DMN/20230324/DC.xsd")), + new StreamSource(DMNValidatorImpl.class.getResourceAsStream("org/omg/spec/DMN/20230324/DI.xsd")), + new StreamSource(DMNValidatorImpl.class.getResourceAsStream("org/omg/spec/DMN/20230324/DMNDI15.xsd")), + new StreamSource(DMNValidatorImpl.class.getResourceAsStream("org/omg/spec/DMN/20230324/DMN15.xsd")) + }); + } catch (SAXException e) { + throw new RuntimeException("Unable to initialize correctly DMNValidator.", e); + } + } + private Schema overrideSchema = null; private final List dmnProfiles = new ArrayList<>(); private final DMNCompilerConfiguration dmnCompilerConfig; @@ -549,9 +563,11 @@ private Schema determineSchema(DMN_VERSION dmnVersion) { case DMN_v1_3: return schemav1_3; case DMN_v1_4: + return schemav1_4; + case DMN_v1_5: case UNKNOWN: default: - return schemav1_4; + return schemav1_5; } } diff --git a/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/ValidatorUtil.java b/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/ValidatorUtil.java index 0ba53160bee..020eb45ec9d 100644 --- a/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/ValidatorUtil.java +++ b/kie-dmn/kie-dmn-validation/src/main/java/org/kie/dmn/validation/ValidatorUtil.java @@ -32,9 +32,14 @@ import org.kie.dmn.model.api.ItemDefinition; import org.kie.dmn.model.api.KnowledgeRequirement; import org.kie.dmn.model.api.NamedElement; +import org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase; + +import javax.xml.namespace.QName; public final class ValidatorUtil { + public static final QName KIE_MODEL_NAME_QNAME = new QName(KieDMNModelInstrumentedBase.URI_KIE, "modelName"); + public static String rightOfHash(final String input) { return input.substring(input.indexOf("#") + 1); } diff --git a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl index e9ab5c9060d..2eed407b5fc 100644 --- a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl +++ b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/DMNv1x/dmn-validation-rules.drl @@ -25,6 +25,7 @@ import org.kie.dmn.feel.runtime.events.SyntaxErrorEvent; import org.kie.dmn.api.feel.runtime.events.FEELEvent; import org.kie.dmn.core.util.Msg; import org.kie.dmn.core.compiler.ImportDMNResolverUtil; +import org.kie.dmn.validation.ValidatorUtil; import function org.kie.dmn.validation.ValidatorUtil.rightOfHash; import function org.kie.dmn.validation.ValidatorUtil.getRootItemDef; @@ -37,7 +38,7 @@ rule MISSING_IMPORT_p1 when $elemRef : Import( ImportDMNResolverUtil.whichImportType(this) == ImportDMNResolverUtil.ImportType.DMN, $importedNS : namespace, - getAdditionalAttributes().get(org.kie.dmn.model.v1_1.TImport.MODELNAME_QNAME) == null ) + getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) == null ) not( Definitions( namespace == $importedNS ) from entry-point "DMNImports" ) then reporter.report(DMNMessage.Severity.ERROR, $elemRef, Msg.IMPORT_NOT_FOUND_FOR_NODE, $importedNS, $elemRef.getIdentifierString()); @@ -47,8 +48,8 @@ rule MISSING_IMPORT_p2 when $elemRef : Import( ImportDMNResolverUtil.whichImportType(this) == ImportDMNResolverUtil.ImportType.DMN, $importedNS : namespace, - getAdditionalAttributes().get(org.kie.dmn.model.v1_1.TImport.MODELNAME_QNAME) != null, - $importedName : getAdditionalAttributes().get(org.kie.dmn.model.v1_1.TImport.MODELNAME_QNAME) ) + getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) != null, + $importedName : getAdditionalAttributes().get(ValidatorUtil.KIE_MODEL_NAME_QNAME) ) not( Definitions( namespace == $importedNS, name == $importedName ) from entry-point "DMNImports" ) then reporter.report(DMNMessage.Severity.ERROR, $elemRef, Msg.IMPORT_NOT_FOUND_FOR_NODE, $importedNS + $importedName, $elemRef.getIdentifierString()); diff --git a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DC.xsd b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DC.xsd new file mode 100644 index 00000000000..6f7926fb11b --- /dev/null +++ b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DC.xsd @@ -0,0 +1,159 @@ + + + + + + + + + + + Color is a data type that represents a color value in the RGB format. + + + + + + + + + + + + + + + + A Point specifies an location in some x-y coordinate system. + + + + + + + + Dimension specifies two lengths (width and height) along the x and y axes in some x-y coordinate system. + + + + + + + + Bounds specifies a rectangular area in some x-y coordinate system that is defined by a location (x and y) and a size (width and height). + + + + + + + + + + AlignmentKind enumerates the possible options for alignment for layout purposes. + + + + + + + + + + + KnownColor is an enumeration of 17 known colors. + + + + + a color with a value of #800000 + + + + + a color with a value of #FF0000 + + + + + a color with a value of #FFA500 + + + + + a color with a value of #FFFF00 + + + + + a color with a value of #808000 + + + + + a color with a value of #800080 + + + + + a color with a value of #FF00FF + + + + + a color with a value of #FFFFFF + + + + + a color with a value of #00FF00 + + + + + a color with a value of #008000 + + + + + a color with a value of #000080 + + + + + a color with a value of #0000FF + + + + + a color with a value of #00FFFF + + + + + a color with a value of #008080 + + + + + a color with a value of #000000 + + + + + a color with a value of #C0C0C0 + + + + + a color with a value of #808080 + + + + + + diff --git a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DI.xsd b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DI.xsd new file mode 100644 index 00000000000..a79b4f798d8 --- /dev/null +++ b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DI.xsd @@ -0,0 +1,115 @@ + + + + + + The Diagram Interchange (DI) package enables interchange of graphical information that language users have control over, such as position of nodes and line routing points. Language specifications specialize elements of DI to define diagram interchange elements for a language. + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + DiagramElement is the abstract super type of all elements in diagrams, including diagrams themselves. When contained in a diagram, diagram elements are laid out relative to the diagram's origin. + + + + + + + + + + + + an optional locally-owned style for this diagram element. + + + + + + a reference to an optional shared style element for this diagram element. + + + + + + + + + + + + the name of the diagram. + + + + + the documentation of the diagram. + + + + + the resolution of the diagram expressed in user units per inch. + + + + + + + + + + + + + the optional bounds of the shape relative to the origin of its nesting plane. + + + + + + + + + + + + + + an optional list of points relative to the origin of the nesting diagram that specifies the connected line segments of the edge + + + + + + + + + + Style contains formatting properties that affect the appearance or style of diagram elements, including diagram themselves. + + + + + + + + + + + + + + + diff --git a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMN15.xsd b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMN15.xsd new file mode 100644 index 00000000000..382388d0e7e --- /dev/null +++ b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMN15.xsd @@ -0,0 +1,587 @@ + + + + + + + Include the DMN Diagram Interchange (DI) schema + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMNDI15.xsd b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMNDI15.xsd new file mode 100644 index 00000000000..87e84f9cf89 --- /dev/null +++ b/kie-dmn/kie-dmn-validation/src/main/resources/org/kie/dmn/validation/org/omg/spec/DMN/20230324/DMNDI15.xsd @@ -0,0 +1,102 @@ + + + + + + + + + + + This element should never be instantiated directly, but rather concrete implementation should. It is placed there only to be referred in the sequence + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/DRGELEM_NOT_UNIQUE.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/DRGELEM_NOT_UNIQUE.dmn index 09c0276d042..e1db3e8fe5b 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/DRGELEM_NOT_UNIQUE.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/DRGELEM_NOT_UNIQUE.dmn @@ -17,9 +17,9 @@ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/RELATION_DUP_COLUMN.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/RELATION_DUP_COLUMN.dmn index 29354bef73b..4630feeff41 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/RELATION_DUP_COLUMN.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/RELATION_DUP_COLUMN.dmn @@ -17,9 +17,9 @@ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/UNKNOWN_VARIABLE.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/UNKNOWN_VARIABLE.dmn index 6301d20c556..cca0810e86b 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/UNKNOWN_VARIABLE.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/UNKNOWN_VARIABLE.dmn @@ -17,9 +17,9 @@ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/businesscontext/ORG_UNIT_DECISION_MADE_WRONG_TYPE.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/businesscontext/ORG_UNIT_DECISION_MADE_WRONG_TYPE.dmn index 89ed9ed9cf1..e9e1dc8767c 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/businesscontext/ORG_UNIT_DECISION_MADE_WRONG_TYPE.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/businesscontext/ORG_UNIT_DECISION_MADE_WRONG_TYPE.dmn @@ -17,9 +17,9 @@ + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/context/CONTEXT_DUP_ENTRY.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/context/CONTEXT_DUP_ENTRY.dmn index f10de329365..a8b51614c5c 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/context/CONTEXT_DUP_ENTRY.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/context/CONTEXT_DUP_ENTRY.dmn @@ -17,9 +17,9 @@ + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingDecisionInput.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingDecisionInput.dmn index 543f08dc9ab..311bec7253d 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingDecisionInput.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingDecisionInput.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingEncapsulated.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingEncapsulated.dmn index 69f60ae7a31..086e745a8e3 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingEncapsulated.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingEncapsulated.dmn @@ -1,4 +1,4 @@ - + diff --git a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingInputData.dmn b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingInputData.dmn index f9c5e2c67c0..6d047677146 100644 --- a/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingInputData.dmn +++ b/kie-dmn/kie-dmn-validation/src/test/resources/org/kie/dmn/validation/decisionservice/DS1ofEach_missingInputData.dmn @@ -1,4 +1,4 @@ - +