[Mobies-commit] [commit] r3663 - UDM/trunk/src/UdmPython

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Tue Mar 22 15:52:24 CDT 2011


Author: ksmyth
Date: Tue Mar 22 15:52:24 2011
New Revision: 3663

Log:
Support Associations

Modified:
   UDM/trunk/src/UdmPython/UdmPython.cpp

Modified: UDM/trunk/src/UdmPython/UdmPython.cpp
==============================================================================
--- UDM/trunk/src/UdmPython/UdmPython.cpp	Tue Mar 22 15:51:33 2011	(r3662)
+++ UDM/trunk/src/UdmPython/UdmPython.cpp	Tue Mar 22 15:52:24 2011	(r3663)
@@ -270,6 +270,21 @@
 	set<::Uml::Class>::iterator ancestorClassesIt = ancestorClasses.begin();
 
 	for(; ancestorClassesIt != ancestorClasses.end(); ancestorClassesIt++) {
+		::Uml::Association association = static_cast<::Uml::Association>(ancestorClassesIt->association());
+		if (association && dstrolename != object()) {
+			std::set<::Uml::AssociationRole> roles = association.AssociationRole_kind_children();
+			for (auto roleIt = roles.begin(); roleIt != roles.end(); roleIt++) {
+				::Uml::AssociationRole role = *roleIt;
+				if (static_cast<std::string>(role.name()) == 
+						static_cast<const char*>(extract<const char*>(dstrolename))) {
+					using namespace Udm;
+					vector<ObjectImpl*> dstPeers = self.__impl()->getAssociation(role, Udm::TARGETFROMCLASS);
+					vector<ObjectImpl*>::iterator dstPeersIt = dstPeers.begin();
+					foundApplicableAssociation = true;
+					return object(Udm::Object(*dstPeersIt));
+				}
+			}
+		}
 		// Getting the association roles and iterating through them
 		set<::Uml::AssociationRole> assocRoles = ancestorClassesIt->associationRoles();
 		set<::Uml::AssociationRole>::iterator assocRolesIt = assocRoles.begin();


More information about the Mobies-commit mailing list