public void setSwingDataCollection(Collection<ICFSecurityISOCountryObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfISOCountry = new ICFSecurityISOCountryObj[0]; } else { int len = value.size(); arrayOfISOCountry = new ICFSecurityISOCountryObj[len]; Iterator<ICFSecurityISOCountryObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfISOCountry[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfISOCountry, compareISOCountryByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
public String buildInterfaceTable(String rule, String[] serviceList) throws FilterParseException { StringBuffer buffer = new StringBuffer(); Filter filter = new Filter(); Map interfaces = filter.getIPServiceMap(rule); Iterator i = interfaces.keySet().iterator(); while (i.hasNext()) { String key = (String) i.next(); buffer.append("<tr><td valign=\"top\">").append(key).append("</td>"); buffer.append("<td>"); if (serviceList != null && serviceList.length != 0) { Map services = (Map) interfaces.get(key); Iterator j = services.keySet().iterator(); while (j.hasNext()) { String svc = (String) j.next(); for (int idx = 0; idx < serviceList.length; idx++) { if (svc.equals(serviceList[idx])) { buffer.append(svc).append("<br>"); } } } } else { buffer.append("All services"); } buffer.append("</td>"); buffer.append("</tr>"); } return buffer.toString(); }
private boolean containsColumn(Collection columns, String column) { if (columns.contains(column)) return true; for (Iterator it = columns.iterator(); it.hasNext(); ) { if (((String) it.next()).equalsIgnoreCase(column)) return true; } return false; }
public static Connection getConnection() { Iterator<ConnectionWrapper> poolIter = connectionPool.iterator(); while (poolIter.hasNext()) { ConnectionWrapper conn = poolIter.next(); try { if (conn == null || conn.isReallyClosed()) { poolIter.remove(); } else if (!conn.isClosed()) { return conn; } } catch (SQLException e) { log.error("Bad connection", e); poolIter.remove(); } } // No valid connections ConnectionWrapper conn = createConnection(); if (conn != null) { connectionPool.add(conn); log.info("Connection pool size: " + connectionPool.size()); } return conn; }
/* * Returns list of sensors currently loaded in the system * */ public static String getListOfSensors() { StringBuilder s = new StringBuilder(); Iterator iter = Mappings.getAllVSensorConfigs(); sensors.clear(); coordinates.clear(); while (iter.hasNext()) { VSensorConfig sensorConfig = (VSensorConfig) iter.next(); Double longitude = sensorConfig.getLongitude(); Double latitude = sensorConfig.getLatitude(); Double altitude = sensorConfig.getAltitude(); String sensor = sensorConfig.getName(); if ((latitude != null) && (longitude != null) && (altitude != null)) { Point point = new Point(latitude, longitude, altitude); coordinates.add(point); sensors.add(sensor); s.append(sensor) .append(" => ") .append(longitude) .append(" : ") .append(latitude) .append("\n"); } } return s.toString(); }
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 void forgetClearTopDepByContTblIdx(long TenantId, long ContTableId) { if (indexByContTblIdx == null) { return; } CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); if (indexByContTblIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(key); if (mapContTblIdx != null) { List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); ICFBamClearTopDepObj cur = null; Iterator<ICFBamClearTopDepObj> iter = mapContTblIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByContTblIdx.remove(key); } }
public void forgetSecGroupIncludeByIncludeIdx(long ClusterId, int IncludeGroupId) { if (indexByIncludeIdx == null) { return; } CFSecuritySecGroupIncludeByIncludeIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactorySecGroupInclude() .newIncludeIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredIncludeGroupId(IncludeGroupId); if (indexByIncludeIdx.containsKey(key)) { Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> mapIncludeIdx = indexByIncludeIdx.get(key); if (mapIncludeIdx != null) { List<ICFSecuritySecGroupIncludeObj> toForget = new LinkedList<ICFSecuritySecGroupIncludeObj>(); ICFSecuritySecGroupIncludeObj cur = null; Iterator<ICFSecuritySecGroupIncludeObj> iter = mapIncludeIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByIncludeIdx.remove(key); } }
public void deleteSecDeviceByUserIdx(UUID SecUserId) { CFSecuritySecDeviceByUserIdxKey key = ((ICFSecuritySchema) 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); ((ICFSecuritySchema) 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 { ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecDevice() .deleteSecDeviceByUserIdx(schema.getAuthorization(), SecUserId); } }
public static int close() { int count = 0; Iterator iterator = m_notUsedConnection.iterator(); while (iterator.hasNext()) { try { ((ConnectionWrapper) iterator.next()).close(); count++; } catch (Exception e) { } } m_notUsedConnection.clear(); iterator = m_usedUsedConnection.iterator(); while (iterator.hasNext()) { try { ConnectionWrapper wrapper = (ConnectionWrapper) iterator.next(); wrapper.close(); if (DEBUG) { wrapper.debugInfo.printStackTrace(); } count++; } catch (Exception e) { } } m_usedUsedConnection.clear(); return count; }
public void forgetISOCountryCurrencyByCurrencyIdx(short ISOCurrencyId) { if (indexByCurrencyIdx == null) { return; } CFSecurityISOCountryCurrencyByCurrencyIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactoryISOCountryCurrency() .newCurrencyIdxKey(); key.setRequiredISOCurrencyId(ISOCurrencyId); if (indexByCurrencyIdx.containsKey(key)) { Map<CFSecurityISOCountryCurrencyPKey, ICFSecurityISOCountryCurrencyObj> mapCurrencyIdx = indexByCurrencyIdx.get(key); if (mapCurrencyIdx != null) { List<ICFSecurityISOCountryCurrencyObj> toForget = new LinkedList<ICFSecurityISOCountryCurrencyObj>(); ICFSecurityISOCountryCurrencyObj cur = null; Iterator<ICFSecurityISOCountryCurrencyObj> iter = mapCurrencyIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByCurrencyIdx.remove(key); } }
public void deleteTaxByTenantIdx(long TenantId) { CFAccTaxByTenantIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (indexByTenantIdx == null) { indexByTenantIdx = new HashMap<CFAccTaxByTenantIdxKey, Map<CFAccTaxPKey, ICFAccTaxObj>>(); } if (indexByTenantIdx.containsKey(key)) { Map<CFAccTaxPKey, ICFAccTaxObj> dict = indexByTenantIdx.get(key); ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId); Iterator<ICFAccTaxObj> iter = dict.values().iterator(); ICFAccTaxObj obj; List<ICFAccTaxObj> toForget = new LinkedList<ICFAccTaxObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByTenantIdx.remove(key); } else { ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .deleteTaxByTenantIdx(schema.getAuthorization(), TenantId); } }
public void forgetTaxByTenantIdx(long TenantId) { if (indexByTenantIdx == null) { return; } CFAccTaxByTenantIdxKey key = ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey(); key.setRequiredTenantId(TenantId); if (indexByTenantIdx.containsKey(key)) { Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(key); if (mapTenantIdx != null) { List<ICFAccTaxObj> toForget = new LinkedList<ICFAccTaxObj>(); ICFAccTaxObj cur = null; Iterator<ICFAccTaxObj> iter = mapTenantIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByTenantIdx.remove(key); } }
public List<ICFAccTaxObj> readAllTax(boolean forceRead) { final String S_ProcName = "readAllTax"; if ((allTax == null) || forceRead) { Map<CFAccTaxPKey, ICFAccTaxObj> map = new HashMap<CFAccTaxPKey, ICFAccTaxObj>(); allTax = map; CFAccTaxBuff[] buffList = ((ICFAccSchema) schema.getBackingStore()) .getTableTax() .readAllDerived(schema.getAuthorization()); CFAccTaxBuff buff; ICFAccTaxObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey()); obj.setBuff(buff); ICFAccTaxObj realized = (ICFAccTaxObj) obj.realize(); } } Comparator<ICFAccTaxObj> cmp = new Comparator<ICFAccTaxObj>() { public int compare(ICFAccTaxObj lhs, ICFAccTaxObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFAccTaxPKey lhsPKey = lhs.getPKey(); CFAccTaxPKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allTax.size(); ICFAccTaxObj arr[] = new ICFAccTaxObj[len]; Iterator<ICFAccTaxObj> valIter = allTax.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<ICFAccTaxObj> arrayList = new ArrayList<ICFAccTaxObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFAccTaxObj> sortedList = arrayList; return (sortedList); }
public void deleteClearTopDepByContTblIdx(long TenantId, long ContTableId) { CFBamClearTopDepByContTblIdxKey key = schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredContTableId(ContTableId); if (indexByContTblIdx == null) { indexByContTblIdx = new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>(); } if (indexByContTblIdx.containsKey(key)) { Map<CFBamScopePKey, ICFBamClearTopDepObj> dict = indexByContTblIdx.get(key); schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByContTblIdx(schema.getAuthorization(), TenantId, ContTableId); Iterator<ICFBamClearTopDepObj> iter = dict.values().iterator(); ICFBamClearTopDepObj obj; List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByContTblIdx.remove(key); } else { schema .getBackingStore() .getTableClearTopDep() .deleteClearTopDepByContTblIdx(schema.getAuthorization(), TenantId, ContTableId); } }
public void forgetSecDeviceByUserIdx(UUID SecUserId) { if (indexByUserIdx == null) { return; } CFSecuritySecDeviceByUserIdxKey key = ((ICFSecuritySchema) 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 void deleteNumberDefByNextIdx( CFSecurityAuthorization Authorization, CFDbTestValueByNextIdxKey argKey) { final String S_ProcName = "deleteNumberDefByNextIdx"; CFDbTestNumberDefBuff cur; LinkedList<CFDbTestNumberDefBuff> matchSet = new LinkedList<CFDbTestNumberDefBuff>(); Iterator<CFDbTestNumberDefBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestNumberDefBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); String subClassCode = cur.getClassCode(); if ("NUMD".equals(subClassCode)) { schema.getTableNumberDef().deleteNumberDef(Authorization, cur); } else if ("NUMC".equals(subClassCode)) { schema.getTableNumberCol().deleteNumberCol(Authorization, (CFDbTestNumberColBuff) cur); } else if ("NUMT".equals(subClassCode)) { schema.getTableNumberType().deleteNumberType(Authorization, (CFDbTestNumberTypeBuff) cur); } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "subClassCode", cur, "Instance of or subclass of NumberDef must not be \"" + subClassCode + "\""); } } }
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 ListIterator<ICFLibAnyObj> enumerateDetails(MssCFGenContext genContext) { final String S_ProcName = "CFAsteriskMssCFIterateHostNodeConfFile.enumerateDetails() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext.getGenDef()"); } List<ICFLibAnyObj> list = new LinkedList<ICFLibAnyObj>(); if (genDef instanceof ICFAsteriskHostNodeObj) { Iterator<ICFAsteriskConfigurationFileObj> elements = ((ICFAsteriskHostNodeObj) genDef).getOptionalComponentsConfFile().iterator(); while (elements.hasNext()) { list.add(elements.next()); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.getGenDef()", genDef, "ICFAsteriskHostNodeObj"); } return (list.listIterator()); }
public CFSecurityTSecGroupMemberBuff[] readDerivedByGroupIdx( CFSecurityAuthorization Authorization, long TenantId, int TSecGroupId) { final String S_ProcName = "CFSecurityRamTSecGroupMember.readDerivedByGroupIdx"; CFSecurityTSecGroupMemberByGroupIdxKey key = schema.getFactoryTSecGroupMember().newGroupIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTSecGroupId(TSecGroupId); CFSecurityTSecGroupMemberBuff[] recArray; if (dictByGroupIdx.containsKey(key)) { Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictGroupIdx = dictByGroupIdx.get(key); recArray = new CFSecurityTSecGroupMemberBuff[subdictGroupIdx.size()]; Iterator<CFSecurityTSecGroupMemberBuff> iter = subdictGroupIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictGroupIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>(); dictByGroupIdx.put(key, subdictGroupIdx); recArray = new CFSecurityTSecGroupMemberBuff[0]; } return (recArray); }
public ListIterator<ICFLibAnyObj> enumerateDetails(MssCFGenContext genContext) { final String S_ProcName = "CFInternetMssCFIterateTSecGroupIncByGroup.enumerateDetails() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext.getGenDef()"); } List<ICFLibAnyObj> list = new LinkedList<ICFLibAnyObj>(); if (genDef instanceof ICFInternetTSecGroupObj) { Iterator<ICFSecurityTSecGroupIncludeObj> elements = ((ICFInternetTSecGroupObj) genDef).getRequiredChildrenIncByGroup().iterator(); while (elements.hasNext()) { list.add(elements.next()); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.getGenDef()", genDef, "ICFInternetTSecGroupObj"); } return (list.listIterator()); }
private void setupDefaultConverters() throws XavaException { Iterator it = propertyMappings.values().iterator(); while (it.hasNext()) { PropertyMapping propertyMapping = (PropertyMapping) it.next(); propertyMapping.setDefaultConverter(); } }
public void deleteDelSubDep3ByIdIdx(CFBamAuthorization Authorization, CFBamScopePKey argKey) { CFBamDelSubDep3Buff cur; LinkedList<CFBamDelSubDep3Buff> matchSet = new LinkedList<CFBamDelSubDep3Buff>(); Iterator<CFBamDelSubDep3Buff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFBamDelSubDep3Buff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDelSubDep3(Authorization, cur); } }
/** * 采用批方式插入多条数据 * * @param collection collection * @throws Exception */ public void insertAll(Collection collection) throws Exception { StringBuffer buffer = new StringBuffer(200); buffer.append("INSERT INTO LwWholeSalePrice ("); buffer.append("PowerClass,"); buffer.append("SaleArea,"); buffer.append("VoltageBegin,"); buffer.append("VoltageEnd,"); buffer.append("Price,"); buffer.append("ValidStatus,"); buffer.append("Flag,"); buffer.append("Remark "); buffer.append(") "); buffer.append("VALUES(?,?,?,?,?,?,?,?)"); if (logger.isDebugEnabled()) { logger.debug(buffer.toString()); } dbManager.prepareStatement(buffer.toString()); for (Iterator i = collection.iterator(); i.hasNext(); ) { LwWholeSalePriceDto lwWholeSalePriceDto = (LwWholeSalePriceDto) i.next(); dbManager.setString(1, lwWholeSalePriceDto.getPowerClass()); dbManager.setString(2, lwWholeSalePriceDto.getSaleArea()); dbManager.setDouble(3, lwWholeSalePriceDto.getVoltageBegin()); dbManager.setDouble(4, lwWholeSalePriceDto.getVoltageEnd()); dbManager.setDouble(5, lwWholeSalePriceDto.getPrice()); dbManager.setString(6, lwWholeSalePriceDto.getValidStatus()); dbManager.setString(7, lwWholeSalePriceDto.getFlag()); dbManager.setString(8, lwWholeSalePriceDto.getRemark()); dbManager.addBatch(); } dbManager.executePreparedUpdateBatch(); }
public void deleteFeeByIdIdx(CFSecurityAuthorization Authorization, CFAccFeePKey argKey) { CFAccFeeBuff cur; LinkedList<CFAccFeeBuff> matchSet = new LinkedList<CFAccFeeBuff>(); Iterator<CFAccFeeBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccFeeBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteFee(Authorization, cur); } }
public ListIterator<ICFLibAnyObj> enumerateDetails(MssCFGenContext genContext) { final String S_ProcName = "CFBamMssCFIterateNumberTypeRef.enumerateDetails() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext.getGenDef()"); } List<ICFLibAnyObj> list = new LinkedList<ICFLibAnyObj>(); if (genDef instanceof ICFBamNumberTypeObj) { Iterator<ICFBamTableColObj> elements = ((ICFBamNumberTypeObj) genDef).getOptionalChildrenRef().iterator(); while (elements.hasNext()) { list.add(elements.next()); } } else { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.getGenDef()", genDef, "ICFBamNumberTypeObj"); } return (list.listIterator()); }
/** * 采用批方式插入多条数据 * * @param collection collection * @throws Exception */ public void insertAll(Collection collection) throws Exception { StringBuffer buffer = new StringBuffer(200); buffer.append("INSERT INTO LineLoss ("); buffer.append("LineCode,"); buffer.append("R,"); buffer.append("LineLong,"); buffer.append("Volt,"); buffer.append("T,"); buffer.append("ValidStatus,"); buffer.append("Flag,"); buffer.append("Remark "); buffer.append(") "); buffer.append("VALUES(?,?,?,?,?,?,?,?)"); if (logger.isDebugEnabled()) { logger.debug(buffer.toString()); } dbManager.prepareStatement(buffer.toString()); for (Iterator i = collection.iterator(); i.hasNext(); ) { LineLossDto lineLossDto = (LineLossDto) i.next(); dbManager.setString(1, lineLossDto.getLineCode()); dbManager.setDouble(2, lineLossDto.getR()); dbManager.setDouble(3, lineLossDto.getLineLong()); dbManager.setDouble(4, lineLossDto.getVolt()); dbManager.setDouble(5, lineLossDto.getT()); dbManager.setString(6, lineLossDto.getValidStatus()); dbManager.setString(7, lineLossDto.getFlag()); dbManager.setString(8, lineLossDto.getRemark()); dbManager.addBatch(); } dbManager.executePreparedUpdateBatch(); }
public CFSecuritySecSessionBuff[] readDerivedByFinishIdx( CFSecurityAuthorization Authorization, UUID SecUserId, Calendar Finish) { final String S_ProcName = "CFSecurityRamSecSession.readDerivedByFinishIdx"; CFSecuritySecSessionByFinishIdxKey key = schema.getFactorySecSession().newFinishIdxKey(); key.setRequiredSecUserId(SecUserId); key.setOptionalFinish(Finish); CFSecuritySecSessionBuff[] recArray; if (dictByFinishIdx.containsKey(key)) { Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictFinishIdx = dictByFinishIdx.get(key); recArray = new CFSecuritySecSessionBuff[subdictFinishIdx.size()]; Iterator<CFSecuritySecSessionBuff> iter = subdictFinishIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictFinishIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>(); dictByFinishIdx.put(key, subdictFinishIdx); recArray = new CFSecuritySecSessionBuff[0]; } return (recArray); }
public CFSecuritySecDeviceBuff[] readBuffByUserIdx( CFSecurityAuthorization Authorization, UUID SecUserId) { final String S_ProcName = "readBuffByUserIdx"; ResultSet resultSet = null; try { Connection cnx = schema.getCnx(); String sql = "call " + schema.getLowerDbSchemaName() + ".sp_read_secdev_by_useridx( ?, ?, ?, ?, ?" + ", " + "?" + " )"; if (stmtReadBuffByUserIdx == null) { stmtReadBuffByUserIdx = cnx.prepareStatement(sql); } int argIdx = 1; stmtReadBuffByUserIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUserIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadBuffByUserIdx.setString( argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadBuffByUserIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadBuffByUserIdx.setLong( argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadBuffByUserIdx.setString(argIdx++, SecUserId.toString()); try { resultSet = stmtReadBuffByUserIdx.executeQuery(); } catch (SQLException e) { if (e.getErrorCode() != 1329) { throw e; } resultSet = null; } List<CFSecuritySecDeviceBuff> buffList = new LinkedList<CFSecuritySecDeviceBuff>(); while ((resultSet != null) && resultSet.next()) { CFSecuritySecDeviceBuff buff = unpackSecDeviceResultSetToBuff(resultSet); buffList.add(buff); } int idx = 0; CFSecuritySecDeviceBuff[] retBuff = new CFSecuritySecDeviceBuff[buffList.size()]; Iterator<CFSecuritySecDeviceBuff> iter = buffList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } } }
public CFBamDelSubDep3Buff[] readDerivedByContDelDep2Idx( CFBamAuthorization Authorization, long ContTenantId, long ContDelDep2Id) { final String S_ProcName = "CFBamRamDelSubDep3.readDerivedByContDelDep2Idx() "; CFBamDelSubDep3ByContDelDep2IdxKey key = schema.getFactoryDelSubDep3().newContDelDep2IdxKey(); key.setRequiredContTenantId(ContTenantId); key.setRequiredContDelDep2Id(ContDelDep2Id); CFBamDelSubDep3Buff[] recArray; if (dictByContDelDep2Idx.containsKey(key)) { Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdictContDelDep2Idx = dictByContDelDep2Idx.get(key); recArray = new CFBamDelSubDep3Buff[subdictContDelDep2Idx.size()]; Iterator<CFBamDelSubDep3Buff> iter = subdictContDelDep2Idx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdictContDelDep2Idx = new HashMap<CFBamScopePKey, CFBamDelSubDep3Buff>(); dictByContDelDep2Idx.put(key, subdictContDelDep2Idx); recArray = new CFBamDelSubDep3Buff[0]; } return (recArray); }