#include <FIoDbEnumerator.h>
#include <FIoDbStatement.h>
#include <FBaseSysLog.h>
+#include <FBaseUtilStringTokenizer.h>
#include <FSecPrivilegeInfo.h>
#include <FBase_StringConverter.h>
-#include <FBaseUtilStringTokenizer.h>
+#include <FSec_PrivilegeManager.h>
#include "FAppPkg_PackageManagerImpl.h"
#include "FAppPkg_PackageInfoImpl.h"
return true;
}
-ArrayList*
+IList*
_PackageInfoImpl::GetPrivilegeListN(void) const
{
- SysTryReturn(NID_APP, __pPrivilegeList, null, E_SYSTEM, "__pPrivilegeList must not be null.");
-
result r = E_SUCCESS;
std::unique_ptr< ArrayList > pPrivilegeList(new (std::nothrow) ArrayList);
SysTryReturn(NID_APP, pPrivilegeList, null, E_OUT_OF_MEMORY, "pPrivilegeList must not be null.");
pPrivilegeList->Construct();
- for (int i = 0; i < __pPrivilegeList->GetCount(); i++)
+ if (__fromDatabase)
{
- String* pPrivilege = dynamic_cast < String* >(__pPrivilegeList->GetAt(i));
- if (pPrivilege)
+ SysTryReturn(NID_APP, __id.IsEmpty() == false, null, E_SYSTEM, "__id is empty.");
+
+ std::unique_ptr< IList > pList(_PrivilegeManager::GetPrivilegeListN(__id));
+ if (pList == null)
{
- std::unique_ptr< PrivilegeInfo > pPrivilegeInfo(new (std::nothrow) PrivilegeInfo);
- SysTryReturn(NID_APP, pPrivilegeInfo, null, E_OUT_OF_MEMORY, "pPrivilegeInfo must not be null.");
+ SysLog(NID_APP, "_PrivilegeManager::GetPrivilegeListN() is null.");
+ return null;
+ }
+
+ for (int i = 0; i < pList->GetCount(); i++)
+ {
+ String* pPrivilege = dynamic_cast < String* >(pList->GetAt(i));
+ if (pPrivilege)
+ {
+ std::unique_ptr< PrivilegeInfo > pPrivilegeInfo(new (std::nothrow) PrivilegeInfo);
+ SysTryReturn(NID_APP, pPrivilegeInfo, null, E_OUT_OF_MEMORY, "pPrivilegeInfo must not be null.");
- r = pPrivilegeInfo->Construct(*pPrivilege);
- SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeInfo->Construct() failed.");
+ r = pPrivilegeInfo->Construct(*pPrivilege);
+ SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeInfo->Construct() failed.");
- r = pPrivilegeList->Add(*pPrivilegeInfo.release());
- SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeList->Add() failed.");
- }
- }
+ r = pPrivilegeList->Add(*pPrivilegeInfo.release());
+ SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeList->Add() failed.");
+ }
+ }
+ }
+ else
+ {
+ SysTryReturn(NID_APP, __pPrivilegeList, null, E_SYSTEM, "__pPrivilegeList must not be null.");
+
+ for (int i = 0; i < __pPrivilegeList->GetCount(); i++)
+ {
+ String* pPrivilege = dynamic_cast < String* >(__pPrivilegeList->GetAt(i));
+ if (pPrivilege)
+ {
+ std::unique_ptr< PrivilegeInfo > pPrivilegeInfo(new (std::nothrow) PrivilegeInfo);
+ SysTryReturn(NID_APP, pPrivilegeInfo, null, E_OUT_OF_MEMORY, "pPrivilegeInfo must not be null.");
+
+ r = pPrivilegeInfo->Construct(*pPrivilege);
+ SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeInfo->Construct() failed.");
+
+ r = pPrivilegeList->Add(*pPrivilegeInfo.release());
+ SysTryReturn(NID_APP, !IsFailed(r), null, E_SYSTEM, "pPrivilegeList->Add() failed.");
+ }
+ }
+ }
if (pPrivilegeList->GetCount() <= 0)
{