List of usage examples for java.util ListIterator hasNext
boolean hasNext();
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleProjectBaseTable.java
public CFAstProjectBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }/*from w ww.j av a 2 s. c o m*/ ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; CallableStatement stmtReadClassCodeByTenantIdx = null; try { Connection cnx = schema.getCnx(); stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName() + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); stmtReadClassCodeByTenantIdx.execute(); resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadClassCodeByTenantIdx != null) { try { stmtReadClassCodeByTenantIdx.close(); } catch (SQLException e) { } stmtReadClassCodeByTenantIdx = null; } } List<CFAstProjectBaseBuff> resultList = new LinkedList<CFAstProjectBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BPRJ")) { CFAstProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFAstProjectBaseBuff[] retBuff = new CFAstProjectBaseBuff[resultList.size()]; Iterator<CFAstProjectBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleProjectBaseTable.java
public CFAstProjectBaseBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }// ww w . j a v a 2 s . c o m ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; CallableStatement stmtReadClassCodeByTenantIdx = null; try { Connection cnx = schema.getCnx(); stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); stmtReadClassCodeByTenantIdx.execute(); resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadClassCodeByTenantIdx != null) { try { stmtReadClassCodeByTenantIdx.close(); } catch (SQLException e) { } stmtReadClassCodeByTenantIdx = null; } } List<CFAstProjectBaseBuff> resultList = new LinkedList<CFAstProjectBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BPRJ")) { CFAstProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFAstRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFAstTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFAstSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFAstVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFAstMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFAstMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFAstProjectBaseBuff[] retBuff = new CFAstProjectBaseBuff[resultList.size()]; Iterator<CFAstProjectBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleProjectBaseTable.java
public CFFswProjectBaseBuff[] readDerivedByTenantIdx(CFFswAuthorization Authorization, long TenantId) { final String S_ProcName = "readDerivedByTenantIdx"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Transaction not open"); }//from w ww . ja v a2 s .co m ArrayList<String> classCodeList = new ArrayList<String>(); String classCode; ResultSet resultSet = null; CallableStatement stmtReadClassCodeByTenantIdx = null; try { Connection cnx = schema.getCnx(); stmtReadClassCodeByTenantIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName() + ".rd_bprjdefccbytenantidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtReadClassCodeByTenantIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString()); stmtReadClassCodeByTenantIdx.setString(argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId()); stmtReadClassCodeByTenantIdx.setLong(argIdx++, TenantId); stmtReadClassCodeByTenantIdx.execute(); resultSet = (ResultSet) stmtReadClassCodeByTenantIdx.getObject(1); if (resultSet != null) { try { while (resultSet.next()) { classCode = resultSet.getString(1); classCodeList.add(classCode); } } catch (SQLException e) { } } } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } resultSet = null; } if (stmtReadClassCodeByTenantIdx != null) { try { stmtReadClassCodeByTenantIdx.close(); } catch (SQLException e) { } stmtReadClassCodeByTenantIdx = null; } } List<CFFswProjectBaseBuff> resultList = new LinkedList<CFFswProjectBaseBuff>(); ListIterator<String> classCodeIter = classCodeList.listIterator(); while (classCodeIter.hasNext()) { classCode = classCodeIter.next(); if (classCode.equals("BPRJ")) { CFFswProjectBaseBuff[] subList = readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("RPRJ")) { CFFswRealProjectBuff[] subList = schema.getTableRealProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("TPRJ")) { CFFswTopProjectBuff[] subList = schema.getTableTopProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("SPRJ")) { CFFswSubProjectBuff[] subList = schema.getTableSubProject().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("VERN")) { CFFswVersionBuff[] subList = schema.getTableVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MJVR")) { CFFswMajorVersionBuff[] subList = schema.getTableMajorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else if (classCode.equals("MNVR")) { CFFswMinorVersionBuff[] subList = schema.getTableMinorVersion().readBuffByTenantIdx(Authorization, TenantId); for (int subListIdx = 0; subListIdx < subList.length; subListIdx++) { resultList.add(subList[subListIdx]); } } else { throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName, "Did not expect ClassCode \"" + classCode + "\""); } } int idx = 0; CFFswProjectBaseBuff[] retBuff = new CFFswProjectBaseBuff[resultList.size()]; Iterator<CFFswProjectBaseBuff> iter = resultList.iterator(); while (iter.hasNext()) { retBuff[idx++] = iter.next(); } return (retBuff); }
From source file:com.xerox.amazonws.ec2.Jec2.java
/** * Describes an attribute of an AMI./*from w ww . java 2 s .c om*/ * * @param imageId The AMI for which the attribute is described. * @param imageAttribute The attribute type to describe. * @return An object containing the imageId and a list of list attribute item types and values. * @throws EC2Exception wraps checked exceptions */ public DescribeImageAttributeResult describeImageAttribute(String imageId, ImageAttribute.ImageAttributeType imageAttribute) throws EC2Exception { Map<String, String> params = new HashMap<String, String>(); params.put("ImageId", imageId); if (imageAttribute.equals(ImageAttribute.ImageAttributeType.launchPermission)) { params.put("Attribute", "launchPermission"); } else if (imageAttribute.equals(ImageAttribute.ImageAttributeType.productCodes)) { params.put("Attribute", "productCodes"); } GetMethod method = new GetMethod(); try { DescribeImageAttributeResponse response = makeRequest(method, "DescribeImageAttribute", params, DescribeImageAttributeResponse.class); ImageListAttribute attribute = null; if (response.getLaunchPermission() != null) { LaunchPermissionListType list = response.getLaunchPermission(); attribute = new LaunchPermissionAttribute(); java.util.ListIterator i = list.getItems().listIterator(); while (i.hasNext()) { LaunchPermissionItemType item = (LaunchPermissionItemType) i.next(); if (item.getGroup() != null) { attribute.addImageListAttributeItem(ImageListAttribute.ImageListAttributeItemType.group, item.getGroup()); } else if (item.getUserId() != null) { attribute.addImageListAttributeItem(ImageListAttribute.ImageListAttributeItemType.userId, item.getUserId()); } } } else if (response.getProductCodes() != null) { ProductCodeListType list = response.getProductCodes(); attribute = new ProductCodesAttribute(); java.util.ListIterator i = list.getItems().listIterator(); while (i.hasNext()) { ProductCodeItemType item = (ProductCodeItemType) i.next(); if (item.getProductCode() != null) { attribute.addImageListAttributeItem( ImageListAttribute.ImageListAttributeItemType.productCode, item.getProductCode()); } } } ArrayList<String> codes = new ArrayList<String>(); ProductCodeListType set = response.getProductCodes(); if (set != null) { for (ProductCodeItemType code : set.getItems()) { codes.add(code.getProductCode()); } } NullableAttributeValueType val = response.getKernel(); String kernel = (val != null) ? val.getValue() : ""; val = response.getRamdisk(); String ramdisk = (val != null) ? val.getValue() : ""; ArrayList<BlockDeviceMapping> bdm = new ArrayList<BlockDeviceMapping>(); BlockDeviceMappingType bdmSet = response.getBlockDeviceMapping(); if (bdmSet != null) { for (BlockDeviceMappingItemType mapping : bdmSet.getItems()) { bdm.add(new BlockDeviceMapping(mapping.getVirtualName(), mapping.getDeviceName())); } } return new DescribeImageAttributeResult(response.getImageId(), attribute, codes, kernel, ramdisk, bdm); } catch (JAXBException ex) { throw new EC2Exception("Problem parsing returned message.", ex); } catch (MalformedURLException ex) { throw new EC2Exception(ex.getMessage(), ex); } catch (IOException ex) { throw new EC2Exception(ex.getMessage(), ex); } finally { method.releaseConnection(); } }
From source file:org.powertac.householdcustomer.customers.Village.java
/** * This function is creating a certain number of RandomSeed days that will be * public vacation for the people living in the environment. * /*from ww w. jav a2s.c om*/ * @param days * @param gen * @return */ Vector<Integer> createPublicVacationVector(int days) { // Creating auxiliary variables Vector<Integer> v = new Vector<Integer>(days); for (int i = 0; i < days; i++) { int x = gen.nextInt(VillageConstants.DAYS_OF_COMPETITION + VillageConstants.DAYS_OF_BOOTSTRAP); ListIterator<Integer> iter = v.listIterator(); while (iter.hasNext()) { int temp = (int) iter.next(); if (x == temp) { x = x + 1; iter = v.listIterator(); } } v.add(x); } java.util.Collections.sort(v); return v; }
From source file:javazoom.jlgui.player.amp.PlayerUI.java
/** * Process Drag&Drop/*w ww . ja v a 2 s.c om*/ * @param data */ public void processDnD(Object data) { log.debug("Player DnD"); // Looking for files to drop. if (data instanceof List) { List al = (List) data; if ((al != null) && (al.size() > 0)) { ArrayList fileList = new ArrayList(); ArrayList folderList = new ArrayList(); ListIterator li = al.listIterator(); while (li.hasNext()) { File f = (File) li.next(); if ((f.exists()) && (f.canRead())) { if (f.isFile()) fileList.add(f); else if (f.isDirectory()) folderList.add(f); } } playFiles(fileList); // TODO : Add dir support } } else if (data instanceof String) { String files = (String) data; if ((files.length() > 0)) { ArrayList fileList = new ArrayList(); ArrayList folderList = new ArrayList(); StringTokenizer st = new StringTokenizer(files, System.getProperty("line.separator")); // Transfer files dropped. while (st.hasMoreTokens()) { String path = st.nextToken(); if (path.startsWith("file://")) { path = path.substring(7, path.length()); if (path.endsWith("\r")) path = path.substring(0, (path.length() - 1)); } File f = new File(path); if ((f.exists()) && (f.canRead())) { if (f.isFile()) fileList.add(f); else if (f.isDirectory()) folderList.add(f); } } playFiles(fileList); // TODO : Add dir support } } else { log.info("Unknown dropped objects"); } }
From source file:gov.nih.nci.ncicb.cadsr.contexttree.service.impl.CDEBrowserTreeServiceImpl.java
private void addAllcscsiNodes(List cscsiList, Map cscsiMap, String contextId, LazyActionTreeNode csNode, List templateTypes, Map cscsiholderMap) { if (cscsiList == null || cscsiMap == null || csNode == null || cscsiholderMap == null) return;// w w w.j a v a 2s . c om ListIterator it = cscsiList.listIterator(); while (it.hasNext()) { String cscsiId = (String) it.next(); ClassSchemeItem cscsi = (ClassSchemeItem) cscsiMap.get(cscsiId); LazyActionTreeNode node = new LazyActionTreeNode("Folder", cscsi.getClassSchemeItemName(), false); csNode.addLeaf(node); Map categoryMap = addInitialCategoryNodes(node, templateTypes); CsCSICatetegoryHolder cscsiCatHolder = new CsCSICatetegoryHolder(); cscsiCatHolder.setNode(node); cscsiCatHolder.setCategoryHolder(categoryMap); cscsiholderMap.put(cscsiId, cscsiCatHolder); } }
From source file:gov.nih.nci.ncicb.cadsr.contexttree.service.impl.CDEBrowserTreeServiceImpl.java
private Map addInitialCategoryNodes(LazyActionTreeNode cscsiNode, List templateTypes) { if (templateTypes == null) return new HashMap(); Map holderMap = new HashMap(); // Map holding catagory to catagory Node ListIterator it = templateTypes.listIterator(); while (it.hasNext()) { String type = (String) it.next(); LazyActionTreeNode node = new LazyActionTreeNode("Folder", type, false); cscsiNode.addLeaf(node);//from w ww . j a va 2s. c o m holderMap.put(type, node); } return holderMap; }