| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
package org.kuali.student.r2.core.process.service; |
| 6 | |
|
| 7 | |
import java.util.ArrayList; |
| 8 | |
import java.util.Collections; |
| 9 | |
import java.util.Comparator; |
| 10 | |
import java.util.Date; |
| 11 | |
import java.util.HashMap; |
| 12 | |
import java.util.List; |
| 13 | |
import java.util.Map; |
| 14 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
| 15 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 16 | |
import org.kuali.student.r2.common.dto.MetaInfo; |
| 17 | |
|
| 18 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 19 | |
|
| 20 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 21 | |
import org.kuali.student.r2.common.exceptions.AlreadyExistsException; |
| 22 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 23 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 24 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 25 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 26 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 27 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 28 | |
import org.kuali.student.r2.common.exceptions.ReadOnlyException; |
| 29 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 30 | |
import org.kuali.student.r2.common.util.constants.ProcessServiceConstants; |
| 31 | |
import org.kuali.student.r2.core.process.dto.CheckInfo; |
| 32 | |
import org.kuali.student.r2.core.process.dto.InstructionInfo; |
| 33 | |
import org.kuali.student.r2.core.process.dto.ProcessCategoryInfo; |
| 34 | |
import org.kuali.student.r2.core.process.dto.ProcessInfo; |
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | 0 | public class ProcessServiceMockImpl implements ProcessService { |
| 41 | |
|
| 42 | 0 | private Map<String, CheckInfo> checks = new HashMap<String, CheckInfo>(); |
| 43 | 0 | private Map<String, ProcessInfo> processes = new HashMap<String, ProcessInfo>(); |
| 44 | 0 | private Map<String, InstructionInfo> instructions = new HashMap<String, InstructionInfo>(); |
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
private MetaInfo newMeta(ContextInfo context) { |
| 49 | 0 | MetaInfo meta = new MetaInfo(); |
| 50 | 0 | meta.setCreateId(context.getPrincipalId()); |
| 51 | 0 | meta.setCreateTime(new Date()); |
| 52 | 0 | meta.setUpdateId(context.getPrincipalId()); |
| 53 | 0 | meta.setUpdateTime(meta.getCreateTime()); |
| 54 | 0 | meta.setVersionInd("0"); |
| 55 | 0 | return meta; |
| 56 | |
} |
| 57 | |
|
| 58 | |
private StatusInfo newStatus() { |
| 59 | 0 | StatusInfo status = new StatusInfo(); |
| 60 | 0 | status.setSuccess(Boolean.TRUE); |
| 61 | 0 | return status; |
| 62 | |
} |
| 63 | |
|
| 64 | |
private MetaInfo updateMeta(MetaInfo old, ContextInfo context) { |
| 65 | 0 | MetaInfo meta = new MetaInfo(old); |
| 66 | 0 | meta.setUpdateId(context.getPrincipalId()); |
| 67 | 0 | meta.setUpdateTime(new Date()); |
| 68 | 0 | meta.setVersionInd((Integer.parseInt(meta.getVersionInd()) + 1) + ""); |
| 69 | 0 | return meta; |
| 70 | |
} |
| 71 | |
|
| 72 | |
@Override |
| 73 | |
public StatusInfo addProcessToProcessCategory(String processKey, String processCategoryId, ContextInfo contextInfo) throws AlreadyExistsException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 74 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 75 | |
} |
| 76 | |
|
| 77 | |
@Override |
| 78 | |
public CheckInfo createCheck(String checkKey, CheckInfo checkInfo, ContextInfo contextInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 79 | 0 | if (checks.containsKey(checkInfo.getKey())) { |
| 80 | 0 | throw new AlreadyExistsException(checkInfo.getKey()); |
| 81 | |
} |
| 82 | 0 | CheckInfo copy = new CheckInfo(checkInfo); |
| 83 | 0 | copy.setMeta(newMeta(contextInfo)); |
| 84 | 0 | checks.put(copy.getKey(), copy); |
| 85 | 0 | return new CheckInfo(copy); |
| 86 | |
} |
| 87 | |
|
| 88 | |
@Override |
| 89 | |
public InstructionInfo createInstruction(String processKey, String checkKey, InstructionInfo instructionInfo, ContextInfo contextInfo) throws DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 90 | 0 | InstructionInfo copy = new InstructionInfo(instructionInfo); |
| 91 | 0 | copy.setId(instructions.size() + ""); |
| 92 | 0 | copy.setMeta(newMeta(contextInfo)); |
| 93 | 0 | instructions.put(copy.getId(), copy); |
| 94 | 0 | return new InstructionInfo(copy); |
| 95 | |
} |
| 96 | |
|
| 97 | |
@Override |
| 98 | |
public ProcessInfo createProcess(String processKey, ProcessInfo processInfo, ContextInfo contextInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 99 | 0 | if (processes.containsKey(processInfo.getKey())) { |
| 100 | 0 | throw new AlreadyExistsException(processInfo.getKey()); |
| 101 | |
} |
| 102 | 0 | ProcessInfo copy = new ProcessInfo(processInfo); |
| 103 | 0 | copy.setMeta(newMeta(contextInfo)); |
| 104 | 0 | processes.put(copy.getKey(), copy); |
| 105 | 0 | return new ProcessInfo(copy); |
| 106 | |
} |
| 107 | |
|
| 108 | |
@Override |
| 109 | |
public ProcessCategoryInfo createProcessCategory(ProcessCategoryInfo processInfo, ContextInfo contextInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 110 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 111 | |
} |
| 112 | |
|
| 113 | |
@Override |
| 114 | |
public StatusInfo deleteCheck(String checkKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 115 | 0 | if (this.checks.remove(checkKey) == null) { |
| 116 | 0 | throw new DoesNotExistException(checkKey); |
| 117 | |
} |
| 118 | 0 | return newStatus(); |
| 119 | |
} |
| 120 | |
|
| 121 | |
@Override |
| 122 | |
public StatusInfo deleteInstruction(String instructionId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 123 | 0 | if (this.instructions.remove(instructionId) == null) { |
| 124 | 0 | throw new DoesNotExistException(instructionId); |
| 125 | |
} |
| 126 | 0 | return newStatus(); |
| 127 | |
} |
| 128 | |
|
| 129 | |
@Override |
| 130 | |
public StatusInfo deleteProcess(String processKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 131 | 0 | if (this.processes.remove(processKey) == null) { |
| 132 | 0 | throw new DoesNotExistException(processKey); |
| 133 | |
} |
| 134 | 0 | return newStatus(); |
| 135 | |
} |
| 136 | |
|
| 137 | |
@Override |
| 138 | |
public StatusInfo deleteProcessCategory(String processCategoryId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 139 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 140 | |
} |
| 141 | |
|
| 142 | |
@Override |
| 143 | |
public CheckInfo getCheck(String checkKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 144 | 0 | CheckInfo info = this.checks.get(checkKey); |
| 145 | 0 | if (info == null) { |
| 146 | 0 | throw new DoesNotExistException(checkKey); |
| 147 | |
} |
| 148 | 0 | return new CheckInfo(info); |
| 149 | |
} |
| 150 | |
|
| 151 | |
@Override |
| 152 | |
public List<String> getCheckKeysByType(String checkTypeKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 153 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 154 | |
} |
| 155 | |
|
| 156 | |
@Override |
| 157 | |
public List<CheckInfo> getChecksByIds(List<String> checkKeys, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 158 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 159 | |
} |
| 160 | |
|
| 161 | |
@Override |
| 162 | |
public InstructionInfo getInstruction(String instructionId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 163 | 0 | InstructionInfo info = this.instructions.get(instructionId); |
| 164 | 0 | if (info == null) { |
| 165 | 0 | throw new DoesNotExistException(instructionId); |
| 166 | |
} |
| 167 | 0 | return new InstructionInfo(info); |
| 168 | |
} |
| 169 | |
|
| 170 | |
@Override |
| 171 | |
public List<String> getInstructionIdsByType(String instructionTypeKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 172 | 0 | List<String> list = new ArrayList<String>(); |
| 173 | 0 | for (InstructionInfo info : this.instructions.values()) { |
| 174 | 0 | if (info.getTypeKey().equals(instructionTypeKey)) { |
| 175 | 0 | list.add(info.getId()); |
| 176 | |
} |
| 177 | |
} |
| 178 | 0 | return list; |
| 179 | |
} |
| 180 | |
|
| 181 | |
@Override |
| 182 | |
public List<InstructionInfo> getInstructionsByCheck(String checkKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 183 | 0 | List<InstructionInfo> list = new ArrayList<InstructionInfo>(); |
| 184 | 0 | for (InstructionInfo info : this.instructions.values()) { |
| 185 | 0 | if (info.getCheckKey().equals(checkKey)) { |
| 186 | 0 | list.add(info); |
| 187 | |
} |
| 188 | |
} |
| 189 | 0 | return list; |
| 190 | |
} |
| 191 | |
|
| 192 | |
@Override |
| 193 | |
public List<InstructionInfo> getInstructionsByIds(List<String> instructionIds, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 194 | 0 | List<InstructionInfo> list = new ArrayList<InstructionInfo>(); |
| 195 | 0 | for (String id : instructionIds) { |
| 196 | 0 | InstructionInfo info = this.getInstruction(id, contextInfo); |
| 197 | 0 | list.add(info); |
| 198 | 0 | } |
| 199 | 0 | return list; |
| 200 | |
} |
| 201 | |
|
| 202 | |
@Override |
| 203 | |
public List<InstructionInfo> getInstructionsByProcess(String processKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 204 | 0 | List<InstructionInfo> list = new ArrayList<InstructionInfo>(); |
| 205 | 0 | for (InstructionInfo info : this.instructions.values()) { |
| 206 | 0 | if (info.getProcessKey().equals(processKey)) { |
| 207 | 0 | list.add(info); |
| 208 | |
} |
| 209 | |
} |
| 210 | 0 | return list; |
| 211 | |
} |
| 212 | |
|
| 213 | |
@Override |
| 214 | |
public List<InstructionInfo> getInstructionsByProcessAndCheck(String checkKey, String processKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 215 | 0 | List<InstructionInfo> list = new ArrayList<InstructionInfo>(); |
| 216 | 0 | for (InstructionInfo info : this.getInstructionsByCheck(checkKey, contextInfo)) { |
| 217 | 0 | if (info.getProcessKey().equals(processKey)) { |
| 218 | 0 | list.add(info); |
| 219 | |
} |
| 220 | |
} |
| 221 | 0 | return list; |
| 222 | |
} |
| 223 | |
|
| 224 | |
@Override |
| 225 | |
public List<InstructionInfo> getInstructionsForEvaluation(String processKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 226 | 0 | List<InstructionInfo> list = new ArrayList<InstructionInfo>(); |
| 227 | 0 | for (InstructionInfo info : this.getInstructionsByProcess(processKey, contextInfo)) { |
| 228 | 0 | if (info.getStateKey().equals(ProcessServiceConstants.INSTRUCTION_ENABLED_STATE_KEY)) { |
| 229 | 0 | list.add(info); |
| 230 | |
} |
| 231 | |
} |
| 232 | 0 | Collections.sort(list, new PositionComparator ()); |
| 233 | 0 | return list; |
| 234 | |
} |
| 235 | |
|
| 236 | 0 | private static class PositionComparator implements Comparator { |
| 237 | |
|
| 238 | |
@Override |
| 239 | |
public int compare(Object o1, Object o2) { |
| 240 | 0 | InstructionInfo info1 = (InstructionInfo) o1; |
| 241 | |
|
| 242 | 0 | InstructionInfo info2 = (InstructionInfo) o2; |
| 243 | 0 | Integer i1 = info1.getPosition(); |
| 244 | 0 | if (i1 == null) { |
| 245 | 0 | i1 = 0; |
| 246 | |
} |
| 247 | 0 | Integer i2 = info2.getPosition(); |
| 248 | 0 | if (i2 == null) { |
| 249 | 0 | i2 = 0; |
| 250 | |
} |
| 251 | 0 | return i1.compareTo(i2); |
| 252 | |
} |
| 253 | |
} |
| 254 | |
|
| 255 | |
@Override |
| 256 | |
public ProcessInfo getProcess(String processKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 257 | 0 | ProcessInfo info = this.processes.get(processKey); |
| 258 | 0 | if (info == null) { |
| 259 | 0 | throw new DoesNotExistException(processKey); |
| 260 | |
} |
| 261 | 0 | return new ProcessInfo(info); |
| 262 | |
} |
| 263 | |
|
| 264 | |
@Override |
| 265 | |
public List<ProcessCategoryInfo> getProcessCategoriesByIds(List<String> processCategoryIds, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 266 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 267 | |
} |
| 268 | |
|
| 269 | |
@Override |
| 270 | |
public List<ProcessCategoryInfo> getProcessCategoriesForProcess(String processKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 271 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 272 | |
} |
| 273 | |
|
| 274 | |
@Override |
| 275 | |
public ProcessCategoryInfo getProcessCategory(String processCategoryId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 276 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 277 | |
} |
| 278 | |
|
| 279 | |
@Override |
| 280 | |
public List<String> getProcessCategoryIdsByType(String processTypeKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 281 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 282 | |
} |
| 283 | |
|
| 284 | |
@Override |
| 285 | |
public List<String> getProcessKeysByType(String processTypeKey, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 286 | 0 | List<String> list = new ArrayList<String>(); |
| 287 | 0 | for (ProcessInfo info : this.processes.values()) { |
| 288 | 0 | if (info.getTypeKey().equals(processTypeKey)) { |
| 289 | 0 | list.add(info.getKey()); |
| 290 | |
} |
| 291 | |
} |
| 292 | 0 | return list; |
| 293 | |
} |
| 294 | |
|
| 295 | |
@Override |
| 296 | |
public List<ProcessInfo> getProcessesByKeys(List<String> processKeys, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 297 | 0 | List<ProcessInfo> list = new ArrayList<ProcessInfo>(); |
| 298 | 0 | for (String key : processKeys) { |
| 299 | 0 | ProcessInfo info = this.getProcess(key, contextInfo); |
| 300 | 0 | list.add(info); |
| 301 | 0 | } |
| 302 | 0 | return list; |
| 303 | |
} |
| 304 | |
|
| 305 | |
@Override |
| 306 | |
public List<ProcessInfo> getProcessesForProcessCategory(String processCategoryId, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 307 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 308 | |
} |
| 309 | |
|
| 310 | |
@Override |
| 311 | |
public StatusInfo removeProcessFromProcessCategory(String processKey, String processCategoryId, ContextInfo contextInfo) throws AlreadyExistsException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 312 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 313 | |
} |
| 314 | |
|
| 315 | |
@Override |
| 316 | |
public List<String> searchForCheckKeys(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 317 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 318 | |
} |
| 319 | |
|
| 320 | |
@Override |
| 321 | |
public List<CheckInfo> searchForChecks(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 322 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 323 | |
} |
| 324 | |
|
| 325 | |
@Override |
| 326 | |
public List<String> searchForInstructionIds(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 327 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 328 | |
} |
| 329 | |
|
| 330 | |
@Override |
| 331 | |
public List<InstructionInfo> searchForInstructions(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 332 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 333 | |
} |
| 334 | |
|
| 335 | |
@Override |
| 336 | |
public List<ProcessCategoryInfo> searchForProcessCategories(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 337 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 338 | |
} |
| 339 | |
|
| 340 | |
@Override |
| 341 | |
public List<String> searchForProcessCategoryIds(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 342 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 343 | |
} |
| 344 | |
|
| 345 | |
@Override |
| 346 | |
public List<String> searchForProcessKeys(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 347 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 348 | |
} |
| 349 | |
|
| 350 | |
@Override |
| 351 | |
public List<ProcessInfo> searchForProcesss(QueryByCriteria criteria, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 352 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 353 | |
} |
| 354 | |
|
| 355 | |
@Override |
| 356 | |
public CheckInfo updateCheck(String checkKey, CheckInfo checkInfo, ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 357 | 0 | CheckInfo copy = new CheckInfo(checkInfo); |
| 358 | 0 | CheckInfo old = this.getCheck(checkKey, contextInfo); |
| 359 | 0 | if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { |
| 360 | 0 | throw new VersionMismatchException(old.getMeta().getVersionInd()); |
| 361 | |
} |
| 362 | 0 | copy.setMeta(updateMeta(copy.getMeta(), contextInfo)); |
| 363 | 0 | this.checks.put(checkInfo.getKey(), copy); |
| 364 | 0 | return new CheckInfo(copy); |
| 365 | |
} |
| 366 | |
|
| 367 | |
@Override |
| 368 | |
public InstructionInfo updateInstruction(String instructionId, InstructionInfo instructionInfo, ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 369 | 0 | InstructionInfo copy = new InstructionInfo(instructionInfo); |
| 370 | 0 | InstructionInfo old = this.getInstruction(instructionId, contextInfo); |
| 371 | 0 | if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { |
| 372 | 0 | throw new VersionMismatchException(old.getMeta().getVersionInd()); |
| 373 | |
} |
| 374 | 0 | copy.setMeta(updateMeta(copy.getMeta(), contextInfo)); |
| 375 | 0 | this.instructions.put(instructionInfo.getId(), copy); |
| 376 | 0 | return new InstructionInfo(copy); |
| 377 | |
} |
| 378 | |
|
| 379 | |
@Override |
| 380 | |
public ProcessInfo updateProcess(String processKey, ProcessInfo processInfo, ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 381 | 0 | ProcessInfo copy = new ProcessInfo(processInfo); |
| 382 | 0 | ProcessInfo old = this.getProcess(processKey, contextInfo); |
| 383 | 0 | if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { |
| 384 | 0 | throw new VersionMismatchException(old.getMeta().getVersionInd()); |
| 385 | |
} |
| 386 | 0 | copy.setMeta(updateMeta(copy.getMeta(), contextInfo)); |
| 387 | 0 | this.processes.put(processInfo.getKey(), copy); |
| 388 | 0 | return new ProcessInfo(copy); |
| 389 | |
} |
| 390 | |
|
| 391 | |
@Override |
| 392 | |
public ProcessCategoryInfo updateProcessCategory(String processCategoryId, ProcessCategoryInfo processInfo, ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 393 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 394 | |
} |
| 395 | |
|
| 396 | |
@Override |
| 397 | |
public List<ValidationResultInfo> validateCheck(String validationTypeKey, CheckInfo checkInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 398 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 399 | |
} |
| 400 | |
|
| 401 | |
@Override |
| 402 | |
public List<ValidationResultInfo> validateInstruction(String validationTypeKey, String processKey, String checkKey, InstructionInfo instructionInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 403 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 404 | |
} |
| 405 | |
|
| 406 | |
@Override |
| 407 | |
public List<ValidationResultInfo> validateProcess(String validationTypeKey, ProcessInfo processInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 408 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 409 | |
} |
| 410 | |
|
| 411 | |
@Override |
| 412 | |
public List<ValidationResultInfo> validateProcessCategory(String validationTypeKey, ProcessCategoryInfo processCategoryInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 413 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 414 | |
} |
| 415 | |
|
| 416 | |
|
| 417 | |
} |