| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.kuali.rice.kew.engine.node.service.impl; |
| 18 |
|
|
| 19 |
|
import java.util.List; |
| 20 |
|
|
| 21 |
|
import org.apache.log4j.Logger; |
| 22 |
|
import org.kuali.rice.kew.engine.node.Branch; |
| 23 |
|
import org.kuali.rice.kew.engine.node.BranchState; |
| 24 |
|
import org.kuali.rice.kew.engine.node.dao.BranchDAO; |
| 25 |
|
import org.kuali.rice.kew.engine.node.service.BranchService; |
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 11 |
Complexity Density: 0.33 |
|
| 29 |
|
public class BranchServiceImpl implements BranchService { |
| 30 |
|
private static final Logger LOG = Logger.getLogger(BranchServiceImpl.class); |
| 31 |
|
|
| 32 |
|
private BranchDAO branchDAO; |
| 33 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 34 |
0
|
public void save(Branch branch){... |
| 35 |
0
|
getBranchDAO().save(branch); |
| 36 |
|
} |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 38 |
0
|
public BranchDAO getBranchDAO() {... |
| 39 |
0
|
return branchDAO; |
| 40 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 41 |
0
|
public void setBranchDAO(BranchDAO branchDAO) {... |
| 42 |
0
|
this.branchDAO = branchDAO; |
| 43 |
|
} |
| 44 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 45 |
0
|
public void deleteBranchStates(List statesToBeDeleted){... |
| 46 |
0
|
getBranchDAO().deleteBranchStates(statesToBeDeleted); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@param |
| 52 |
|
@param |
| 53 |
|
@return |
| 54 |
|
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 55 |
0
|
private BranchState resolveScopedVariable(Branch branch, String name) {... |
| 56 |
0
|
Branch b = branch; |
| 57 |
0
|
while (b != null) { |
| 58 |
0
|
for (BranchState bs: b.getBranchState()) { |
| 59 |
0
|
LOG.debug(bs); |
| 60 |
|
} |
| 61 |
0
|
LOG.debug("Resolving variable: '" + name + "' in scope (branch): '" + branch.getName() + "' (" + branch.getBranchId() + ")"); |
| 62 |
0
|
BranchState bs = b.getBranchState(name); |
| 63 |
0
|
if (bs != null) { |
| 64 |
0
|
return bs; |
| 65 |
|
} |
| 66 |
0
|
b = b.getParentBranch(); |
| 67 |
|
} |
| 68 |
0
|
return null; |
| 69 |
|
} |
| 70 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 71 |
0
|
public String getScopedVariableValue(Branch branch, String name) {... |
| 72 |
0
|
BranchState bs = resolveScopedVariable(branch, name); |
| 73 |
0
|
if (bs != null) return bs.getValue(); |
| 74 |
0
|
return null; |
| 75 |
|
} |
| 76 |
|
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 2 |
Complexity Density: 0.13 |
|
| 77 |
0
|
public String setScopedVariableValue(Branch branch, String name, String value) {... |
| 78 |
0
|
LOG.debug("Setting scoped variable value: " + name + " " + value); |
| 79 |
0
|
BranchState bs = resolveScopedVariable(branch, name); |
| 80 |
0
|
String oldValue = null; |
| 81 |
0
|
if (bs == null) { |
| 82 |
0
|
LOG.debug("Defining new variable named '" + name + "' at scope '" + branch + "'"); |
| 83 |
|
|
| 84 |
0
|
bs = new BranchState(); |
| 85 |
0
|
bs.setKey(name); |
| 86 |
0
|
bs.setValue(value); |
| 87 |
0
|
bs.setBranch(branch); |
| 88 |
0
|
branch.addBranchState(bs); |
| 89 |
|
} else { |
| 90 |
0
|
oldValue = bs.getValue(); |
| 91 |
0
|
LOG.debug("Replacing old value of variable '" + name + "' (" + oldValue + ") at scope '" + branch + "' with new value: " + value); |
| 92 |
0
|
bs.setValue(value); |
| 93 |
|
} |
| 94 |
|
|
| 95 |
0
|
save(bs.getBranch()); |
| 96 |
0
|
return oldValue; |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
} |