Skip to content
Snippets Groups Projects
Commit bf17c544 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Add documentation for VDMN model

parent 025933ca
No related branches found
No related tags found
No related merge requests found
Showing
with 392 additions and 4 deletions
......@@ -7,28 +7,78 @@ import de.unikoblenz.fgbks.core.dmn.domain.ids.ColumnId;
import java.util.List;
import java.util.Optional;
/**
* A column is a abstract interface for the {@link VDmnInputColumn} and {@link VDmnOutputColumn}. A
* column defines the {@link VTypeRef} of the containing values.
*/
public interface VDmnColumn extends VDmnElement {
/**
* Get the {@link VDmnDecisionTable}.
*
* @return the {@link VDmnDecisionTable}
*/
VDmnDecisionTable getDmnDecisionTable();
/**
* Get the list of predefined {@link StringValue}s, if the column has the type {@link
* VTypeRef#STRING} and the model contains these values.
*
* @return the list of {@link StringValue}s or an empty optional
*/
Optional<List<StringValue>> getPredefinedValues();
/**
* Get the {@link Name}, if present.
*
* @return the {@link Name} or an empty optional
*/
Optional<Name> getName();
/**
* Get the {@link Label}, if present.
*
* @return the {@link Label} or an empty optional
*/
Optional<Label> getLabel();
/**
* Get the {@link VTypeRef}.
*
* @return the {@link VTypeRef}
*/
VTypeRef getTypeRef();
/**
* Get the list of {@link VDmnValue}s.
*
* @return the list of {@link VDmnValue}s
*/
List<VDmnValue> getValues();
/**
* Get the {@link ColumnId}.
*
* @return the {@link ColumnId}
*/
default ColumnId getColumnId() {
return (ColumnId) getId();
}
/**
* Get the {@link VDmnDecision}.
*
* @return the {@link VDmnDecision}
*/
default VDmnDecision getDmnDecision() {
return getDmnDecisionTable().getDmnDecision();
}
/**
* Get the {@link VDmnDefinition}.
*
* @return the {@link VDmnDefinition}
*/
default VDmnDefinition getDmnDefinition() {
return getDmnDecisionTable().getDmnDefinition();
}
......
......@@ -3,8 +3,18 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.DecisionId;
import java.util.List;
/**
* The decision node contains the {@link VDmnDecisionTable} and a list of {@link VDmnNode}s, which
* are information requirements for the decision.
*/
public interface VDmnDecision extends VDmnNode {
/**
* Get the list of {@link VDmnNode}, which are are information requirements for the decision. See
* also {@link VDmnNode#getInformationProvidingDecisions()}.
*
* @return the list of {@link VDmnNode}s
*/
List<VDmnNode> getDmnInformationRequirements();
VDmnDecisionTable getDmnDecisionTable();
......
package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.DecisionTableId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.DefinitionId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId;
import java.util.List;
import java.util.stream.Collectors;
import org.camunda.bpm.model.dmn.HitPolicy;
/**
* The decision table contains a list of {@link VDmnColumn}s ({@link VDmnInputColumn}s and {@link
* VDmnOutputColumn}s) and all {@link VDmnRule}s of the table.
*/
public interface VDmnDecisionTable extends VDmnElement {
/**
* Get the {@link VDmnDecision} of the decision table.
*
* @return the {@link VDmnDecision}
*/
VDmnDecision getDmnDecision();
/**
* Get the {@link HitPolicy} of the decision table.
*
* @return the {@link HitPolicy}
*/
HitPolicy getHitPolicy();
/**
* Get all {@link VDmnOutputColumn}s of the decision table.
*
* @return a list of {@link VDmnOutputColumn}s
*/
List<VDmnOutputColumn> getOutputColumns();
/**
* Get all {@link VDmnInputColumn}s of the decision table.
*
* @return a list of {@link VDmnInputColumn}s
*/
List<VDmnInputColumn> getInputColumns();
/**
* Get all {@link VDmnRule}s of the decision table.
*
* @return a list of {@link VDmnRule}s
*/
List<VDmnRule> getRules();
/**
* Get all {@link RuleId}s of the decision table.
*
* @return a list of {@link RuleId}s
*/
default List<RuleId> getRulesIds() {
return getRules().stream()
.map(VDmnRule::getRuleId)
.collect(Collectors.toList()); // TODO optimize (e.g. cache)
}
/**
* Get the {@link DecisionTableId}.
*
* @return the {@link DecisionTableId}
*/
default DecisionTableId getDecisionTableId() {
return (DecisionTableId) getId();
}
/**
* Get the {@link DefinitionId}.
*
* @return the {@link DefinitionId}
*/
default VDmnDefinition getDmnDefinition() {
return getDmnDecision().getDmnDefinition();
}
......
......@@ -4,14 +4,40 @@ import de.unikoblenz.fgbks.core.dmn.domain.ids.AbstractId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.DefinitionId;
import java.util.List;
/**
* The definition is the root element for a dmn table and contains all {@link VDmnDecision}s and all
* {@link VDmnInputData}. Furthermore, all elements of the dmn table can be accessed with {@link
* VDmnDefinition#getElementById}.
*/
public interface VDmnDefinition extends VDmnElement {
/**
* Get the list of {@link VDmnDecision}s.
*
* @return the list of {@link VDmnDecision}s
*/
List<VDmnDecision> getDmnDecisions();
/**
* Get the list of {@link VDmnInputData}s.
*
* @return the list of {@link VDmnInputData}s
*/
List<VDmnInputData> getDmnInputData();
/**
* Get the vdmn element with the given id.
*
* @param id the {@link AbstractId} of the element
* @return the {@link VDmnElement}, or null, if the element was not found
*/
VDmnElement getElementById(AbstractId id);
/**
* Get the {@link DefinitionId}.
*
* @return the {@link DefinitionId}
*/
default DefinitionId getDefinitionId() {
return (DefinitionId) getId();
}
......
......@@ -2,6 +2,16 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.AbstractId;
/**
* A abstract interface for all vdmn elements. All elements contains an id, so this interface only
* provides a function for this id.
*/
public interface VDmnElement {
/**
* Get the {@link AbstractId}.
*
* @return the {@link AbstractId}
*/
AbstractId getId();
}
......@@ -4,20 +4,39 @@ import de.unikoblenz.fgbks.core.dmn.domain.ids.InputExpressionId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.InputId;
import java.util.List;
/**
* This interface represents a input column in a {@link VDmnDecisionTable}. A column contains a list
* of {@link VDmnInputValue}s.
*/
public interface VDmnInputColumn extends VDmnColumn {
// For future work:
// List<VDmnInputColumn> getConnectedOutputColumns();
// List<VDmnNode> getConnectedNodes();
/**
* Get the {@link InputExpressionId}.
*
* @return the {@link InputExpressionId}
*/
default InputExpressionId getInputExpressionId() {
return (InputExpressionId) getId();
}
/**
* Get the {@link InputId}.
*
* @return the {@link InputId}
*/
default InputId getInputId() {
return (InputId) getColumnId();
}
/**
* Get a list of {@link VDmnInputValue}s.
*
* @return the list of {@link VDmnInputValue}s
*/
default List<VDmnInputValue> getInputValues() {
return (List<VDmnInputValue>) (List<?>) getValues();
}
......
......@@ -2,9 +2,17 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.InputDataId;
/**
* A input data node is a information providing information object for {@link VDmnDecision}s.
*/
public interface VDmnInputData extends VDmnNode {
default InputDataId getDecisionId() {
/**
* Get the {@link InputDataId}.
*
* @return the {@link InputDataId}
*/
default InputDataId getInputDataId() {
return (InputDataId) getId();
}
}
......@@ -3,14 +3,33 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.base.utils.boundary.Boundary;
import de.unikoblenz.fgbks.core.dmn.domain.ids.InputEntryId;
/**
* This interface represents a single input value (or cell) in a {@link VDmnDecisionTable}. This is
* a {@link VDmnValue}.
*/
public interface VDmnInputValue extends VDmnValue {
/**
* Get the {@link Boundary} instance of the value.
*
* @return the {@link Boundary} instance of the value
*/
Boundary getBoundary();
/**
* Get the {@link InputEntryId}.
*
* @return the {@link InputEntryId}
*/
default InputEntryId getInputEntryId() {
return (InputEntryId) getId();
}
/**
* Get the {@link VDmnInputColumn}.
*
* @return the {@link VDmnInputColumn}
*/
default VDmnInputColumn getDmnInputColumn() {
return (VDmnInputColumn) getDmnColumn();
}
......
......@@ -4,11 +4,31 @@ import de.unikoblenz.fgbks.base.domain.Name;
import java.util.List;
import java.util.Optional;
/**
* This interface represents a node on DRD level. A node can either be a {@link VDmnDecision} or a
* {@link VDmnInputData} node.
*/
public interface VDmnNode extends VDmnElement {
/**
* Get the {@link VDmnDefinition}.
*
* @return the {@link VDmnDefinition}
*/
VDmnDefinition getDmnDefinition();
/**
* Get a list of {@link VDmnDecision}s, which has this current node as information requirement.
* See also {@link VDmnDecision#getDmnInformationRequirements()}.
*
* @return a list of {@link VDmnDecision}s
*/
List<VDmnDecision> getInformationProvidingDecisions();
/**
* Get the name of the node, if present.
*
* @return an optional {@link Name}
*/
Optional<Name> getName();
}
......@@ -3,16 +3,30 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.OutputId;
import java.util.List;
/**
* This interface represents a output column in a {@link VDmnDecisionTable}. A column contains a
* list of {@link VDmnOutputValue}s.
*/
public interface VDmnOutputColumn extends VDmnColumn {
// For future work:
// TODO: For future work:
// List<VDmnInputColumn> getConnectedInputColumns();
// List<VDmnNode> getConnectedNodes();
/**
* Get the {@link OutputId} of the column.
*
* @return the {@link OutputId}.
*/
default OutputId getOutputId() {
return (OutputId) getColumnId();
}
/**
* Get the list of {@link VDmnOutputValue} of the column.
*
* @return the list of {@link VDmnOutputValue}.
*/
default List<VDmnOutputValue> getDmnOutputValues() {
return (List<VDmnOutputValue>) (List<?>) getValues();
}
......
......@@ -2,12 +2,26 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn;
import de.unikoblenz.fgbks.core.dmn.domain.ids.OutputEntryId;
/**
* This interface represents a single output value (or cell) in a {@link VDmnDecisionTable}. This is
* a {@link VDmnValue}.
*/
public interface VDmnOutputValue extends VDmnValue {
/**
* Get the {@link OutputEntryId}.
*
* @return the {@link OutputEntryId}.
*/
default OutputEntryId getOutputEntryId() {
return (OutputEntryId) getId();
}
/**
* Get the {@link VDmnOutputColumn}.
*
* @return the {@link VDmnOutputColumn}.
*/
default VDmnOutputColumn getDmnOutputColumn() {
return (VDmnOutputColumn) getDmnColumn();
}
......
......@@ -4,24 +4,63 @@ import de.unikoblenz.fgbks.core.dmn.domain.common.RowNumber;
import de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId;
import java.util.List;
/**
* This interface represents a single rule (or row) in a {@link VDmnDecisionTable}. A rule contains
* a list of {@link VDmnInputValue}s and a list of {@link VDmnOutputValue}s.
*/
public interface VDmnRule extends VDmnElement {
/**
* Get the {@link RowNumber} of the rule inside the dmn table.
*
* @return the {@link RowNumber}.
*/
RowNumber getRowNumber();
/**
* Get the {@link VDmnDecisionTable}.
*
* @return the {@link VDmnDecisionTable}.
*/
VDmnDecisionTable getDmnDecisionTable();
/**
* Get a list of {@link VDmnInputValue}s.
*
* @return the list of {@link VDmnInputValue}
*/
List<VDmnInputValue> getDmnInputValues();
/**
* Get a list of {@link VDmnOutputValue}s.
*
* @return the list of {@link VDmnOutputValue}
*/
List<VDmnOutputValue> getDmnOutputValues();
/**
* Get the {@link RuleId} of the {@link VDmnRule}.
*
* @return the {@link RuleId}.
*/
default RuleId getRuleId() {
return (RuleId) getId();
}
/**
* Get the {@link VDmnDecision}.
*
* @return the {@link VDmnDecision}.
*/
default VDmnDecision getDmnDecision() {
return getDmnDecisionTable().getDmnDecision();
}
/**
* Get the {@link VDmnDefinition}.
*
* @return the {@link VDmnDefinition}.
*/
default VDmnDefinition getDmnDefinition() {
return getDmnDecision().getDmnDefinition();
}
......
......@@ -11,60 +11,145 @@ import de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId;
import java.util.List;
import java.util.Optional;
/**
* This interface represents a single value (or cell) in a {@link VDmnDecisionTable}. It can either
* be a {@link VDmnInputValue} (in a {@link VDmnInputColumn}) or a {@link VDmnOutputValue} (in a
* {@link VDmnOutputColumn}). Furthermore each value exists in one {@link VDmnRule}.
*/
public interface VDmnValue extends VDmnElement {
/**
* Get the {@link VDmnRule} of the value.
*
* @return the {@link VDmnRule}
*/
VDmnRule getDmnRule();
/**
* Get the original text of the value.
*
* @return the {@link Text}
*/
Text getText();
/**
* Get the description, if present.
*
* @return the {@link Description} as optional
*/
Optional<Description> getDescription();
/**
* Get the column of the value. Can be a {@link VDmnInputColumn} or a {@link VDmnOutputColumn}.
*
* @return the {@link VDmnColumn}
*/
VDmnColumn getDmnColumn();
/**
* Get the possible string values, which are defined in {@link VDmnColumn#getPredefinedValues()}.
*
* @return an optional list of string values.
*/
default Optional<List<StringValue>> getPossiblePredefinedValues() {
return getDmnColumn().getPredefinedValues();
}
/**
* Get the {@link DefinitionId} of the {@link VDmnDefinition}.
*
* @return the {@link DefinitionId}.
*/
default DefinitionId getDefinitionId() {
return getDmnDefinition().getDefinitionId();
}
/**
* Get the {@link DecisionId} of the {@link VDmnDecision}.
*
* @return the {@link DecisionId}.
*/
default DecisionId getDecisionId() {
return getDmnDecision().getDecisionId();
}
/**
* Get the {@link DecisionTableId} of the {@link VDmnDecisionTable}.
*
* @return the {@link DecisionTableId}.
*/
default DecisionTableId getDecisionTableId() {
return getDmnDecisionTable().getDecisionTableId();
}
/**
* Get the {@link VTypeRef} of the {@link VDmnColumn}.
*
* @return the {@link VTypeRef}.
*/
default VTypeRef getTypeRef() {
return getDmnColumn().getTypeRef();
}
/**
* Get the {@link RuleId} of the {@link VDmnRule}.
*
* @return the {@link RuleId}.
*/
default RuleId getRuleId() {
return getDmnRule().getRuleId();
}
/**
* Get the {@link RowNumber} of the {@link VDmnRule}.
*
* @return the {@link RowNumber}.
*/
default RowNumber getRowNumber() {
return getDmnRule().getRowNumber();
}
/**
* Get a boolean, which determines, if the value is a input value.
*
* @return true, if the value is a input value
*/
default boolean isInputValue() {
return getDmnColumn() instanceof VDmnInputColumn;
}
/**
* Get a boolean, which determines, if the value is a output value.
*
* @return true, if the value is a output value
*/
default boolean isOutputValue() {
return getDmnColumn() instanceof VDmnOutputColumn;
}
/**
* Get the {@link VDmnDecisionTable}.
*
* @return the {@link VDmnDecisionTable}.
*/
default VDmnDecisionTable getDmnDecisionTable() {
return getDmnColumn().getDmnDecisionTable();
}
/**
* Get the {@link VDmnDecision}.
*
* @return the {@link VDmnDecision}.
*/
default VDmnDecision getDmnDecision() {
return getDmnDecisionTable().getDmnDecision();
}
/**
* Get the {@link VDmnDefinition}.
*
* @return the {@link VDmnDefinition}.
*/
default VDmnDefinition getDmnDefinition() {
return getDmnDecision().getDmnDefinition();
}
......
......@@ -46,7 +46,7 @@ public enum VTypeRef {
private Class<? extends Boundary> boundaryClass;
/**
* Get the {@link VTypeRef} with the given name or {@link null}, if no VTypeRef was found with the
* Get the {@link VTypeRef} with the given name or null, if no VTypeRef was found with the
* given name.
*
* @param name the name as String
......@@ -62,7 +62,7 @@ public enum VTypeRef {
}
/**
* Get the {@link VTypeRef} with the given java {@link Class} or {@link null}, if no VTypeRef was
* Get the {@link VTypeRef} with the given java {@link Class} or null, if no VTypeRef was
* found with the given java {@link Class}.
*
* @param javaClass java {@link Class}
......
......@@ -12,6 +12,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* Implementation of {@link VDmnColumn}
*/
public abstract class AbstractVDmnColumnImpl extends AbstractVDmnElement implements VDmnColumn {
protected VDmnDecisionTable dmnDecisionTable;
......
......@@ -3,6 +3,9 @@ package de.unikoblenz.fgbks.core.dmn.domain.vdmn.impl;
import de.unikoblenz.fgbks.core.dmn.domain.ids.AbstractId;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnElement;
/**
* Implementation of {@link VDmnElement}
*/
public abstract class AbstractVDmnElement implements VDmnElement {
protected AbstractId id;
......
......@@ -9,6 +9,9 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* Implementation of {@link VDmnNode}
*/
public abstract class AbstractVDmnNode extends AbstractVDmnElement implements VDmnNode {
protected VDmnDefinition dmnDefinition;
......
......@@ -7,6 +7,9 @@ import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnRule;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnValue;
import java.util.Optional;
/**
* Implementation of {@link VDmnValue}
*/
public abstract class AbstractVDmnValue extends AbstractVDmnElement implements VDmnValue {
protected VDmnRule dmnRule;
......
......@@ -11,6 +11,9 @@ import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.Validate;
/**
* Implementation of {@link VDmnDecision}
*/
public class VDmnDecisionImpl extends AbstractVDmnNode implements VDmnDecision {
private VDmnDecisionTable dmnDecisionTable;
......@@ -31,6 +34,11 @@ public class VDmnDecisionImpl extends AbstractVDmnNode implements VDmnDecision {
return dmnDecisionTable;
}
/**
* Get a new instance of a builder.
*
* @return a new builder instance
*/
public static Builder getBuilder() {
return new VDmnDecisionImpl().new Builder();
}
......
......@@ -12,6 +12,9 @@ import java.util.List;
import org.apache.commons.lang3.Validate;
import org.camunda.bpm.model.dmn.HitPolicy;
/**
* Implementation of {@link VDmnDecisionTable}
*/
public class VDmnDecisionTableImpl extends AbstractVDmnElement implements VDmnDecisionTable {
private VDmnDecision dmnDecision;
......@@ -21,6 +24,7 @@ public class VDmnDecisionTableImpl extends AbstractVDmnElement implements VDmnDe
private List<VDmnRule> dmnRules;
private VDmnDecisionTableImpl() {
super();
dmnOutputColumns = new ArrayList<>();
dmnInputColumns = new ArrayList<>();
dmnRules = new ArrayList<>();
......@@ -51,6 +55,11 @@ public class VDmnDecisionTableImpl extends AbstractVDmnElement implements VDmnDe
return Collections.unmodifiableList(dmnRules);
}
/**
* Get a new instance of a builder.
*
* @return a new builder instance
*/
public static Builder getBuilder() {
return new VDmnDecisionTableImpl().new Builder();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment