|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ProcessImpl.java | 50% | 63% | 56.8% | 60% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* $Id: ProcessImpl.java,v 1.1 2004/12/15 14:18:18 patforna Exp $
|
|
| 3 |
*
|
|
| 4 |
* Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
|
|
| 5 |
* Berne University of Applied Sciences
|
|
| 6 |
* School of Engineering and Information Technology
|
|
| 7 |
* All rights reserved.
|
|
| 8 |
*/
|
|
| 9 |
package bexee.model.process.impl;
|
|
| 10 |
|
|
| 11 |
import bexee.core.ProcessController;
|
|
| 12 |
import bexee.core.ProcessInstance;
|
|
| 13 |
import bexee.model.BPELElementVisitor;
|
|
| 14 |
import bexee.model.InvalidValueException;
|
|
| 15 |
import bexee.model.activity.Activity;
|
|
| 16 |
import bexee.model.activity.CompensationHandler;
|
|
| 17 |
import bexee.model.elements.CorrelationSets;
|
|
| 18 |
import bexee.model.elements.EventHandlers;
|
|
| 19 |
import bexee.model.elements.FaultHandlers;
|
|
| 20 |
import bexee.model.elements.PartnerLinks;
|
|
| 21 |
import bexee.model.elements.Partners;
|
|
| 22 |
import bexee.model.elements.Variables;
|
|
| 23 |
import bexee.model.process.Process;
|
|
| 24 |
import bexee.util.BooleanUtils;
|
|
| 25 |
import bexee.util.StringUtils;
|
|
| 26 |
|
|
| 27 |
/**
|
|
| 28 |
* A default implementation of a <code>Process</code>.
|
|
| 29 |
*
|
|
| 30 |
* @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:18 $
|
|
| 31 |
* @author Patric Fornasier
|
|
| 32 |
* @author Pawel Kowalski
|
|
| 33 |
*/
|
|
| 34 |
public class ProcessImpl implements Process { |
|
| 35 |
|
|
| 36 |
private String name;
|
|
| 37 |
|
|
| 38 |
private String targetNamespace;
|
|
| 39 |
|
|
| 40 |
private String queryLanguage;
|
|
| 41 |
|
|
| 42 |
private String expressionLanguage;
|
|
| 43 |
|
|
| 44 |
private boolean isSuppressJoinFailure; |
|
| 45 |
|
|
| 46 |
private boolean isInstanceCompensable; |
|
| 47 |
|
|
| 48 |
private boolean isAbstractProcess; |
|
| 49 |
|
|
| 50 |
private PartnerLinks partnerLinks;
|
|
| 51 |
|
|
| 52 |
private Partners partners;
|
|
| 53 |
|
|
| 54 |
private Variables variables;
|
|
| 55 |
|
|
| 56 |
private CorrelationSets correlationSets;
|
|
| 57 |
|
|
| 58 |
private FaultHandlers faultHandlers;
|
|
| 59 |
|
|
| 60 |
private CompensationHandler compensationHandler;
|
|
| 61 |
|
|
| 62 |
private EventHandlers eventHandlers;
|
|
| 63 |
|
|
| 64 |
private Activity activity;
|
|
| 65 |
|
|
| 66 |
//**************************************************/
|
|
| 67 |
// c'tors
|
|
| 68 |
//**************************************************/
|
|
| 69 |
|
|
| 70 | 20 |
public ProcessImpl() {
|
| 71 | 20 |
this(null, null, null, null, null, null); |
| 72 |
} |
|
| 73 |
|
|
| 74 |
/**
|
|
| 75 |
* @param name2
|
|
| 76 |
* @param targetNamespace2
|
|
| 77 |
* @param queryLanguage2
|
|
| 78 |
* @param expressionLanguage2
|
|
| 79 |
* @param suppressJoinFailure2
|
|
| 80 |
* @param enableInstanceCompensation
|
|
| 81 |
*/
|
|
| 82 | 52 |
public ProcessImpl(String name, String targetNamespace,
|
| 83 |
String queryLanguage, String expressionLanguage, |
|
| 84 |
String suppressJoinFailure, String enableInstanceCompensation) {
|
|
| 85 |
|
|
| 86 | 52 |
this.name = name;
|
| 87 | 52 |
this.targetNamespace = targetNamespace;
|
| 88 | 52 |
this.queryLanguage = getValidValueOrDefault(queryLanguage,
|
| 89 |
DEFAULT_QUERY_LANGUAGE); |
|
| 90 | 52 |
this.expressionLanguage = getValidValueOrDefault(expressionLanguage,
|
| 91 |
DEFAULT_EXPRESSION_LANGUAGE); |
|
| 92 | 52 |
this.isSuppressJoinFailure = getValidValueOrDefault(
|
| 93 |
suppressJoinFailure, DEFAULT_SUPPRESS_JOIN_FAILURE); |
|
| 94 | 52 |
this.isInstanceCompensable = getValidValueOrDefault(
|
| 95 |
enableInstanceCompensation, |
|
| 96 |
DEFAULT_ENABLE_INSTANCE_COMPENSATION); |
|
| 97 |
} |
|
| 98 |
|
|
| 99 |
//**************************************************/
|
|
| 100 |
// bexee.model.process.Process
|
|
| 101 |
//**************************************************/
|
|
| 102 |
|
|
| 103 | 20 |
public void setName(String name) { |
| 104 | 20 |
this.name = name;
|
| 105 |
} |
|
| 106 |
|
|
| 107 | 56 |
public String getName() {
|
| 108 | 56 |
return name;
|
| 109 |
} |
|
| 110 |
|
|
| 111 | 0 |
public void setTargetNamespace(String targetNamespace) { |
| 112 | 0 |
this.targetNamespace = targetNamespace;
|
| 113 |
} |
|
| 114 |
|
|
| 115 | 4 |
public String getTargetNamespace() {
|
| 116 | 4 |
return targetNamespace;
|
| 117 |
} |
|
| 118 |
|
|
| 119 | 0 |
public void setQueryLanguage(String queryLanguage) { |
| 120 | 0 |
this.queryLanguage = queryLanguage;
|
| 121 |
} |
|
| 122 |
|
|
| 123 | 2 |
public String getQueryLanguage() {
|
| 124 | 2 |
return queryLanguage;
|
| 125 |
} |
|
| 126 |
|
|
| 127 | 0 |
public void setExpressionLanguage(String expressionLanguage) { |
| 128 | 0 |
this.expressionLanguage = expressionLanguage;
|
| 129 |
} |
|
| 130 |
|
|
| 131 | 2 |
public String getExpressionLanguage() {
|
| 132 | 2 |
return expressionLanguage;
|
| 133 |
} |
|
| 134 |
|
|
| 135 | 0 |
public void setSuppressJoinFailure(boolean suppressJoinFailure) { |
| 136 | 0 |
this.isSuppressJoinFailure = suppressJoinFailure;
|
| 137 |
} |
|
| 138 |
|
|
| 139 | 14 |
public boolean isSuppressJoinFailure() { |
| 140 | 14 |
return isSuppressJoinFailure;
|
| 141 |
} |
|
| 142 |
|
|
| 143 | 0 |
public void setEnableInstanceCompensation(boolean isInstanceCompensable) { |
| 144 | 0 |
this.isInstanceCompensable = isInstanceCompensable;
|
| 145 |
} |
|
| 146 |
|
|
| 147 | 2 |
public boolean isInstanceCompensable() { |
| 148 | 2 |
return isInstanceCompensable;
|
| 149 |
} |
|
| 150 |
|
|
| 151 | 0 |
public void setAbstractProcess(boolean isAbstractProcess) { |
| 152 | 0 |
this.isAbstractProcess = isAbstractProcess;
|
| 153 |
} |
|
| 154 |
|
|
| 155 | 12 |
public boolean isAbstractProcess() { |
| 156 | 12 |
return isAbstractProcess;
|
| 157 |
} |
|
| 158 |
|
|
| 159 | 32 |
public void setPartnerLinks(PartnerLinks partnerLinks) { |
| 160 | 32 |
this.partnerLinks = partnerLinks;
|
| 161 |
} |
|
| 162 |
|
|
| 163 | 24 |
public PartnerLinks getPartnerLinks() {
|
| 164 | 24 |
return partnerLinks;
|
| 165 |
} |
|
| 166 |
|
|
| 167 | 0 |
public void setPartners(Partners partners) { |
| 168 | 0 |
this.partners = partners;
|
| 169 |
} |
|
| 170 |
|
|
| 171 | 0 |
public Partners getPartners() {
|
| 172 | 0 |
return partners;
|
| 173 |
} |
|
| 174 |
|
|
| 175 | 30 |
public void setVariables(Variables variables) { |
| 176 | 30 |
this.variables = variables;
|
| 177 |
} |
|
| 178 |
|
|
| 179 | 22 |
public Variables getVariables() {
|
| 180 | 22 |
return variables;
|
| 181 |
} |
|
| 182 |
|
|
| 183 | 0 |
public void setCorrelationSets(CorrelationSets correlationSets) { |
| 184 | 0 |
this.correlationSets = correlationSets;
|
| 185 |
} |
|
| 186 |
|
|
| 187 | 0 |
public CorrelationSets getCorrelationSets() {
|
| 188 | 0 |
return correlationSets;
|
| 189 |
} |
|
| 190 |
|
|
| 191 | 0 |
public void setFaultHandlers(FaultHandlers faultHandlers) { |
| 192 | 0 |
this.faultHandlers = faultHandlers;
|
| 193 |
} |
|
| 194 |
|
|
| 195 | 0 |
public FaultHandlers getFaultHandlers() {
|
| 196 | 0 |
return faultHandlers;
|
| 197 |
} |
|
| 198 |
|
|
| 199 | 0 |
public void setCompensationHandler(CompensationHandler compensationHandler) { |
| 200 | 0 |
this.compensationHandler = compensationHandler;
|
| 201 |
} |
|
| 202 |
|
|
| 203 | 0 |
public CompensationHandler getCompensationHandler() {
|
| 204 | 0 |
return compensationHandler;
|
| 205 |
} |
|
| 206 |
|
|
| 207 | 0 |
public void setEventHandlers(EventHandlers eventHandlers) { |
| 208 | 0 |
this.eventHandlers = eventHandlers;
|
| 209 |
} |
|
| 210 |
|
|
| 211 | 0 |
public EventHandlers getEventHandlers() {
|
| 212 | 0 |
return eventHandlers;
|
| 213 |
} |
|
| 214 |
|
|
| 215 | 26 |
public void activity(Activity activity) { |
| 216 | 26 |
setActivity(activity); |
| 217 |
} |
|
| 218 |
|
|
| 219 | 32 |
public void setActivity(Activity activity) { |
| 220 | 32 |
this.activity = activity;
|
| 221 |
} |
|
| 222 |
|
|
| 223 | 52 |
public Activity getActivity() {
|
| 224 | 52 |
return activity;
|
| 225 |
} |
|
| 226 |
|
|
| 227 |
//**************************************************/
|
|
| 228 |
// bexee.model.BPELElement
|
|
| 229 |
//**************************************************/
|
|
| 230 |
|
|
| 231 | 6 |
public void accept(ProcessController controller, ProcessInstance instance) |
| 232 |
throws Exception {
|
|
| 233 | 6 |
controller.process(this, instance);
|
| 234 |
} |
|
| 235 |
|
|
| 236 | 38 |
public void accept(BPELElementVisitor elementVisitor) { |
| 237 | 38 |
elementVisitor.visit(this);
|
| 238 |
} |
|
| 239 |
|
|
| 240 |
//**************************************************/
|
|
| 241 |
// helper methods
|
|
| 242 |
//**************************************************/
|
|
| 243 |
|
|
| 244 | 104 |
private String getValidValueOrDefault(String value, String defaultValue) {
|
| 245 | 104 |
if (StringUtils.isNullOrEmpty(value)) {
|
| 246 | 104 |
return defaultValue;
|
| 247 |
} else {
|
|
| 248 | 0 |
return value;
|
| 249 |
} |
|
| 250 |
} |
|
| 251 |
|
|
| 252 | 104 |
private boolean getValidValueOrDefault(String value, boolean defaultValue) { |
| 253 | 104 |
try {
|
| 254 | 104 |
return BooleanUtils.strictYesNoToBoolean(value);
|
| 255 |
} catch (InvalidValueException e) {
|
|
| 256 | 84 |
return defaultValue;
|
| 257 |
} |
|
| 258 |
} |
|
| 259 |
|
|
| 260 |
} |
|
||||||||||