forked from apache/incubator-kie-drools
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring DMNResult to support retrieving decision results by ID an…
…d segregating error messages.
- Loading branch information
Showing
8 changed files
with
206 additions
and
33 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/api/DMNDecisionResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,57 @@ | |||
/* | |||
* Copyright 2016 Red Hat, Inc. and/or its affiliates. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.kie.dmn.core.api; | |||
|
|||
import java.util.List; | |||
|
|||
/** | |||
* Stores the result of the evaluation of a decision | |||
* | |||
*/ | |||
public interface DMNDecisionResult { | |||
|
|||
/** | |||
* Returns the decision ID | |||
* | |||
* @return the decision ID | |||
*/ | |||
String getDecisionId(); | |||
|
|||
/** | |||
* Returns the decision name | |||
* | |||
* @return the decision name | |||
*/ | |||
String getDecisionName(); | |||
|
|||
/** | |||
* Returns the result of the evaluation | |||
* of the decision | |||
* | |||
* @return the result of the decision | |||
*/ | |||
Object getResult(); | |||
|
|||
/** | |||
* Returns a list of DMN messages generated | |||
* during the evaluation of this decision. | |||
* | |||
* @return a list of messages, or an empty list if | |||
* no message was generated | |||
*/ | |||
List<DMNMessage> getMessages(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/impl/DMNDecisionResultImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,77 @@ | |||
/* | |||
* Copyright 2016 Red Hat, Inc. and/or its affiliates. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
package org.kie.dmn.core.impl; | |||
|
|||
import org.kie.dmn.core.api.DMNMessage; | |||
|
|||
import java.util.ArrayList; | |||
import java.util.List; | |||
|
|||
public class DMNDecisionResultImpl | |||
implements org.kie.dmn.core.api.DMNDecisionResult { | |||
private String decisionId; | |||
private String decisionName; | |||
private Object result; | |||
private List<DMNMessage> messages; | |||
|
|||
public DMNDecisionResultImpl(String decisionId, String decisionName) { | |||
this( decisionId, decisionName, null, new ArrayList<>( ) ); | |||
} | |||
|
|||
public DMNDecisionResultImpl(String decisionId, String decisionName, Object result, List<DMNMessage> messages) { | |||
this.decisionId = decisionId; | |||
this.decisionName = decisionName; | |||
this.result = result; | |||
this.messages = messages; | |||
} | |||
|
|||
@Override | |||
public String getDecisionId() { | |||
return decisionId; | |||
} | |||
|
|||
public void setDecisionId(String decisionId) { | |||
this.decisionId = decisionId; | |||
} | |||
|
|||
@Override | |||
public String getDecisionName() { | |||
return decisionName; | |||
} | |||
|
|||
public void setDecisionName(String decisionName) { | |||
this.decisionName = decisionName; | |||
} | |||
|
|||
@Override | |||
public Object getResult() { | |||
return result; | |||
} | |||
|
|||
public void setResult(Object result) { | |||
this.result = result; | |||
} | |||
|
|||
@Override | |||
public List<DMNMessage> getMessages() { | |||
return messages; | |||
} | |||
|
|||
public void setMessages(List<DMNMessage> messages) { | |||
this.messages = messages; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters