Fix to parse appcontrol
authorDuyoung Jang <duyoung.jang@samsung.com>
Mon, 22 Oct 2012 09:58:34 +0000 (18:58 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Mon, 22 Oct 2012 09:58:34 +0000 (18:58 +0900)
Change-Id: Ic0cdcbaaa35d61659b13803f413d5f89104ca71f

src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestGenerator.h

index 3bbc721..e6bd262 100755 (executable)
@@ -241,54 +241,7 @@ ManifestGenerator::Write()
                                __pWriter->EndElement();
                        }
 
-                       ArrayList* pAppControlImplList = pAppInfoImpl->GetAppControlList();
-                       if (pAppControlImplList)
-                       {
-                               _AppControlInfoImpl* pAppControl = dynamic_cast<_AppControlInfoImpl*>(pAppControlImplList->GetAt(0));
-                               if (pAppControl)
-                               {
-                                       ArrayList* pCapabilityList = pAppControl->GetCapabilityList();
-                                       if (pCapabilityList)
-                                       {
-                                               _AppControlCapabilityInfoImpl* pCapability = dynamic_cast<_AppControlCapabilityInfoImpl*>(pCapabilityList->GetAt(0));
-                                               if (pCapability)
-                                               {
-                                                       String operationId = pCapability->GetOperationId();
-
-                                                       __pWriter->StartElement("application-service");
-
-                                                       __pWriter->StartElement("operation");
-                                                       __pWriter->WriteAttribute("name", operationId);
-                                                       __pWriter->EndElement();
-
-                                                       ArrayList* pResolutionList = pCapability->GetResolutionList();
-                                                       if (pResolutionList)
-                                                       {
-                                                               _AppControlResolutionInfoImpl* pResolution = dynamic_cast <_AppControlResolutionInfoImpl*>(pResolutionList->GetAt(0));
-                                                               if (pResolution)
-                                                               {
-                                                                       String* pUriScheme = pResolution->GetUriScheme();
-                                                                       if (pUriScheme->IsEmpty() == false)
-                                                                       {
-                                                                               __pWriter->StartElement("uri");
-                                                                               __pWriter->WriteAttribute("name", *pUriScheme);
-                                                                               __pWriter->EndElement();
-                                                                       }
-
-                                                                       String* pMimeType = pResolution->GetMimeType();
-                                                                       if (pMimeType->IsEmpty() == false)
-                                                                       {
-                                                                               __pWriter->StartElement("mime");
-                                                                               __pWriter->WriteAttribute("name", *pMimeType);
-                                                                               __pWriter->EndElement();
-                                                                       }
-                                                               }
-                                                       }
-                                                       __pWriter->EndElement();
-                                               }
-                                       }
-                               }
-                       }
+                       WriteAppControl(pAppInfoImpl);
 
                        __pWriter->EndElement();
 
@@ -475,3 +428,62 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
 
        return true;
 }
+
+bool
+ManifestGenerator::WriteAppControl(_PackageAppInfoImpl* pAppInfoImpl) const
+{
+       TryReturn(pAppInfoImpl, false, "[osp-installer] pAppInfoImpl is null.");
+
+       ArrayList* pAppControlImplList = pAppInfoImpl->GetAppControlList();
+       if (pAppControlImplList)
+       {
+               _AppControlInfoImpl* pAppControl = dynamic_cast<_AppControlInfoImpl*>(pAppControlImplList->GetAt(0));
+               if (pAppControl)
+               {
+                       ArrayList* pCapabilityList = pAppControl->GetCapabilityList();
+
+                       for (int i = 0 ; i < pCapabilityList->GetCount(); i++)
+                       {
+                               if (pCapabilityList)
+                               {
+                                       _AppControlCapabilityInfoImpl* pCapability = dynamic_cast<_AppControlCapabilityInfoImpl*>(pCapabilityList->GetAt(i));
+                                       if (pCapability)
+                                       {
+                                               String operationId = pCapability->GetOperationId();
+
+                                               __pWriter->StartElement("application-service");
+
+                                               __pWriter->StartElement("operation");
+                                               __pWriter->WriteAttribute("name", operationId);
+                                               __pWriter->EndElement();
+
+                                               ArrayList* pResolutionList = pCapability->GetResolutionList();
+                                               if (pResolutionList)
+                                               {
+                                                       _AppControlResolutionInfoImpl* pResolution = dynamic_cast <_AppControlResolutionInfoImpl*>(pResolutionList->GetAt(0));
+                                                       if (pResolution)
+                                                       {
+                                                               String* pUriScheme = pResolution->GetUriScheme();
+                                                               if (pUriScheme && pUriScheme->IsEmpty() == false)
+                                                               {
+                                                                       __pWriter->StartElement("uri");
+                                                                       __pWriter->WriteAttribute("name", *pUriScheme);
+                                                                       __pWriter->EndElement();
+                                                               }
+
+                                                               String* pMimeType = pResolution->GetMimeType();
+                                                               if (pMimeType && pMimeType->IsEmpty() == false)
+                                                               {
+                                                                       __pWriter->StartElement("mime");
+                                                                       __pWriter->WriteAttribute("name", *pMimeType);
+                                                                       __pWriter->EndElement();
+                                                               }
+                                                       }
+                                               }
+                                               __pWriter->EndElement();
+                                       }
+                               }
+                       }
+               }
+       }
+}
index 7748806..375bd70 100755 (executable)
@@ -53,6 +53,7 @@ private:
        bool FindFeatureValue(Osp::Base::Collection::ArrayList* pFeatureList, const Osp::Base::String& feature, const Osp::Base::String& value) const;
        bool WriteLanguageValue(Osp::Base::Collection::IMap* pList, const Osp::Base::String& label) const;
        bool WriteLiveboxes(Osp::App::_PackageAppInfoImpl* pAppInfoImpl) const;
+       bool WriteAppControl(Osp::App::_PackageAppInfoImpl* pAppInfoImpl) const;
 
 private:
        InstallationContext* __pContext;