- Timestamp:
- 10/14/15 09:30:55 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLInteractionCreator.java
r2038 r2041 231 231 asynch = true; 232 232 } 233 if (!hasOutParameters(operation)) { 234 asynch = true; 235 } 233 236 234 237 if (SOAPUtils.isSOAPRequest(event)) { … … 266 269 } 267 270 if (!asynch && SOAPUtils.isSOAPResponse(event)) { 268 // setup reply and behavior execution specifications 269 MessageOccurrenceSpecification replySendFragment = 270 (MessageOccurrenceSpecification) interaction 271 .createFragment(prefix + "replySendFragment", 272 UMLPackage.Literals.MESSAGE_OCCURRENCE_SPECIFICATION); 273 MessageOccurrenceSpecification replyRecvFragment = 274 (MessageOccurrenceSpecification) interaction 275 .createFragment(prefix + "replyRecvFragment", 276 UMLPackage.Literals.MESSAGE_OCCURRENCE_SPECIFICATION); 277 278 replySendFragment.setCovered(msgTargetLifeline); 279 replyRecvFragment.setCovered(msgSourceLifeline); 280 281 /* 282 * BehaviorExecutionSpecification sourceBehaviorExecutionSpecification = 283 * (BehaviorExecutionSpecification) interaction .createFragment(":" + methodName 284 * + "_sourceBhvExecSpec", 285 * UMLPackage.Literals.BEHAVIOR_EXECUTION_SPECIFICATION); 286 * BehaviorExecutionSpecification targetBehaviorExecutionSpecification = 287 * (BehaviorExecutionSpecification) interaction .createFragment(":" + methodName 288 * + "_targetBhvExecSpec", 289 * UMLPackage.Literals.BEHAVIOR_EXECUTION_SPECIFICATION); 290 * 291 * sourceBehaviorExecutionSpecification.setStart(callSendFragment); 292 * sourceBehaviorExecutionSpecification.setFinish(replyRecvFragment); 293 * targetBehaviorExecutionSpecification.setStart(callRecvFragment); 294 * targetBehaviorExecutionSpecification.setFinish(replySendFragment); 295 */ 296 297 // create reply 298 Message replyMessage = interaction.createMessage(prefix + "_reply"); 299 replyMessage.setMessageSort(MessageSort.REPLY_LITERAL); 300 replyMessage.setSignature(calledOperation); 301 // setReplyMessageParameters(replyMessage, calledOperation); 302 setMessageParameters(replyMessage, calledOperation, event, prefix); 303 replyMessage.setConnector(connector); 304 replyMessage.setSendEvent(replySendFragment); 305 replyMessage.setReceiveEvent(replyRecvFragment); 306 replySendFragment.setMessage(replyMessage); 307 replyRecvFragment.setMessage(replyMessage); 271 if (hasOutParameters(calledOperation)) { 272 // setup reply and behavior execution specifications 273 MessageOccurrenceSpecification replySendFragment = 274 (MessageOccurrenceSpecification) interaction 275 .createFragment(prefix + "replySendFragment", 276 UMLPackage.Literals.MESSAGE_OCCURRENCE_SPECIFICATION); 277 MessageOccurrenceSpecification replyRecvFragment = 278 (MessageOccurrenceSpecification) interaction 279 .createFragment(prefix + "replyRecvFragment", 280 UMLPackage.Literals.MESSAGE_OCCURRENCE_SPECIFICATION); 281 282 replySendFragment.setCovered(msgTargetLifeline); 283 replyRecvFragment.setCovered(msgSourceLifeline); 284 285 /* 286 * BehaviorExecutionSpecification sourceBehaviorExecutionSpecification = 287 * (BehaviorExecutionSpecification) interaction .createFragment(":" + 288 * methodName + "_sourceBhvExecSpec", 289 * UMLPackage.Literals.BEHAVIOR_EXECUTION_SPECIFICATION); 290 * BehaviorExecutionSpecification targetBehaviorExecutionSpecification = 291 * (BehaviorExecutionSpecification) interaction .createFragment(":" + 292 * methodName + "_targetBhvExecSpec", 293 * UMLPackage.Literals.BEHAVIOR_EXECUTION_SPECIFICATION); 294 * 295 * sourceBehaviorExecutionSpecification.setStart(callSendFragment); 296 * sourceBehaviorExecutionSpecification.setFinish(replyRecvFragment); 297 * targetBehaviorExecutionSpecification.setStart(callRecvFragment); 298 * targetBehaviorExecutionSpecification.setFinish(replySendFragment); 299 */ 300 301 // create reply 302 Message replyMessage = interaction.createMessage(prefix + "_reply"); 303 replyMessage.setMessageSort(MessageSort.REPLY_LITERAL); 304 replyMessage.setSignature(calledOperation); 305 // setReplyMessageParameters(replyMessage, calledOperation); 306 setMessageParameters(replyMessage, calledOperation, event, prefix); 307 replyMessage.setConnector(connector); 308 replyMessage.setSendEvent(replySendFragment); 309 replyMessage.setReceiveEvent(replyRecvFragment); 310 replySendFragment.setMessage(replyMessage); 311 replyRecvFragment.setMessage(replyMessage); 312 } 308 313 } 309 314 … … 395 400 multiplicityChosen = internalParameter.getLower(); 396 401 } 397 if (multiplicityChosen > 0) { 402 if (multiplicityChosen == 0 && requestBody == null) { 403 // create parameters node with empty instance specification as value 404 Slot slot = instSpecParameters.createSlot(); 405 slot.setDefiningFeature(internalParameter); 406 407 InstanceValue value = 408 (InstanceValue) slot 409 .createValue(internalParameter.getName() + "_" + 0, 410 internalParameter.getType(), 411 UMLPackage.Literals.INSTANCE_VALUE); 412 InstanceSpecification instSpec = 413 (InstanceSpecification) instSpecPkg 414 .createPackagedElement(prefix + 415 "instspec" + 416 instSpecNumber.intValue() + 417 "_" + 418 internalParameter.getType() 419 .getName(), 420 UMLPackage.Literals.INSTANCE_SPECIFICATION); 421 instSpec.getClassifiers().add((DataType) internalParameter.getType()); 422 instSpecNumber.setValue(instSpecNumber.intValue() + 1); 423 value.setInstance(instSpec); 424 } 425 else if (multiplicityChosen > 0) { 398 426 Slot slot = instSpecParameters.createSlot(); 399 427 slot.setDefiningFeature(internalParameter); … … 677 705 slot.setDefiningFeature(prop); 678 706 for (int i = 0; i < multiplicityChosen; i++) { 679 // TODO maybe not yet correct680 707 org.w3c.dom.Element attributeNode = null; 681 708 if (attributeNodes != null && !attributeNodes.isEmpty()) { … … 797 824 prop.getType().getName()); 798 825 Console.traceln(Level.SEVERE, "attribute is ignored!"); 799 // TODO800 // throw new RuntimeException("unknown primitive type: " +801 // prop.getType().getName());802 826 } 803 827 } … … 973 997 } 974 998 999 /** 1000 * <p> 1001 * Checks if a operation has an output parameter. 1002 * </p> 1003 * 1004 * @param operation 1005 * operation that is checked 1006 * @return true if pilot has an operation 1007 */ 1008 private boolean hasOutParameters(Operation operation) { 1009 if (operation == null) { 1010 throw new RuntimeException("operation must not be null"); 1011 } 1012 for (Parameter param : operation.getOwnedParameters()) { 1013 if (UMLUtils.isOutParameter(param)) { 1014 return true; 1015 } 1016 } 1017 return false; 1018 } 1019 975 1020 // ///////////////////// 976 1021 // DEBUGGING METHODS //
Note: See TracChangeset
for help on using the changeset viewer.