public CFSecurityISOLanguageBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFInternetRamISOLanguage.readAllDerived"; CFSecurityISOLanguageBuff[] retList = new CFSecurityISOLanguageBuff[dictByPKey.values().size()]; Iterator<CFSecurityISOLanguageBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); }
public CFDbTestLoaderBehaviourBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFDbTestRamLoaderBehaviour.readAllDerived"; CFDbTestLoaderBehaviourBuff[] retList = new CFDbTestLoaderBehaviourBuff[dictByPKey.values().size()]; Iterator<CFDbTestLoaderBehaviourBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); }
public CFSecuritySecGroupMemberBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFFreeSwitchRamSecGroupMember.readAllDerived"; CFSecuritySecGroupMemberBuff[] retList = new CFSecuritySecGroupMemberBuff[dictByPKey.values().size()]; Iterator<CFSecuritySecGroupMemberBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); }
public void deleteUuidDefByContPrevIdx( CFSecurityAuthorization Authorization, CFBamValueByContPrevIdxKey argKey) { final String S_ProcName = "deleteUuidDefByContPrevIdx"; CFBamUuidDefBuff cur; LinkedList<CFBamUuidDefBuff> matchSet = new LinkedList<CFBamUuidDefBuff>(); Iterator<CFBamUuidDefBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFBamUuidDefBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); String subClassCode = cur.getClassCode(); if ("UIDD".equals(subClassCode)) { schema.getTableUuidDef().deleteUuidDef(Authorization, cur); } else if ("UIDC".equals(subClassCode)) { schema.getTableUuidCol().deleteUuidCol(Authorization, (CFBamUuidColBuff) cur); } else if ("UIDT".equals(subClassCode)) { schema.getTableUuidType().deleteUuidType(Authorization, (CFBamUuidTypeBuff) cur); } else if ("IGUU".equals(subClassCode)) { schema.getTableUuidGen().deleteUuidGen(Authorization, (CFBamUuidGenBuff) cur); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "subClassCode", cur, "Instance of or subclass of UuidDef must not be \"" + subClassCode + "\""); } } }
public void deleteDomainBySubDomIdx(long TenantId, long SubDomainOfId) { CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx == null) { indexBySubDomIdx = new HashMap< CFInternetDomainBySubDomIdxKey, Map<CFInternetDomainBasePKey, ICFInternetDomainObj>>(); } if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> dict = indexBySubDomIdx.get(key); ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); Iterator<ICFInternetDomainObj> iter = dict.values().iterator(); ICFInternetDomainObj obj; List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexBySubDomIdx.remove(key); } else { ((ICFBamSchema) schema.getBackingStore()) .getTableDomain() .deleteDomainBySubDomIdx(schema.getAuthorization(), TenantId, SubDomainOfId); } }
public void forgetDomainBySubDomIdx(long TenantId, long SubDomainOfId) { if (indexBySubDomIdx == null) { return; } CFInternetDomainBySubDomIdxKey key = ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (indexBySubDomIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, ICFInternetDomainObj> mapSubDomIdx = indexBySubDomIdx.get(key); if (mapSubDomIdx != null) { List<ICFInternetDomainObj> toForget = new LinkedList<ICFInternetDomainObj>(); ICFInternetDomainObj cur = null; Iterator<ICFInternetDomainObj> iter = mapSubDomIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexBySubDomIdx.remove(key); } }
public CFSecuritySecGroupMemberBuff[] readDerivedByGroupIdx( CFSecurityAuthorization Authorization, long ClusterId, int SecGroupId) { final String S_ProcName = "CFFreeSwitchRamSecGroupMember.readDerivedByGroupIdx"; CFSecuritySecGroupMemberByGroupIdxKey key = schema.getFactorySecGroupMember().newGroupIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecGroupId(SecGroupId); CFSecuritySecGroupMemberBuff[] recArray; if (dictByGroupIdx.containsKey(key)) { Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFSecuritySecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFSecuritySecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictGroupIdx = new HashMap<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff>(); dictByGroupIdx.put(key, subdictGroupIdx); recArray = new CFSecuritySecGroupMemberBuff[0]; } return (recArray); }
public void deleteSecDeviceByUserIdx(UUID SecUserId) { CFSecuritySecDeviceByUserIdxKey key = ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); if (indexByUserIdx == null) { indexByUserIdx = new HashMap< CFSecuritySecDeviceByUserIdxKey, Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>>(); } if (indexByUserIdx.containsKey(key)) { Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> dict = indexByUserIdx.get(key); ((ICFAsteriskSchema) schema.getBackingStore()) .getTableSecDevice() .deleteSecDeviceByUserIdx(schema.getAuthorization(), SecUserId); Iterator<ICFSecuritySecDeviceObj> iter = dict.values().iterator(); ICFSecuritySecDeviceObj obj; List<ICFSecuritySecDeviceObj> toForget = new LinkedList<ICFSecuritySecDeviceObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByUserIdx.remove(key); } else { ((ICFAsteriskSchema) schema.getBackingStore()) .getTableSecDevice() .deleteSecDeviceByUserIdx(schema.getAuthorization(), SecUserId); } }
public void forgetSecDeviceByUserIdx(UUID SecUserId) { if (indexByUserIdx == null) { return; } CFSecuritySecDeviceByUserIdxKey key = ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); if (indexByUserIdx.containsKey(key)) { Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx = indexByUserIdx.get(key); if (mapUserIdx != null) { List<ICFSecuritySecDeviceObj> toForget = new LinkedList<ICFSecuritySecDeviceObj>(); ICFSecuritySecDeviceObj cur = null; Iterator<ICFSecuritySecDeviceObj> iter = mapUserIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByUserIdx.remove(key); } }
public CFSecurityCursor openISOLanguageCursorByCode2Idx( CFSecurityAuthorization Authorization, String ISO6391Code) { CFSecurityCursor cursor; CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey(); key.setOptionalISO6391Code(ISO6391Code); if (dictByCode2Idx.containsKey(key)) { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = dictByCode2Idx.get(key); cursor = new CFInternetRamISOLanguageCursor(Authorization, schema, subdictCode2Idx.values()); } else { cursor = new CFInternetRamISOLanguageCursor( Authorization, schema, new ArrayList<CFSecurityISOLanguageBuff>()); } return (cursor); }
public void deleteISOLanguageByCode2Idx( CFSecurityAuthorization Authorization, CFSecurityISOLanguageByCode2IdxKey argKey) { CFSecurityISOLanguageBuff cur; LinkedList<CFSecurityISOLanguageBuff> matchSet = new LinkedList<CFSecurityISOLanguageBuff>(); Iterator<CFSecurityISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecurityISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } }
public CFSecurityCursor openSecFormCursorBySecAppIdx( CFSecurityAuthorization Authorization, long ClusterId, int SecAppId) { CFSecurityCursor cursor; CFSecuritySecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); if (dictBySecAppIdx.containsKey(key)) { Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdictSecAppIdx = dictBySecAppIdx.get(key); cursor = new CFInternetRamSecFormCursor(Authorization, schema, subdictSecAppIdx.values()); } else { cursor = new CFInternetRamSecFormCursor( Authorization, schema, new ArrayList<CFSecuritySecFormBuff>()); } return (cursor); }
public CFSecurityCursor openServiceCursorByTypeIdx( CFSecurityAuthorization Authorization, int ServiceTypeId) { CFSecurityCursor cursor; CFSecurityServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); if (dictByTypeIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); cursor = new CFBamRamServiceCursor(Authorization, schema, subdictTypeIdx.values()); } else { cursor = new CFBamRamServiceCursor(Authorization, schema, new ArrayList<CFSecurityServiceBuff>()); } return (cursor); }
public CFSecurityISOLanguageBuff[] readDerivedByCode2Idx( CFSecurityAuthorization Authorization, String ISO6391Code) { final String S_ProcName = "CFInternetRamISOLanguage.readDerivedByCode2Idx"; CFSecurityISOLanguageByCode2IdxKey key = schema.getFactoryISOLanguage().newCode2IdxKey(); key.setOptionalISO6391Code(ISO6391Code); CFSecurityISOLanguageBuff[] recArray; if (dictByCode2Idx.containsKey(key)) { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = dictByCode2Idx.get(key); recArray = new CFSecurityISOLanguageBuff[subdictCode2Idx.size()]; Iterator<CFSecurityISOLanguageBuff> iter = subdictCode2Idx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>(); dictByCode2Idx.put(key, subdictCode2Idx); recArray = new CFSecurityISOLanguageBuff[0]; } return (recArray); }
public CFSecurityCursor openServiceCursorByHostIdx( CFSecurityAuthorization Authorization, long ClusterId, long HostNodeId) { CFSecurityCursor cursor; CFSecurityServiceByHostIdxKey key = schema.getFactoryService().newHostIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredHostNodeId(HostNodeId); if (dictByHostIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictHostIdx = dictByHostIdx.get(key); cursor = new CFBamRamServiceCursor(Authorization, schema, subdictHostIdx.values()); } else { cursor = new CFBamRamServiceCursor(Authorization, schema, new ArrayList<CFSecurityServiceBuff>()); } return (cursor); }
public void minimizeMemory() { allSecDevice = null; indexByUserIdx = null; List<ICFSecuritySecDeviceObj> toForget = new LinkedList<ICFSecuritySecDeviceObj>(); ICFSecuritySecDeviceObj cur = null; Iterator<ICFSecuritySecDeviceObj> iter = members.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(); } }
public CFSecurityCursor openOptFullRangeCursorByTenantIdx( CFSecurityAuthorization Authorization, long TenantId) { CFSecurityCursor cursor; CFDbTestOptFullRangeByTenantIdxKey key = schema.getFactoryOptFullRange().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (dictByTenantIdx.containsKey(key)) { Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx = dictByTenantIdx.get(key); cursor = new CFDbTestRamOptFullRangeCursor(Authorization, schema, subdictTenantIdx.values()); } else { cursor = new CFDbTestRamOptFullRangeCursor( Authorization, schema, new ArrayList<CFDbTestOptFullRangeBuff>()); } return (cursor); }
public void deleteLoaderBehaviourByIdIdx( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourPKey argKey) { CFDbTestLoaderBehaviourBuff cur; LinkedList<CFDbTestLoaderBehaviourBuff> matchSet = new LinkedList<CFDbTestLoaderBehaviourBuff>(); Iterator<CFDbTestLoaderBehaviourBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestLoaderBehaviourBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteLoaderBehaviour(Authorization, cur); } }
public CFSecurityCursor openSecGroupMemberCursorByUserIdx( CFSecurityAuthorization Authorization, UUID SecUserId) { CFSecurityCursor cursor; CFSecuritySecGroupMemberByUserIdxKey key = schema.getFactorySecGroupMember().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); if (dictByUserIdx.containsKey(key)) { Map<CFSecuritySecGroupMemberPKey, CFSecuritySecGroupMemberBuff> subdictUserIdx = dictByUserIdx.get(key); cursor = new CFFreeSwitchRamSecGroupMemberCursor(Authorization, schema, subdictUserIdx.values()); } else { cursor = new CFFreeSwitchRamSecGroupMemberCursor( Authorization, schema, new ArrayList<CFSecuritySecGroupMemberBuff>()); } return (cursor); }
public void deleteSecGroupMemberByUUserIdx( CFSecurityAuthorization Authorization, CFSecuritySecGroupMemberByUUserIdxKey argKey) { CFSecuritySecGroupMemberBuff cur; LinkedList<CFSecuritySecGroupMemberBuff> matchSet = new LinkedList<CFSecuritySecGroupMemberBuff>(); Iterator<CFSecuritySecGroupMemberBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecuritySecGroupMemberBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecGroupMember(Authorization, cur); } }
public CFSecurityServiceBuff[] readDerivedByTypeIdx( CFSecurityAuthorization Authorization, int ServiceTypeId) { final String S_ProcName = "CFBamRamService.readDerivedByTypeIdx"; CFSecurityServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); CFSecurityServiceBuff[] recArray; if (dictByTypeIdx.containsKey(key)) { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); recArray = new CFSecurityServiceBuff[subdictTypeIdx.size()]; Iterator<CFSecurityServiceBuff> iter = subdictTypeIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityServicePKey, CFSecurityServiceBuff> subdictTypeIdx = new HashMap<CFSecurityServicePKey, CFSecurityServiceBuff>(); dictByTypeIdx.put(key, subdictTypeIdx); recArray = new CFSecurityServiceBuff[0]; } return (recArray); }
public CFDbTestOptFullRangeBuff[] readDerivedByTenantIdx( CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFDbTestRamOptFullRange.readDerivedByTenantIdx"; CFDbTestOptFullRangeByTenantIdxKey key = schema.getFactoryOptFullRange().newTenantIdxKey(); key.setRequiredTenantId(TenantId); CFDbTestOptFullRangeBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx = dictByTenantIdx.get(key); recArray = new CFDbTestOptFullRangeBuff[subdictTenantIdx.size()]; Iterator<CFDbTestOptFullRangeBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx = new HashMap<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff>(); dictByTenantIdx.put(key, subdictTenantIdx); recArray = new CFDbTestOptFullRangeBuff[0]; } return (recArray); }
public CFSecurityCursor openISOLanguageCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFInternetRamISOLanguageCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public CFSecurityCursor openSecGroupMemberCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFFreeSwitchRamSecGroupMemberCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public CFSecurityCursor openClusterCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFDbTestRamClusterCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public List<ICFSecuritySecDeviceObj> readAllSecDevice(boolean forceRead) { final String S_ProcName = "readAllSecDevice"; if ((allSecDevice == null) || forceRead) { Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> map = new HashMap<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>(); allSecDevice = map; CFSecuritySecDeviceBuff[] buffList = ((ICFAsteriskSchema) schema.getBackingStore()) .getTableSecDevice() .readAllDerived(schema.getAuthorization()); CFSecuritySecDeviceBuff buff; ICFSecuritySecDeviceObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey()); obj.setBuff(buff); ICFSecuritySecDeviceObj realized = (ICFSecuritySecDeviceObj) obj.realize(); } } Comparator<ICFSecuritySecDeviceObj> cmp = new Comparator<ICFSecuritySecDeviceObj>() { public int compare(ICFSecuritySecDeviceObj lhs, ICFSecuritySecDeviceObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecuritySecDevicePKey lhsPKey = lhs.getPKey(); CFSecuritySecDevicePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allSecDevice.size(); ICFSecuritySecDeviceObj arr[] = new ICFSecuritySecDeviceObj[len]; Iterator<ICFSecuritySecDeviceObj> valIter = allSecDevice.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFSecuritySecDeviceObj> arrayList = new ArrayList<ICFSecuritySecDeviceObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecuritySecDeviceObj> sortedList = arrayList; return (sortedList); }
public CFSecurityCursor openServiceCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFBamRamServiceCursor(Authorization, schema, dictByPKey.values()); return (cursor); }
public List<ICFSecuritySecDeviceObj> readSecDeviceByUserIdx(UUID SecUserId, boolean forceRead) { final String S_ProcName = "readSecDeviceByUserIdx"; CFSecuritySecDeviceByUserIdxKey key = ((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey(); key.setRequiredSecUserId(SecUserId); Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> dict; if (indexByUserIdx == null) { indexByUserIdx = new HashMap< CFSecuritySecDeviceByUserIdxKey, Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>>(); } if ((!forceRead) && indexByUserIdx.containsKey(key)) { dict = indexByUserIdx.get(key); } else { dict = new HashMap<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj>(); // Allow other threads to dirty-read while we're loading indexByUserIdx.put(key, dict); ICFSecuritySecDeviceObj obj; CFSecuritySecDeviceBuff[] buffList = ((ICFAsteriskSchema) schema.getBackingStore()) .getTableSecDevice() .readDerivedByUserIdx(schema.getAuthorization(), SecUserId); CFSecuritySecDeviceBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getSecDeviceTableObj().newInstance(); obj.setPKey(((ICFAsteriskSchema) schema.getBackingStore()).getFactorySecDevice().newPKey()); obj.setBuff(buff); ICFSecuritySecDeviceObj realized = (ICFSecuritySecDeviceObj) obj.realize(); } } Comparator<ICFSecuritySecDeviceObj> cmp = new Comparator<ICFSecuritySecDeviceObj>() { public int compare(ICFSecuritySecDeviceObj lhs, ICFSecuritySecDeviceObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecuritySecDevicePKey lhsPKey = lhs.getPKey(); CFSecuritySecDevicePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFSecuritySecDeviceObj arr[] = new ICFSecuritySecDeviceObj[len]; Iterator<ICFSecuritySecDeviceObj> valIter = dict.values().iterator(); int idx = 0; while ((idx < len) && valIter.hasNext()) { arr[idx++] = valIter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len); } else if (valIter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len); } Arrays.sort(arr, cmp); ArrayList<ICFSecuritySecDeviceObj> arrayList = new ArrayList<ICFSecuritySecDeviceObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecuritySecDeviceObj> sortedList = arrayList; return (sortedList); }
public CFSecurityCursor openLoaderBehaviourCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFDbTestRamLoaderBehaviourCursor(Authorization, schema, dictByPKey.values()); return (cursor); }