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

Add documentation for DmnService and DmnObjectContainer

parent 03e6431e
No related branches found
No related tags found
No related merge requests found
......@@ -5,28 +5,53 @@ import java.util.List;
import org.camunda.bpm.dmn.engine.DmnDecision;
import org.camunda.bpm.model.dmn.DmnModelInstance;
/**
* A container class for storing information about a dmn table with different formats.
*/
public class DmnObjectContainer {
private final List<DmnDecision> dmnDecisions;
private final DmnModelInstance dmnModel;
private final VDmnDefinition vDmnDefinition;
/**
* Create a new Instance of the dmn object container.
*
* @param dmnDecisions the list of {@link DmnDecision}
* @param dmnModel the {@link DmnModelInstance}
* @param vDmnDefinition the {@link VDmnDefinition}
*/
public DmnObjectContainer(
List<DmnDecision> dmnDecisions, DmnModelInstance dmnModel, VDmnDefinition vDmnDefinition) {
this.dmnDecisions = dmnDecisions;
this.dmnModel = dmnModel;
this.vDmnDefinition = vDmnDefinition;
}
/**
* Get the list of dmn decisions.
*
* @return the list of {@link DmnDecision}
*/
public List<DmnDecision> getDmnDecisions() {
return dmnDecisions;
}
/**
* Get the dmn model.
*
* @return the {@link DmnModelInstance}
*/
public DmnModelInstance getDmnModel() {
return dmnModel;
}
/**
* Get the VDmnDefinition.
*
* @return the {@link VDmnDefinition}
*/
public VDmnDefinition getVDmnDefinition() {
return vDmnDefinition;
}
public DmnObjectContainer(
List<DmnDecision> dmnDecisions, DmnModelInstance dmnModel, VDmnDefinition vDmnDefinition) {
this.dmnDecisions = dmnDecisions;
this.dmnModel = dmnModel;
this.vDmnDefinition = vDmnDefinition;
}
}
......@@ -12,11 +12,22 @@ import org.camunda.bpm.dmn.engine.DmnEngineConfiguration;
import org.camunda.bpm.model.dmn.DmnModelInstance;
import org.camunda.bpm.model.dmn.impl.DmnParser;
/**
* Application scoped service, which creates a {@link DmnObjectContainer} with the method {@link
* DmnService#getDmnServiceFromXml(String)}. This container contained the different model types of a
* dmn table.
*/
@ApplicationScoped
public class DmnService {
@Inject SimpleVDmnParser simpleDmnParser;
/**
* Get the {@link DmnObjectContainer} with the given xml string of a dmn table.
*
* @param dmnXmlString the xml of a dmn table
* @return a new {@link DmnObjectContainer}
*/
public DmnObjectContainer getDmnServiceFromXml(String dmnXmlString) {
List<DmnDecision> dmnDecisions =
DmnEngineConfiguration.createDefaultDmnEngineConfiguration()
......@@ -25,7 +36,6 @@ public class DmnService {
DmnModelInstance dmnModel =
new DmnParser()
.parseModelFromStream(IOUtils.toInputStream(dmnXmlString, Charset.defaultCharset()));
VDmnDefinition vDmnDefinition = simpleDmnParser.getVDmnDefinition(dmnModel);
return new DmnObjectContainer(dmnDecisions, dmnModel, vDmnDefinition);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment