Changeset 1913 for trunk/autoquest-plugin-uml/src/main/java
- Timestamp:
- 03/11/15 16:59:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-uml/src/main/java/de/ugoe/cs/autoquest/plugin/uml/UMLUtils.java
r1908 r1913 486 486 String serviceName = getServiceNameFromEvent(event); 487 487 String methodName = getCalledMethodFromEvent(event); 488 String clientName = getClientNameFromEvent(event); 488 489 // determine lifelines 489 490 Lifeline msgTargetLifeline; 490 491 Lifeline msgSourceLifeline; 491 492 if (serviceName.equals(userLifeline.getName())) { 493 // message being send to user 494 // currently we just select the first lifeline that is not the user 495 // this, obviously, has to be replaced with the real service. 496 // however, identification of the source of a message is still an open issue 497 msgSourceLifeline = null; 498 for (Lifeline lifeline : interaction.getLifelines()) { 499 if (!lifeline.equals(userLifeline)) { 500 msgSourceLifeline = lifeline; 501 break; 502 } 503 } 504 msgTargetLifeline = userLifeline; 505 } 506 else { 507 msgSourceLifeline = userLifeline; 508 msgTargetLifeline = interaction.getLifeline(serviceName); 509 } 492 493 msgSourceLifeline = interaction.getLifeline(clientName); 494 msgTargetLifeline = interaction.getLifeline(serviceName); 495 510 496 if (msgSourceLifeline == null) { 511 497 throw new RuntimeException( 512 "Error creating message: could not determine source lifeline .");498 "Error creating message: could not determine source lifeline for component: " + clientName); 513 499 } 514 500 if (msgTargetLifeline == null) { 515 501 throw new RuntimeException( 516 "Error creating message: could not determine target lifeline .");502 "Error creating message: could not determine target lifeline for component: " + serviceName); 517 503 } 518 504 // determine correct target interface … … 666 652 .getName(); 667 653 } 668 eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName )));654 eventSequence.add(new Event(new SimpleSOAPEventType(methodName, serviceName,""))); // TODO add client name 669 655 } 670 656 } … … 809 795 else if (event.getType() instanceof SimpleSOAPEventType) { 810 796 return ((SimpleSOAPEventType) event.getType()).getCalledMethod(); 797 } 798 else { 799 throw new RuntimeException( 800 "Wrong event type. Only SOAPEventType and SimpleSOAPEventType supported but was: " + 801 event.getType().getClass().getName()); 802 } 803 } 804 805 /** 806 * <p> 807 * Helper function to get the name of a client from a SOAP event. 808 * </p> 809 * 810 * @param event 811 * event for which the client name is retrieved 812 * @return service name 813 */ 814 protected static String getClientNameFromEvent(Event event) { 815 if (event.getType() instanceof SOAPEventType) { 816 return ((SOAPEventType) event.getType()).getClientName(); 817 } 818 else if (event.getType() instanceof SimpleSOAPEventType) { 819 return ((SimpleSOAPEventType) event.getType()).getClientName(); 811 820 } 812 821 else { … … 1013 1022 InstanceSpecification instSpec = (InstanceSpecification) serviceInstSpecPkg.createPackagedElement("instspec_"+type.getName(), UMLPackage.Literals.INSTANCE_SPECIFICATION); 1014 1023 instSpec.getClassifiers().add(type); 1015 System.out.println(type.getName());1016 1024 for( Property prop : type.getAllAttributes() ) { 1017 1025 // TODO handle multiplicity
Note: See TracChangeset
for help on using the changeset viewer.