[savara-commits] savara SVN: r68 - tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Oct 31 06:51:56 EDT 2009


Author: objectiser
Date: 2009-10-31 06:51:56 -0400 (Sat, 31 Oct 2009)
New Revision: 68

Modified:
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
   tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
Log:
Added namespace prefix to port type, plus updated it to use the name used in the WSDL. Also prevent fault variable being generated to variables area, and instead defined in the catch, with the faultMessageType also added.

Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2009-10-30 23:48:26 UTC (rev 67)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/ConversationInteractionModelChangeRule.java	2009-10-31 10:51:56 UTC (rev 68)
@@ -22,6 +22,8 @@
 import org.jboss.savara.tools.bpel.model.util.*;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
+import org.scribble.contract.model.Contract;
+import org.scribble.contract.model.Interface;
 import org.scribble.conversation.model.*;
 import org.scribble.extensions.RegistryInfo;
 
@@ -100,6 +102,31 @@
 						getLocatedName().getRole();
 		}
 
+		// Identify port type role
+		Role portTypeRole=role;
+		
+		if (InteractionUtil.isRequest(interaction) && interaction.getToRole() != null) {
+			portTypeRole = interaction.getToRole();
+		}
+		
+		if (portTypeRole != null &&
+				portTypeRole.getAnnotations().containsKey(Contract.class.getName())) {
+			Contract contract=(Contract)portTypeRole.getAnnotations().get(Contract.class.getName());
+
+			// Assume that contract only has one interface for now
+			if (contract.getInterfaces().size() > 0) {
+				Interface intf=contract.getInterfaces().get(0);
+				
+				portType = intf.getName();
+				
+				String prefix=bpelModel.getBPELProcess().addNamespace(intf.getNamespace());
+				
+				if (prefix != null) {
+					portType = prefix+":"+portType;
+				}
+			}
+		}
+
 		// Check if send or receive
 		if (InteractionUtil.isSend(interaction)) {
 			
@@ -133,7 +160,7 @@
 				pl.setName(role.getName()+"To"+interaction.getToRole().getName());
 				pl.setPartnerLinkType(role.getName()+"To"+interaction.getToRole().getName()+"LT");
 
-				portType = interaction.getToRole().getName()+"PT";
+				//portType = interaction.getToRole().getName()+"PT";
 				
 				if (varName != null) {
 					((Invoke)act).setInputVariable(varName);
@@ -146,7 +173,7 @@
 				pl.setName(interaction.getToRole().getName()+"To"+role.getName());
 				pl.setPartnerLinkType(interaction.getToRole().getName()+"To"+role.getName()+"Service"+"LT");
 
-				portType = role.getName()+"PT";
+				//portType = role.getName()+"PT";
 				
 				if (InteractionPatterns.isFaultResponse(interaction)) {
 					((Reply)act).setFaultName(InteractionPatterns.getFaultName(interaction));
@@ -183,15 +210,15 @@
 					pl.setName(interaction.getFromRole().getName()+"To"+role.getName());
 					pl.setPartnerLinkType(interaction.getFromRole().getName()+"To"+role.getName()+"Service"+"LT");
 	
-					portType = role.getName()+"PT";
+					//portType = role.getName()+"PT";
 				} else {
 					pl.setMyRole(role.getName()+"Requester");
 					pl.setPartnerRole(interaction.getFromRole().getName()+"Service");
 					pl.setName(role.getName()+"To"+interaction.getFromRole().getName());
 					pl.setPartnerLinkType(role.getName()+"To"+interaction.getFromRole().getName()+"Requester"+"LT");
 	
-					portType = role.getName()+
-							interaction.getFromRole().getName()+"CallbackPT";				
+					//portType = role.getName()+
+					//		interaction.getFromRole().getName()+"CallbackPT";				
 				}
 
 				if (varName != null) {
@@ -232,6 +259,7 @@
 			
 			// Set details on interaction
 			act.setPartnerLink(pl.getName());
+			
 			act.setPortType(portType);
 	
 			if (interaction.getMessageSignature() != null) {

Modified: tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java
===================================================================
--- tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2009-10-30 23:48:26 UTC (rev 67)
+++ tools/eclipse/trunk/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/model/change/IfModelChangeRule.java	2009-10-31 10:51:56 UTC (rev 68)
@@ -117,15 +117,22 @@
 							c.setFaultName(faultName);
 							c.setFaultVariable(faultVarName);
 							
-							// TODO: Maybe variable should not be created - just
-							// defined in the scope of the catch? But would then
-							// need to define the fault message type/element.
+							// Define fault message type
+							String mesgType=InteractionPatterns.getMessageTypeLocalPart((Interaction)act);
+							String namespace=InteractionPatterns.getMessageTypeNameSpace((Interaction)act);
+					
+							// Find namespace prefix
+							if (namespace != null) {
+								String prefix=bpelModel.getBPELProcess().addNamespace(namespace);
+								
+								if (prefix != null) {
+									mesgType = prefix+":"+mesgType;
+								}
+							}
 							
-							// Create variable
-							if (faultVarName != null) {
-								createVariable(faultVarName, (Interaction)act, bpelModel);
-							}
-
+							c.setFaultMessageType(mesgType);
+							
+							// Add catch to fault handler
 							fh.addCatch(c);
 							
 							subseq = new Sequence(bpelModel);



More information about the savara-commits mailing list