GME  13
Property.cpp
Go to the documentation of this file.
00001 // Property.cpp: implementation of the CProperty class.
00002 //
00004 
00005 #include "stdafx.h"
00006 #include "objectinspector.h"
00007 #include "ObjectInspectorCtl.h"
00008 
00009 #include "Property.h"
00010 
00011 #ifdef _DEBUG
00012 #undef THIS_FILE
00013 static char THIS_FILE[]=__FILE__;
00014 #define new DEBUG_NEW
00015 #endif
00016 
00018 // Construction/Destruction
00020 
00021 /************** Properties to display *************
00022 
00023   * General Properties (All)
00024         - Type
00025         - Kind
00026         - Meta ID
00027         - Object ID
00028         - Rel ID
00029         - GUID
00030 
00031   * FCO Properties
00032         - Role
00033         - Aspect
00034 
00035   * M(odel)A(tom)R(eference)S(et) Properties
00036         - Depends
00037         - Refers
00038 
00039   * Folder
00040         - Library Reference
00041 
00042   * Connection
00043         - Source
00044         - Source Port
00045         - Destination
00046         - Destination Port
00047 
00048 ***************************************************/
00049 
00050 
00051 
00052 CProperty::CProperty()
00053 {
00054 
00055 }
00056 
00057 CProperty::~CProperty()
00058 {
00059 
00060 }
00061 
00062 void CProperty::CreateGeneralList(const CMgaFCOPtrList& MgaFCOPtrList,const CMgaFolderPtrList& MgaFolderPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00063 {
00064 
00065         // Adding _T("General Properties") container
00066         CListItem GeneralListItem;
00067         GeneralListItem.bIsReadOnly=true;
00068         GeneralListItem.bIsContainer=true;
00069         GeneralListItem.strName=_T("General Properties");
00070 
00071         ListItemArray.Add(GeneralListItem);
00072 
00073 
00074         m_bIsAllFCO=MgaFolderPtrList.IsEmpty()!=FALSE;
00075         m_bIsAllFolder=MgaFCOPtrList.IsEmpty()!=FALSE;
00076         m_bIsAllConnection=m_bIsAllFCO;
00077         m_bIsAllMARS=true;
00078 
00079         bool bIsMultiple=((MgaFCOPtrList.GetCount()+MgaFolderPtrList.GetCount())>1?true:false);
00080         
00081         CString strType;
00082         CString strKindName;
00083         CString strMetaID;
00084         CString strObjectID;
00085         CString strRelID;
00086         CString strGUID;
00087 
00088         bool bIsTypeDirty=false;
00089         bool bIsKindNameDirty=false;
00090         bool bIsFirst=true;
00091 
00092 
00093         CString strTemp;
00094 
00095         // Iterating through the FCO list
00096         POSITION posFCO=MgaFCOPtrList.GetHeadPosition();
00097 
00098         while(posFCO)
00099         {
00100                 CComPtr<IMgaFCO> ccpMgaFCO=MgaFCOPtrList.GetNext(posFCO);
00101                                 
00102                 CComPtr<IMgaObject> ccpMgaObject;
00103                 ccpMgaFCO.QueryInterface(&ccpMgaObject);
00104 
00105                 GetGeneralProperties(ccpMgaObject,strType,strKindName,strMetaID,strObjectID,
00106                                                          strRelID,strGUID, bIsTypeDirty, bIsKindNameDirty,bIsMultiple,
00107                                                          bIsFirst);
00108 
00109                 bIsFirst=false;
00110         }
00111 
00112         POSITION posFolder= MgaFolderPtrList.GetHeadPosition();
00113 
00114         while(posFolder)
00115         {
00116                 CComPtr<IMgaFolder> ccpMgaFolder= MgaFolderPtrList.GetNext(posFolder);
00117                 CComPtr<IMgaObject> ccpMgaObject;
00118 
00119                 ccpMgaFolder.QueryInterface(&ccpMgaObject);
00120 
00121                 GetGeneralProperties(ccpMgaObject,strType,strKindName,strMetaID,strObjectID,
00122                                                          strRelID,strGUID, bIsTypeDirty, bIsKindNameDirty,bIsMultiple,
00123                                                          bIsFirst);
00124 
00125                 bIsFirst=false;
00126         }
00127 
00128 
00129         CListItem ListItem;
00130         ListItem.bIsReadOnly=true;
00131         ListItem.bIsDefault=false;
00132 
00133         // Type
00134         ListItem.bIsDifferentValue=bIsTypeDirty;
00135         ListItem.strName=_T("Type");
00136         ListItem.strToolTip=_T("Type of the object.");
00137         ListItem.Value.SetStringValue(strType);
00138 
00139         ListItemArray.Add(ListItem);
00140         
00141         // Kind
00142         ListItem.bIsDifferentValue=bIsKindNameDirty;
00143         ListItem.strName=_T("Kind");
00144         ListItem.strToolTip=_T("Kind of the object.");
00145         ListItem.Value.SetStringValue(strKindName);
00146 
00147         ListItemArray.Add(ListItem);
00148 
00149         // IDs do not make sense in multiple selection
00150         if(!bIsMultiple)
00151         {
00152                 ListItem.bIsDifferentValue=false;
00153                 ListItem.strName=_T("Object ID");
00154                 ListItem.strToolTip=_T("Unique ID of the object.");
00155                 ListItem.Value.SetStringValue(strObjectID);
00156 
00157                 ListItemArray.Add(ListItem);
00158 
00159                 ListItem.bIsDifferentValue=false;
00160                 ListItem.strName=_T("Relative ID");
00161                 ListItem.strToolTip=_T("Relative ID of the object, corresponds with creation order. The object with greater relative ID was created later.");
00162                 ListItem.Value.SetStringValue(strRelID);
00163 
00164                 ListItemArray.Add(ListItem);
00165 
00166                 ListItem.bIsDifferentValue=false;
00167                 ListItem.strName=_T("Meta ID");
00168                 ListItem.strToolTip=_T("Meta ID of the object.");
00169                 ListItem.Value.SetStringValue(strMetaID);
00170 
00171                 ListItemArray.Add(ListItem);
00172 
00173 
00174                 ListItem.bIsDifferentValue=false;
00175                 ListItem.strName=_T("GUID");
00176                 ListItem.strToolTip=_T("Universally unique ID of the object.");
00177                 ListItem.Value.SetStringValue(strGUID);
00178 
00179                 ListItemArray.Add(ListItem);
00180         }
00181 }
00182 
00183 
00184 
00185 void CProperty::GetGeneralProperties(const CComPtr<IMgaObject>& ccpMgaObject,
00186                                                                          CString &strType, CString &strKindName,
00187                                                                          CString &strMetaID, CString &strObjectID, 
00188                                                                          CString &strRelID, CString &strGUID, bool &bIsTypeDirty,
00189                                                                          bool &bIsKindNameDirty, bool bIsMultiple, 
00190                                                                          bool bIsFirst)
00191 {
00192                 
00193                 static CString strTypeNameArray[] = { _T("Invalid"), _T("Model"), _T("Atom"), _T("Reference"), _T("Connection"), _T("Set"), _T("Folder") };
00194                 CString strTemp;
00195                 objtype_enum oeObjType;
00196                 COMTHROW(ccpMgaObject->get_ObjType(&oeObjType));
00197                 
00198                 if(oeObjType==OBJTYPE_CONNECTION)
00199                 {
00200                         m_bIsAllMARS=false;
00201                 }
00202                 else
00203                 {
00204                         m_bIsAllConnection=false;
00205                 }
00206 
00207                 
00209                 if ( (oeObjType == OBJTYPE_ATOM) || 
00210                          (oeObjType == OBJTYPE_MODEL) || 
00211                          (oeObjType == OBJTYPE_REFERENCE) ||  
00212                          (oeObjType == OBJTYPE_SET) )
00213                 {
00214                         CComPtr<IMgaFCO> ccpFCOType;
00215                         CComQIPtr<IMgaFCO> ccpMgaFCO(ccpMgaObject);
00216                         
00217                         // A model should be able to be converted to FCO
00218                         ASSERT(ccpMgaFCO);
00219                         
00220                         COMTHROW(ccpMgaFCO->get_DerivedFrom(&ccpFCOType));
00221                         
00222                         if(ccpFCOType != 0) // Instance or Subtype
00223                         {
00224                                 // Get base name
00225                                 CComBSTR bstrBaseName;
00226                                 COMTHROW(ccpFCOType->get_Name(&bstrBaseName));
00227                                 CString baseName(bstrBaseName);
00228                                 
00229                                 VARIANT_BOOL vtbIsInstance;
00230                                 COMTHROW(ccpMgaFCO->get_IsInstance(&vtbIsInstance));
00231 
00232                                 // If it is an instance
00233                                 if(vtbIsInstance != VARIANT_FALSE) 
00234                                 {
00235                                         strTemp.Format(_T("%s (instance of %s)"),strTypeNameArray[oeObjType],baseName);
00236                                 }
00237                                 else
00238                                 {
00239                                         strTemp.Format(_T("%s (subtype of %s)"),strTypeNameArray[oeObjType],baseName);
00240                                 }
00241                         }
00242                         else // Archetype
00243                         {
00244                                 strTemp.Format(_T("%s (Archetype)"),strTypeNameArray[oeObjType]);
00245                         }
00246                 }
00247                 else
00248                 {
00249                         strTemp=strTypeNameArray[oeObjType];
00250                 }
00251 
00252                 if(bIsFirst)
00253                 {
00254                         strType=strTemp;
00255                 }
00256                 else
00257                 {
00258                         if(strTemp!=strType)
00259                         {
00260                                 bIsTypeDirty=true;
00261                         }
00262                 }
00263         
00265                 
00266                 // Getting kind
00267                 strTemp = _T("N/A");
00268 
00269                 // Get Meta
00270                 CComPtr<IMgaMetaBase> ccpMetaBase;
00271                 COMTHROW(ccpMgaObject->get_MetaBase(&ccpMetaBase));
00272 
00273                 CComBSTR bstrMetaName;
00274                 COMTHROW(ccpMetaBase->get_DisplayedName(&bstrMetaName));
00275                 strTemp=bstrMetaName;
00276 
00277                 if(bIsFirst)
00278                 {
00279                         strKindName=strTemp;
00280                 }
00281                 else
00282                 {
00283                         if(strTemp!=strKindName)
00284                         {
00285                                 bIsKindNameDirty=true;
00286                         }
00287                 }
00288 
00289                 // IDs do not make sense in multiple selection
00290                 if(!bIsMultiple)
00291                 {
00292 
00293                         // Querying ObjectID
00294                         CComBSTR bstrObjectID;
00295                         COMTHROW(ccpMgaObject->get_ID(&bstrObjectID));
00296                         strObjectID.Format(_T("%s"),CString(bstrObjectID));
00297 
00298                         // Getting RelID (this carries the creation order of an MgaObject)
00299                         long lRelID;
00300                         COMTHROW(ccpMgaObject->get_RelID(&lRelID));
00301                         strRelID.Format(_T("0x%08X"),lRelID);
00302                 
00303         
00304                         // Get Meta ID
00305                         metaref_type mtMetaID = 0;
00306                         COMTHROW(ccpMetaBase->get_MetaRef(&mtMetaID));
00307                         strMetaID.Format(_T("%ld"),(long)mtMetaID);
00308 
00309                         // Get GUID
00310                         CComBSTR bstrGUID;
00311                         COMTHROW(ccpMgaObject->GetGuidDisp(&bstrGUID));
00312                         strGUID = CString( bstrGUID);
00313                 }
00314 }               
00315 
00316 
00317 
00318 void CProperty::CreateFCOList(const CMgaFCOPtrList& MgaFCOPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00319 {
00320 
00321         // Adding _T("FCO Properties") container
00322         CListItem FCOListItem;
00323         FCOListItem.bIsContainer=true;
00324         FCOListItem.bIsReadOnly=true;
00325         FCOListItem.strName=_T("FCO Properties");
00326 
00327         ListItemArray.Add(FCOListItem);
00328 
00329         CString strRole;
00330         CString strAspect;
00331         CString strTemp;
00332                 
00333         bool bIsRoleDirty=false;
00334         bool bIsAspectDirty=false;
00335 
00336         bool bIsFirst=true;
00337 
00338         POSITION posFCO=MgaFCOPtrList.GetHeadPosition();
00339 
00340         while(posFCO)
00341         {
00342                 CComPtr<IMgaFCO> ccpMgaFCO=MgaFCOPtrList.GetNext(posFCO);
00343 
00344                         
00345                 // Get role
00346                 CComPtr<IMgaMetaRole> ccpMetaRole;
00347                 COMTHROW(ccpMgaFCO->get_MetaRole(&ccpMetaRole));
00348                 
00349                 strTemp = _T("N/A");
00350                 if(ccpMetaRole != 0) 
00351                 {
00352                         CComBSTR bstrRoleName;
00353                         COMTHROW(ccpMetaRole->get_DisplayedName(&bstrRoleName));
00354                         strTemp=bstrRoleName;
00355                 }
00356                 
00357                 if(bIsFirst)
00358                 {
00359                         strRole=strTemp;
00360                 }
00361                 else
00362                 {
00363                         if(strRole!=strTemp)
00364                         {
00365                                 bIsRoleDirty=true;
00366                         }
00367                 }
00368                 
00370                 // Multiple aspects are possible and one may be primary
00371 
00372                 bool bFirst = true;
00373 
00374                 objtype_enum oeParentObjType;
00375 
00376                 CComPtr<IMgaObject> ccpParentObject;
00377                 COMTHROW( ccpMgaFCO->GetParent(&ccpParentObject, &oeParentObjType) ); 
00378 
00379 
00380                 CComPtr<IMgaParts> ccpMgaParts;
00381 
00382                 if(oeParentObjType != OBJTYPE_FOLDER) 
00383                 {
00384 
00385                         COMTHROW(ccpMgaFCO->get_Parts(&ccpMgaParts));
00386                 }
00387 
00388                 CComPtr<IMgaPart> ccpCurrPart;
00389 
00390                 if(ccpMgaParts != NULL) 
00391                 {
00392                         // Iterate through contained aspects
00393                         MGACOLL_ITERATE(IMgaPart,ccpMgaParts) 
00394                         {
00395 
00396                                 ccpCurrPart= MGACOLL_ITER;
00397 
00398                                 ASSERT(ccpCurrPart != NULL);
00399 
00400                                 // Get MetaAspect
00401                                 CComPtr<IMgaMetaAspect> ccpMetaAspect;
00402                                 COMTHROW( ccpCurrPart->get_MetaAspect(&ccpMetaAspect) );
00403 
00404                                 // Get Meta Aspect name
00405                                 CComBSTR bstrAspectName;                                        
00406                                 COMTHROW( ccpMetaAspect->get_Name(&bstrAspectName));
00407 
00408                                 if (!bFirst) 
00409                                 {
00410                                         strTemp += _T("; "); 
00411                                 } 
00412                                 else 
00413                                 {
00414                                         strTemp.Empty();
00415                                         bFirst = false; 
00416                                 }
00417 
00418                                 strTemp += CString(bstrAspectName);
00419 
00421 
00422                                 CComPtr<IMgaMetaPart> ccpMetaPart;
00423                                 COMTHROW( ccpCurrPart->get_Meta(&ccpMetaPart));
00424 
00425                                 ASSERT( ccpMetaPart != NULL );
00426 
00427                                 // Checking if aspect is primary
00428                                 VARIANT_BOOL vbtIsPrimary = VARIANT_FALSE;
00429 
00430                                 COMTHROW( ccpMetaPart->get_IsPrimary(&vbtIsPrimary) );
00431 
00432                                 if (vbtIsPrimary != VARIANT_FALSE) 
00433                                 {
00434                                         strTemp += _T(" (Primary)");
00435                                 }
00436                         }
00437                         MGACOLL_ITERATE_END;
00438                 }
00439 
00440                 // Setting dirty
00441                 if(bIsFirst)
00442                 {
00443                         strAspect=strTemp;
00444                 }
00445                 else
00446                 {
00447                         if(strAspect!=strTemp)
00448                         {
00449                                 bIsAspectDirty=true;
00450                         }
00451                 }
00452 
00453                 bIsFirst=false;
00454         }
00455 
00456 
00457 
00458         CListItem ListItem;
00459         ListItem.bIsReadOnly=true;
00460 
00461         // Role
00462         ListItem.bIsDifferentValue=bIsRoleDirty;
00463         ListItem.strName=_T("Role");
00464         ListItem.strToolTip=_T("Role name of the FCO.");
00465         ListItem.Value.SetStringValue(strRole);
00466 
00467         ListItemArray.Add(ListItem);
00468 
00469         // Aspect
00470         ListItem.bIsDifferentValue=bIsAspectDirty;
00471         ListItem.strName=_T("Aspect");
00472         ListItem.strToolTip=_T("Aspects which this FCO contains.");
00473         ListItem.Value.SetStringValue(strAspect);
00474 
00475         ListItemArray.Add(ListItem);
00476 
00477 
00478 }
00479 
00480 
00481 void CProperty::CreateMarsList(const CMgaFCOPtrList& MgaFCOPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00482 {
00483 
00484         // Adding _T("MARS Properties") container
00485         CListItem MarsListItem;
00486         MarsListItem.bIsContainer=true;
00487         MarsListItem.bIsReadOnly=true;
00488         MarsListItem.strName=_T("MARS Properties");
00489         MarsListItem.strToolTip=_T("Common properties for M(odel),A(tom),R(eference),S(et) model elements");
00490 
00491         ListItemArray.Add(MarsListItem);
00492 
00493 
00494         CString strDepends;
00495         CString strRefers;
00496         CString strTemp;
00497         
00498                 
00499         bool bIsDependsDirty=false;
00500         bool bIsRefersDirty=false;
00501 
00502         bool bIsFirst=true;
00503 
00504         POSITION posFCO=MgaFCOPtrList.GetHeadPosition();
00505 
00506         while(posFCO)
00507         {
00508                 CComPtr<IMgaFCO> ccpMgaFCO=MgaFCOPtrList.GetNext(posFCO);
00509 
00511 
00512                 strTemp=_T("N/A");
00513                 CComPtr<IMgaFCO> ccpAncestorFCO;
00514                 COMTHROW(ccpMgaFCO->get_DerivedFrom(&ccpAncestorFCO));
00515                 if(ccpAncestorFCO) 
00516                 {
00517                         CComPtr<IMgaReference> ccpMgaDependReference;
00518                         short wDepends;
00519                         
00520                         if(ccpMgaFCO.QueryInterface(&ccpMgaDependReference) == S_OK) 
00521                         {
00522                                 COMTHROW(ccpMgaDependReference->CompareToBase(&wDepends));
00523                                 if(wDepends > 0)
00524                                 {
00525                                         strTemp=_T("False");
00526                                 }
00527                                 else 
00528                                 {
00529                                         strTemp=_T("True");
00530                                 }
00531                         }
00532                         else 
00533                         {
00534                                 CComPtr<IMgaSet> ccpMgaSet;
00535                                 if(ccpMgaFCO.QueryInterface(&ccpMgaSet) == S_OK) 
00536                                 {
00537                                         COMTHROW(ccpMgaSet->CompareToBase(&wDepends));
00538                                         if(wDepends > 0)
00539                                         {
00540                                                 strTemp=_T("False");
00541                                         }
00542                                         else 
00543                                         {
00544                                                 strTemp=_T("True");
00545                                         }
00546                                 }
00547                         }
00548                 }
00549                 
00550                 if(bIsFirst)
00551                 {
00552                         strDepends=strTemp;
00553                 }
00554                 else
00555                 {
00556                         if(strTemp!=strDepends)
00557                         {
00558                                 bIsDependsDirty=true;
00559                         }
00560                 }
00561 
00562 
00564                 strTemp=_T("N/A");
00565                 CComPtr<IMgaReference> ccpMgaReference;
00566                 if(ccpMgaFCO.QueryInterface(&ccpMgaReference) == S_OK) // If FCO is a reference
00567                 {
00568                         // Obtaining references
00569                         CComPtr<IMgaFCO> ccpReferredFCO;
00570                         COMTHROW(ccpMgaReference->get_Referred(&ccpReferredFCO));
00571 
00572                         if(ccpReferredFCO != 0) // Not NULL reference
00573                         {
00574                                 CComBSTR bstrReferredName;
00575                                 COMTHROW(ccpReferredFCO->get_Name(&bstrReferredName));
00576 
00577                                 CComBSTR bstrReferredID;
00578                                 COMTHROW(ccpReferredFCO->get_ID(&bstrReferredID));
00579 
00580                                 CComPtr<IMgaMetaFCO> ccpMetaReferredFCO;
00581                                 COMTHROW(ccpReferredFCO->get_Meta(&ccpMetaReferredFCO));
00582                                 
00583                                 CComBSTR bstrMetaReferredName;
00584                                 COMTHROW(ccpMetaReferredFCO->get_DisplayedName(&bstrMetaReferredName));
00585 
00586                                 strTemp.Format(_T(" %s (%s, ObjectID=%s)"),CString(bstrReferredName),CString(bstrMetaReferredName),CString(bstrReferredID));
00587                         }
00588                         else // NULL reference
00589                         {
00590                                 strTemp=_T("<Null reference>");
00591                         }       
00592                 }
00593                 
00594                 // Setting dirty
00595                 if(bIsFirst)
00596                 {
00597                         strRefers=strTemp;
00598                 }
00599                 else
00600                 {
00601                         if(strRefers!=strTemp)
00602                         {
00603                                 bIsRefersDirty=true;
00604                         }
00605                 }
00606 
00607 
00608                 bIsFirst=false;
00609         }
00610 
00611         CListItem ListItem;
00612         ListItem.bIsReadOnly=true;
00613 
00614         // Depends
00615         ListItem.bIsDifferentValue=bIsDependsDirty;
00616         ListItem.strName=_T("Depends");
00617         ListItem.strToolTip=_T("Dependencies of the FCO.");
00618         ListItem.Value.SetStringValue(strDepends);
00619 
00620         ListItemArray.Add(ListItem);
00621 
00622         // Refers
00623         ListItem.bIsDifferentValue=bIsRefersDirty;
00624         ListItem.strName=_T("References");
00625         ListItem.strToolTip=_T("FCO to which this reference refers.");
00626         ListItem.Value.SetStringValue(strRefers);
00627 
00628         ListItemArray.Add(ListItem);
00629 
00630 }
00631 
00632 
00633 
00634 void CProperty::CreateConnectionList(const CMgaFCOPtrList& MgaFCOPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00635 {
00636 
00637         // Adding _T("Connection Properties") container
00638         CListItem ConnListItem;
00639         ConnListItem.bIsContainer=true;
00640         ConnListItem.bIsReadOnly=true;
00641         ConnListItem.strName=_T("Connection Properties");
00642         
00643 
00644         ListItemArray.Add(ConnListItem);
00645 
00646 
00647         CString strSource;
00648         CString strSourcePort;
00649         CString strDest;
00650         CString strDestPort;
00651                 
00652         bool bIsSourceDirty=false;
00653         bool bIsSourcePortDirty=false;
00654         bool bIsDestDirty=false;
00655         bool bIsDestPortDirty=false;
00656 
00657 
00658         bool bIsFirst=true;
00659 
00660         POSITION posFCO=MgaFCOPtrList.GetHeadPosition();
00661 
00662         while(posFCO)
00663         {
00664                 CComPtr<IMgaFCO> ccpMgaFCO=MgaFCOPtrList.GetNext(posFCO);
00665 
00666                 CComPtr<IMgaFCO> ccpTempFCO;
00667                 CComBSTR bstrTemp;
00668 
00669                 CComPtr<IMgaSimpleConnection> ccpMgaSimpleConn;
00670                 COMTHROW(ccpMgaFCO.QueryInterface(&ccpMgaSimpleConn));
00671 
00672 
00673                 // Querying source side information - strSource
00674                 COMTHROW( ccpMgaSimpleConn->get_Src(&ccpTempFCO) );
00675                 ASSERT(ccpTempFCO != NULL);
00676                 CComPtr<IMgaObject> ccpParentSrc;
00677                 if (ccpTempFCO) 
00678                 {
00679                         COMTHROW( ccpTempFCO->get_Name(&bstrTemp) );
00680 
00681                         objtype_enum oeParentObjType;
00682                         COMTHROW( ccpTempFCO->GetParent(&ccpParentSrc, &oeParentObjType) );
00683 
00684                         ASSERT( ccpParentSrc != NULL );
00685                         CString strSrcName=bstrTemp;
00686         
00687                         // Setting dirty
00688                         if(bIsFirst)
00689                         {
00690                                 strSource=strSrcName;
00691                         }
00692                         else
00693                         {
00694                                 if(strSource!=strSrcName)
00695                                 {
00696                                         bIsSourceDirty=true;
00697                                 }
00698                         }
00699                 }
00700                 
00701                 bstrTemp.Empty();
00702                 ccpTempFCO = NULL;
00703 
00704                 // Querying destination side information - strDest
00705                 COMTHROW( ccpMgaSimpleConn->get_Dst(&ccpTempFCO) );
00706                 ASSERT(ccpTempFCO != NULL);
00707                 CComPtr<IMgaObject> ccpParentDst;
00708                 if(ccpTempFCO)
00709                 {
00710                         COMTHROW( ccpTempFCO->get_Name(&bstrTemp) );
00711 
00712                         objtype_enum oeParentObjType;
00713                         COMTHROW( ccpTempFCO->GetParent(&ccpParentDst, &oeParentObjType) );
00714 
00715                         ASSERT( ccpParentDst != NULL );
00716                         CString strDstName=bstrTemp;
00717 
00718                         // Setting dirty
00719                         if(bIsFirst)
00720                         {
00721                                 strDest=strDstName;
00722                         }
00723                         else
00724                         {
00725                                 if(strDest!=strDstName)
00726                                 {
00727                                         bIsDestDirty=true;
00728                                 }
00729                         }
00730                 }
00731 
00732                 bstrTemp.Empty();
00733                 ccpTempFCO = NULL;
00734 
00735                 CString strSrcPortName = _T("-");
00736                 CString strDstPortName = _T("-");
00737 
00738                 if (ccpParentSrc && ccpParentDst)
00739                 {
00740                         VARIANT_BOOL vtbIsParentsEqual=VARIANT_FALSE;
00741                         COMTHROW( ccpParentSrc->get_IsEqual(ccpParentDst, &vtbIsParentsEqual) );
00742 
00743                         if (vtbIsParentsEqual != VARIANT_FALSE)  // If parents are equal
00744                         {
00745                         } 
00746                         else 
00747                         {
00748 
00749                                 bstrTemp.Empty();
00750                                 COMTHROW( ccpParentSrc->get_Name(&bstrTemp) );
00751                                 strSrcPortName = bstrTemp;
00752 
00753                                 bstrTemp.Empty();
00754                                 COMTHROW( ccpParentDst->get_Name(&bstrTemp) );
00755                                 strDstPortName = bstrTemp;
00756                         }
00757                 }
00758 
00759                 // Setting dirty
00760                 if(bIsFirst)
00761                 {
00762                         strSourcePort=strSrcPortName;
00763                         strDestPort=strDstPortName;
00764                 }
00765                 else
00766                 {
00767                         if(strSourcePort!=strSrcPortName)
00768                         {
00769                                 bIsSourcePortDirty=true;
00770                         }
00771 
00772                         if(strDestPort!=strDstPortName)
00773                         {
00774                                 bIsDestPortDirty=true;
00775                         }
00776 
00777                 }
00778 
00779                 bIsFirst=false;
00780         }
00781 
00782         CListItem ListItem;
00783         ListItem.bIsReadOnly=true;
00784         
00785         // strSource
00786         ListItem.bIsDifferentValue=bIsSourceDirty;
00787         ListItem.strName=_T("Source");
00788         ListItem.strToolTip=_T("Connection source side.");
00789         ListItem.Value.SetStringValue(strSource);
00790 
00791         ListItemArray.Add(ListItem);
00792 
00793         // strSourcePort
00794         ListItem.bIsDifferentValue=bIsSourcePortDirty;
00795         ListItem.strName=_T("Source Port");
00796         ListItem.strToolTip=_T("Connection source side port.");
00797         ListItem.Value.SetStringValue(strSourcePort);
00798 
00799         ListItemArray.Add(ListItem);
00800 
00801         // strDest
00802         ListItem.bIsDifferentValue=bIsDestDirty;
00803         ListItem.strName=_T("Destination");
00804         ListItem.strToolTip=_T("Connection destination side.");
00805         ListItem.Value.SetStringValue(strDest);
00806 
00807         ListItemArray.Add(ListItem);
00808 
00809         // strSourcePort
00810         ListItem.bIsDifferentValue=bIsDestPortDirty;
00811         ListItem.strName=_T("Destination Port");
00812         ListItem.strToolTip=_T("Connection destination side port.");
00813         ListItem.Value.SetStringValue(strDestPort);
00814 
00815         ListItemArray.Add(ListItem);
00816 
00817 
00818 }
00819 
00820 
00821 void CProperty::CreateFolderList(const CMgaFolderPtrList& MgaFolderPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00822 {
00823         // Adding _T("Folder Properties") container
00824         CListItem FolderListItem;
00825         FolderListItem.bIsContainer=true;
00826         FolderListItem.bIsReadOnly=true;
00827         FolderListItem.strName=_T("Folder Properties");
00828         
00829 
00830         ListItemArray.Add(FolderListItem);
00831 
00832 
00833         CString strTemp;
00834 
00835         CString strLibraryRef;
00836         bool bIsLibraryRefDirty=false;
00837 
00838         bool bIsFirst=true;
00839 
00840         POSITION posFolder=MgaFolderPtrList.GetHeadPosition();
00841 
00842         while(posFolder)
00843         {
00844                 CComPtr<IMgaFolder> ccpMgaFolder=MgaFolderPtrList.GetNext(posFolder);
00845 
00846                 // Get Library Name             
00847                 CComBSTR bstrLibraryName;
00848                 COMTHROW(ccpMgaFolder->get_LibraryName(&bstrLibraryName));
00849                 strTemp=bstrLibraryName;
00850 
00851                 // Setting dirty
00852                 if(bIsFirst)
00853                 {
00854                         strLibraryRef=strTemp;
00855                         bIsFirst=false;
00856                 }
00857                 else
00858                 {
00859                         if(strLibraryRef!=strTemp)
00860                         {
00861                                 bIsLibraryRefDirty=true;
00862                         }
00863                 }
00864         }
00865 
00866         CListItem ListItem;
00867 
00868         ListItem.bIsReadOnly=true;
00869         // strLibraryRef
00870         ListItem.bIsDifferentValue=bIsLibraryRefDirty;
00871         ListItem.strName=_T("Library Name");
00872         ListItem.strToolTip=_T("Library is a folder incorporating an MGA file using the same paradigm as meta.");
00873         ListItem.Value.SetStringValue(strLibraryRef);
00874 
00875         ListItemArray.Add(ListItem);
00876 
00877 }
00878 
00879 
00880 
00881 // Must be in read only transaction
00882 void CProperty::CreateList(const CMgaFCOPtrList& MgaFCOPtrList,const CMgaFolderPtrList& MgaFolderPtrList,CArray<CListItem,CListItem&> &ListItemArray)
00883 {
00884         ListItemArray.RemoveAll();
00885         
00886         if(MgaFCOPtrList.IsEmpty() && MgaFolderPtrList.IsEmpty())
00887         {
00888                 return;
00889         }
00890 
00891 
00892         CreateGeneralList(MgaFCOPtrList,MgaFolderPtrList,ListItemArray);
00893 
00894         if(MgaFolderPtrList.IsEmpty())
00895         {
00896                 CreateFCOList(MgaFCOPtrList,ListItemArray);
00897 
00898                 if(m_bIsAllConnection)
00899                 {
00900                         // Create connection
00901                         CreateConnectionList(MgaFCOPtrList,ListItemArray);
00902                 }
00903 
00904                 if(m_bIsAllMARS)
00905                 {
00906                         // CreateMARS
00907                         CreateMarsList(MgaFCOPtrList,ListItemArray);
00908                 }
00909         }
00910         else
00911         {
00912                 if(MgaFCOPtrList.IsEmpty())
00913                 {
00914                         // CreateFolder
00915                         CreateFolderList(MgaFolderPtrList,ListItemArray);
00916                 }
00917         }
00918 }               
00919 
00920 
00921