public void createClearDep(CFSecurityAuthorization Authorization, CFBamClearDepBuff Buff) { final String S_ProcName = "createClearDep"; String rqst = CFBamXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFBamXMsgClearDepMessageFormatter.formatClearDepRqstCreate("\n\t\t\t", Buff) + "\n" + CFBamXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); try { schema.getCFTipClientHandler().issueAppRequest(rqst); } catch (BadPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught BadPaddingException - " + e.getMessage(), e); } catch (IllegalBlockSizeException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught IllegalBlockSizeException - " + e.getMessage(), e); } catch (InvalidKeyException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidKeyException - " + e.getMessage(), e); } catch (NoSuchAlgorithmException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchAlgorithmException - " + e.getMessage(), e); } catch (InvalidAlgorithmParameterException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught InvalidAlgorithmParameterException - " + e.getMessage(), e); } catch (NoSuchPaddingException e) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Caught NoSuchPaddingException - " + e.getMessage(), e); } ICFTipResponseHandler responseHandler = schema.getCFTipClientHandler().getResponseHandler(); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object lastObjectProcessed = responseHandler.getLastObjectProcessed(); if (lastObjectProcessed != null) { ICFBamClearDepObj realized = null; if (lastObjectProcessed instanceof ICFBamClearDepObj) { realized = (ICFBamClearDepObj) lastObjectProcessed; } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "lastObjectProcessed", lastObjectProcessed, "ICFBamClearDepObj"); } if (realized != null) { Buff.set(realized.getClearDepBuff()); } } else { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException( getClass(), S_ProcName, 0, "responseHandler.getLastObjectProcessed()"); } }
public List<ICFBamClearTopDepObj> readClearTopDepByTableIdx( long TenantId, long RelationId, boolean forceRead) { final String S_ProcName = "readClearTopDepByTableIdx"; CFBamClearDepByTableIdxKey key = schema.getBackingStore().getFactoryClearDep().newTableIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredRelationId(RelationId); Map<CFBamScopePKey, ICFBamClearTopDepObj> dict; if (indexByTableIdx == null) { indexByTableIdx = new HashMap<CFBamClearDepByTableIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if ((!forceRead) && indexByTableIdx.containsKey(key)) { dict = indexByTableIdx.get(key); } else { dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>(); // Allow other threads to dirty-read while we're loading indexByTableIdx.put(key, dict); ICFBamClearDepObj obj; CFBamClearDepBuff[] buffList = schema .getBackingStore() .getTableClearDep() .readDerivedByTableIdx(schema.getAuthorization(), TenantId, RelationId); CFBamClearDepBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = (ICFBamClearTopDepObj) schema.getScopeTableObj().constructByClassCode(buff.getClassCode()); obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey()); obj.setBuff(buff); ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize(); } } Comparator<ICFBamClearTopDepObj> cmp = new Comparator<ICFBamClearTopDepObj>() { public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFBamScopePKey lhsPKey = lhs.getPKey(); CFBamScopePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len]; Iterator<ICFBamClearTopDepObj> 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<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFBamClearTopDepObj> sortedList = arrayList; return (sortedList); }