List of usage examples for java.util List listIterator
ListIterator<E> listIterator();
From source file:gobblin.salesforce.SalesforceExtractor.java
@Override public List<Command> getHighWatermarkMetadata(String schema, String entity, String watermarkColumn, List<Predicate> predicateList) throws HighWatermarkException { this.log.debug("Build url to retrieve high watermark"); String query = "SELECT " + watermarkColumn + " FROM " + entity; String defaultPredicate = " " + watermarkColumn + " != null"; String defaultSortOrder = " ORDER BY " + watermarkColumn + " desc LIMIT 1"; String existingPredicate = ""; if (this.updatedQuery != null) { String queryLowerCase = this.updatedQuery.toLowerCase(); int startIndex = queryLowerCase.indexOf(" where "); if (startIndex > 0) { existingPredicate = this.updatedQuery.substring(startIndex); }/* w w w . j a v a 2 s.c o m*/ } query = query + existingPredicate; String limitString = this.getLimitFromInputQuery(query); query = query.replace(limitString, ""); Iterator<Predicate> i = predicateList.listIterator(); while (i.hasNext()) { Predicate predicate = i.next(); query = SqlQueryUtils.addPredicate(query, predicate.getCondition()); } query = SqlQueryUtils.addPredicate(query, defaultPredicate); query = query + defaultSortOrder; this.log.info("QUERY: " + query); try { return constructGetCommand(this.getFullUri(this.getSoqlUrl(query))); } catch (Exception e) { throw new HighWatermarkException( "Failed to get salesforce url for high watermark; error - " + e.getMessage(), e); } }
From source file:org.apache.gobblin.salesforce.SalesforceExtractor.java
@Override public List<Command> getDataMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList) throws DataRecordException { log.debug("Build url to retrieve data records"); String query = this.updatedQuery; String url = null;// ww w.ja v a2 s . c o m try { if (this.getNextUrl() != null && this.pullStatus == true) { url = this.getNextUrl(); } else { if (isNullPredicate(predicateList)) { log.info("QUERY:" + query); return constructGetCommand(this.sfConnector.getFullUri(getSoqlUrl(query))); } String limitString = getLimitFromInputQuery(query); query = query.replace(limitString, ""); Iterator<Predicate> i = predicateList.listIterator(); while (i.hasNext()) { Predicate predicate = i.next(); query = SqlQueryUtils.addPredicate(query, predicate.getCondition()); } if (Boolean.valueOf( this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_IS_SPECIFIC_API_ACTIVE))) { query = SqlQueryUtils.addPredicate(query, "IsDeleted = true"); } query = query + limitString; log.info("QUERY: " + query); url = this.sfConnector.getFullUri(getSoqlUrl(query)); } return constructGetCommand(url); } catch (Exception e) { throw new DataRecordException( "Failed to get salesforce url for data records; error - " + e.getMessage(), e); } }
From source file:javazoom.jlgui.player.amp.PlayerUI.java
/** * Play files from a list./* www .jav a 2 s .c o m*/ * @param files */ protected void playFiles(List files) { if (files.size() > 0) { // Clean the playlist. playlist.removeAllItems(); // Add all dropped files to playlist. ListIterator li = files.listIterator(); while (li.hasNext()) { File file = (File) li.next(); PlaylistItem pli = null; if (file != null) { pli = new PlaylistItem(file.getName(), file.getAbsolutePath(), -1, true); if (pli != null) playlist.appendItem(pli); } } // Start the playlist from the top. playlist.nextCursor(); playlistUI.initPlayList(); setCurrentSong(playlist.getCursor()); } }
From source file:com.att.aro.diagnostics.GraphPanel.java
private static List<ScheduledAlarmInfo> getHasFiredAlarms(Map<String, List<ScheduledAlarmInfo>> pendingAlarms) { List<ScheduledAlarmInfo> result = new ArrayList<ScheduledAlarmInfo>(); for (Map.Entry<String, List<ScheduledAlarmInfo>> entry : pendingAlarms.entrySet()) { List<ScheduledAlarmInfo> alarms = entry.getValue(); ListIterator itrAlarms = alarms.listIterator(); while (itrAlarms.hasNext()) { ScheduledAlarmInfo alarm = (ScheduledAlarmInfo) itrAlarms.next(); if (alarm.getHasFired() > 0) { result.add(alarm);// ww w . ja va2s. c o m } } } return result; }
From source file:gobblin.salesforce.SalesforceExtractor.java
@Override public List<Command> getCountMetadata(String schema, String entity, WorkUnit workUnit, List<Predicate> predicateList) throws RecordCountException { this.log.debug("Build url to retrieve source record count"); String existingPredicate = ""; if (this.updatedQuery != null) { String queryLowerCase = this.updatedQuery.toLowerCase(); int startIndex = queryLowerCase.indexOf(" where "); if (startIndex > 0) { existingPredicate = this.updatedQuery.substring(startIndex); }//from ww w .ja va 2 s .com } String query = "SELECT COUNT() FROM " + entity + existingPredicate; String limitString = this.getLimitFromInputQuery(query); query = query.replace(limitString, ""); try { if (isNullPredicate(predicateList)) { this.log.info("QUERY: " + query); return constructGetCommand(this.getFullUri(this.getSoqlUrl(query))); } else { Iterator<Predicate> i = predicateList.listIterator(); while (i.hasNext()) { Predicate predicate = i.next(); query = SqlQueryUtils.addPredicate(query, predicate.getCondition()); } query = query + this.getLimitFromInputQuery(this.updatedQuery); this.log.info("QUERY: " + query); return constructGetCommand(this.getFullUri(this.getSoqlUrl(query))); } } catch (Exception e) { throw new RecordCountException( "Failed to get salesforce url for record count; error - " + e.getMessage(), e); } }
From source file:org.apache.flex.compiler.mxml.MXMLData.java
/** * Use the MXML tokens to build MXMLUnitData. * @param data the {@link MXMLData} object * @param tokens the list of tokens to build this data from * @param dialect the {@link MXMLDialect} we are working against * @param incremental true if this data is being built incrementally. All location updates will need to be done outside this element *//*from w w w .ja va 2s . com*/ private void parse(MXMLData data, List<MXMLToken> tokens, MXMLDialect dialect, Collection<ICompilerProblem> problems) { ArrayList<MXMLUnitData> units = new ArrayList<MXMLUnitData>(tokens.size() / 6); nsMap = new HashMap<IMXMLTagData, PrefixMap>(); MXMLUnitData unit = null; MXMLToken currentComment = null; FastStack<Integer> depth = new FastStack<Integer>(tokens.size() / 8); IFileSpecification spec = new FileSpecification(data.getPath() != null ? data.getPath() : ""); depth.setStackDecorator(new IFastStackDecorator<Integer>() { @Override public Integer decorate(Integer e) { if (e == null) return -1; return e; } }); int index = -1; int balancingIndex = 0; depth.push(index); ListIterator<MXMLToken> tokenIterator = tokens.listIterator(); BalancingMXMLProcessor processor = new BalancingMXMLProcessor(getFileSpecification(), problems); while (tokenIterator.hasNext()) { MXMLToken token = tokenIterator.next(); switch (token.getType()) { case MXMLTokenTypes.TOKEN_ASDOC_COMMENT: currentComment = token; //treat this like text. unit = new MXMLTextData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; case MXMLTokenTypes.TOKEN_COMMENT: case MXMLTokenTypes.TOKEN_CDATA: case MXMLTokenTypes.TOKEN_WHITESPACE: //treat this like text. unit = new MXMLTextData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; case MXMLTokenTypes.TOKEN_OPEN_TAG_START: unit = new MXMLTagData(); MutablePrefixMap map = ((MXMLTagData) unit).init(this, token, tokenIterator, dialect, spec, problems); ((MXMLTagData) unit).setCommentToken(currentComment); currentComment = null; units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); if (!((MXMLTagData) unit).isEmptyTag()) processor.addOpenTag((MXMLTagData) unit, balancingIndex); } if (map != null) nsMap.put((MXMLTagData) unit, map.toImmutable()); if (!((MXMLTagData) unit).isEmptyTag()) { depth.push(index); balancingIndex++; } break; case MXMLTokenTypes.TOKEN_CLOSE_TAG_START: unit = new MXMLTagData(); ((MXMLTagData) unit).init(this, token, tokenIterator, dialect, spec, problems); ((MXMLTagData) unit).setCommentToken(currentComment); if (!((MXMLTagData) unit).isEmptyTag()) { depth.pop(); balancingIndex--; } index++; if (fullContent) { unit.setLocation(data, index); unit.setParentUnitDataIndex(depth.peek()); processor.addCloseTag((MXMLTagData) unit, balancingIndex); } currentComment = null; units.add(unit); break; case MXMLTokenTypes.TOKEN_TEXT: unit = new MXMLTextData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; case MXMLTokenTypes.TOKEN_MXML_BLOB: unit = new MXMLTagBlobData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; case MXMLTokenTypes.TOKEN_DATABINDING_START: unit = new MXMLDatabindingData(token, tokenIterator); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; case MXMLTokenTypes.TOKEN_PROCESSING_INSTRUCTION: unit = new MXMLInstructionData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; default: if (token.isEntity()) { unit = new MXMLEntityData(token); units.add(unit); index++; if (fullContent) { unit.setParentUnitDataIndex(depth.peek()); unit.setLocation(data, index); } break; } else { problems.add(new SyntaxProblem(token)); break; } } } this.units = units.toArray(new IMXMLUnitData[0]); if (fullContent && shouldRepair) { this.units = processor.balance(this.units, this, nsMap); if (processor.wasRepaired()) { //repaired, so let's rebuild our prefix maps and tag depths refreshPositionData(); } } }
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);/* w w w .ja v a2 s. c o m*/ holderMap.put(type, node); } return holderMap; }
From source file:gov.nih.nci.ncicb.cadsr.contexttree.service.impl.CDEBrowserTreeServiceImpl.java
private Map addInitialCategoryNodes(DefaultMutableTreeNode cscsiNode, String uniqueIdPrefix, 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(); DefaultMutableTreeNode node = getWebNode(type, uniqueIdPrefix + type); cscsiNode.add(node);//from w w w .j a va 2s .c o m holderMap.put(type, node); } return holderMap; }
From source file:javazoom.jlgui.player.amp.PlayerUI.java
/** * Process Drag&Drop//from w w w .java2 s .c o m * @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:eu.eubrazilcc.lvl.service.ServiceTest.java
@Before public void setUp() throws Exception { // load test configuration final File file = new File( concat(DEFAULT_LOCATION, "test" + separator + "etc" + separator + REST_SERVICE_CONFIG)); if (file.canRead()) { final List<URL> urls = newArrayList(getDefaultConfiguration()); for (final ListIterator<URL> it = urls.listIterator(); it.hasNext();) { final URL url = it.next(); if (url.getPath().endsWith(REST_SERVICE_CONFIG)) { it.remove();/*www .j a va2s. c o m*/ it.add(toURLs(new File[] { file })[0]); } } CONFIG_MANAGER.setup(urls); } CONFIG_MANAGER.preload(); // setup test file-system environment deleteQuietly(TEST_OUTPUT_DIR); TEST_OUTPUT_DIR.mkdirs(); // prepare client final Client client = ClientBuilder.newBuilder().register(MapperProvider.class) .register(JacksonFeature.class).register(SseFeature.class).build(); // configure Web target target = client.target(BASE_URI); target.property(ClientProperties.FOLLOW_REDIRECTS, true); // insert valid users in the database (they are needed for properly authentication/authorization) ownerId1 = toResourceOwnerId("user1"); ownerId2 = toResourceOwnerId("user2"); ownerId3 = toResourceOwnerId("user3"); final User user1 = User.builder().userid("user1").password("password1").email("user1@example.com") .firstname("User 1").lastname("LVL User").role(USER_ROLE) .permissions(asPermissionList(userPermissions(ownerId1))).build(), user2 = User.builder().userid("user2").password("password2").email("user2@example.com") .firstname("User 2").lastname("LVL User").role(USER_ROLE) .permissions(asPermissionList(userPermissions(ownerId2))).build(), user3 = User.builder().userid("user3").password("password3").email("user3@example.com") .firstname("User 3").lastname("LVL User").role(USER_ROLE) .permissions(asPermissionList(userPermissions(ownerId3))).build(); RESOURCE_OWNER_DAO.insert(ResourceOwner.builder().user(user1).build()); RESOURCE_OWNER_DAO.insert(ResourceOwner.builder().user(user2).build()); RESOURCE_OWNER_DAO.insert(ResourceOwner.builder().user(user3).build()); // insert valid tokens in the database TOKEN_DAO.insert( AccessToken.builder().token(TOKEN_ROOT).issuedAt(currentTimeMillis() / 1000l).expiresIn(604800l) .ownerId(toResourceOwnerId("root")).scope(asPermissionList(allPermissions())).build()); TOKEN_DAO.insert(AccessToken.builder().token(TOKEN_USER1).issuedAt(currentTimeMillis() / 1000l) .expiresIn(604800l).ownerId(ownerId1).scope(user1.getPermissions()).build()); TOKEN_DAO.insert(AccessToken.builder().token(TOKEN_USER2).issuedAt(currentTimeMillis() / 1000l) .expiresIn(604800l).ownerId(ownerId2).scope(user2.getPermissions()).build()); TOKEN_DAO.insert(AccessToken.builder().token(TOKEN_USER3).issuedAt(currentTimeMillis() / 1000l) .expiresIn(604800l).ownerId(ownerId3).scope(user3.getPermissions()).build()); }