[Mobies-commit] [commit] r4340 - GReAT/trunk/Tools/UMTInterpreters/UMTHelper

ksmyth at redhat3.isis.vanderbilt.edu ksmyth at redhat3.isis.vanderbilt.edu
Wed Oct 15 10:27:10 CDT 2014


Author: ksmyth
Date: Wed Oct 15 10:27:10 2014
New Revision: 4340

Log:
UMTHelper: dont delete brand-new connections. Dont set Group.Criteria for copies

Modified:
   GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.cpp
   GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.h

Modified: GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.cpp
==============================================================================
--- GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.cpp	Wed Oct 15 10:25:58 2014	(r4339)
+++ GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.cpp	Wed Oct 15 10:27:10 2014	(r4340)
@@ -131,27 +131,37 @@
 			}
 			else if(skname == "MoveCopy" )
 			{	
-				SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection>(ciConnection));
+				SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection>(ciConnection), false);
 			}
 		}
 		if(type == OBJTYPE_SET) 
 		{	
 			CComQIPtr<IMgaSet> ciSet(obj);
 			CBstr bstr;
-			{	CComPtr<IMgaMetaFCO> meta;
-				COMVERIFY(ciSet->get_Meta(&meta));
-				COMVERIFY(meta->get_Name(bstr));
-			}
+			CComPtr<IMgaMetaFCO> meta;
+			COMVERIFY(ciSet->get_Meta(&meta));
+			COMVERIFY(meta->get_Name(bstr));
 			CString skname(bstr);
 			if(skname == "Group")
 			{
-				CString criterial("/* Add your code with UDM APIs below to determine whether the two matches ");
-				criterial.Append("\r\nshould be grouped together. Use prefix \"the_\" and \"other_\" with the ");
-				criterial.Append("\r\nPatternClass name to represent the bound objects of two matches. For example:");
-				criterial.Append("\r\nthe_ClassA, other_ClassA */");
-				criterial.Append("\r\nreturn true;");	
-				if( !SUCCEEDED( ciSet->put_StrAttrByName((CBstrIn)"Criterial", (CBstrIn)criterial) ) )
-					return S_OK;
+				CComPtr<IMgaMetaAttribute> metaAttribute;
+				COMVERIFY(meta->get_AttributeByName(_bstr_t(L"Criterial"), &metaAttribute));
+				CComPtr<IMgaAttribute> attribute;
+				if (SUCCEEDED(ciSet->get_Attribute(metaAttribute, &attribute)))
+				{
+					long status;
+					COMVERIFY(attribute->get_Status(&status));
+					if (status == ATTSTATUS_METADEFAULT || status == ATTSTATUS_UNDEFINED)
+					{
+						CString criterial("/* Add your code with UDM APIs below to determine whether the two matches ");
+						criterial.Append("\r\nshould be grouped together. Use prefix \"the_\" and \"other_\" with the ");
+						criterial.Append("\r\nPatternClass name to represent the bound objects of two matches. For example:");
+						criterial.Append("\r\nthe_ClassA, other_ClassA */");
+						criterial.Append("\r\nreturn true;");	
+						if( !SUCCEEDED( ciSet->put_StrAttrByName((CBstrIn)"Criterial", (CBstrIn)criterial) ) )
+							return S_OK;
+					}
+				}
 			}
 		}
 	}
@@ -253,7 +263,7 @@
 				MGACOLL_ITERATE(IMgaConnPoint, cpts) 
 				{	CComQIPtr<IMgaConnection> ciConnection;
 					COMVERIFY(MGACOLL_ITER->get_Owner(&ciConnection));
-					SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection>(ciConnection));			
+					SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection>(ciConnection), true);
 				} MGACOLL_ITERATE_END;
 			}
 		}
@@ -396,7 +406,7 @@
 	return S_OK;
 }
 
-int	RawComponent::SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection> ciConnection)
+int	RawComponent::SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection> ciConnection, bool doDelete)
 {
 	CComPtr<IMgaFCO> isrc;
 	
@@ -423,7 +433,10 @@
 	}
 	else //do not create/delete the MoveCopy connection if the action is "Bound" or "Delete"
 	{
-		ciConnection->DestroyObject();
+		if (doDelete == true)
+		{
+			ciConnection->DestroyObject();
+		}
 	}
 	return S_OK;
 }

Modified: GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.h
==============================================================================
--- GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.h	Wed Oct 15 10:25:58 2014	(r4339)
+++ GReAT/trunk/Tools/UMTInterpreters/UMTHelper/RawComponent.h	Wed Oct 15 10:27:10 2014	(r4340)
@@ -43,7 +43,7 @@
 	STDMETHODIMP ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v);
 	
 	int		SetAttribute(CComQIPtr<IMgaSimpleConnection> ciConnection);
-	int		SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection> ciConnection);
+	int		SetMoveCopyConnAttribute(CComQIPtr<IMgaSimpleConnection> ciConnection, bool doDelete);
 	CString GetConnectionKindName(CComQIPtr<IMgaConnection> ciConn);
 	bool	GetSrcDstRolenames(CComQIPtr<IMgaSimpleConnection> ciConnection);
 	bool	GetSrcDstRolenamesEx(CComQIPtr<IMgaSimpleConnection> ciConnection);


More information about the Mobies-commit mailing list