List of usage examples for java.util List removeAll
boolean removeAll(Collection<?> c);
From source file:in.raster.oviyam.servlet.AutoRefreshStudies.java
/** * Handles the HTTP <code>GET</code> method. * @param request servlet request//www .j a v a 2s .c o m * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); List studyList = (ArrayList) session.getAttribute("studyList"); String queryStr = request.getParameter("query"); String searchDays = findValueFromQuery(queryStr, "searchDays"); String searchDates = ""; String studyTime = ""; if (searchDays.equals("between")) { searchDates = findValueFromQuery(queryStr, "from") + "-" + findValueFromQuery(queryStr, "to"); studyTime = findValueFromQuery(queryStr, "fromTime") + "-" + findValueFromQuery(queryStr, "toTime"); } String modality = findValueFromQuery(queryStr, "modality"); String dcmUrl = findValueFromQuery(queryStr, "dcmURL"); //System.out.println("DICOM URL**************: " + dcmUrl); PatientInfo patientInfo = new PatientInfo(); patientInfo.callFindWithQuery("", "", "", searchDates, studyTime, modality, "", "", "", dcmUrl); List studies = patientInfo.getStudyList(); studies.removeAll(studyList); JSONArray jsonArray = new JSONArray(); JSONObject jsonObj = null; try { for (Object obj : studies) { StudyModel sm = (StudyModel) obj; jsonObj = new JSONObject(); jsonObj.put("patientID", sm.getPatientID()); jsonObj.put("patientName", sm.getPatientName()); jsonObj.put("patientGender", sm.getPatientGender()); jsonObj.put("patientBirthDate", sm.getPatientBirthDate()); jsonObj.put("physicianName", sm.getPhysicianName()); //jsonObj.put("studyTime", sm.getStudyTime()); jsonObj.put("studyDescription", sm.getStudyDescription()); jsonObj.put("modalitiesInStudy", sm.getModalitiesInStudy()); jsonObj.put("studyRelatedInstances", sm.getStudyRelatedInstances()); jsonObj.put("accessionNumber", sm.getAccessionNumber()); jsonObj.put("studyInstanceUID", sm.getStudyInstanceUID()); jsonObj.put("studyRelatedSeries", sm.getStudyRelatedSeries()); String sDate = sm.getStudyDate(); if (sDate != null) { SimpleDateFormat sdf; if (sm.getStudyTime() != null && sm.getStudyTime().length() > 0) { sDate = sDate + " " + sm.getStudyTime(); sdf = new SimpleDateFormat("yyyyMMdd HHmmss"); } else { sdf = new SimpleDateFormat("yyyyMMdd"); } Date sDateTmp = sdf.parse(sDate); //sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); jsonObj.put("studyDate", sdf.format(sDateTmp)); } jsonArray.put(jsonObj); studyList.add(sm); } } catch (Exception e) { log.error("Exception occured while creating JSON Array...", e); } session.setAttribute("studyList", studyList); PrintWriter out = response.getWriter(); out.println(jsonArray); }
From source file:soc.scar.controller.graphView1Controller.java
public void reviewByProject() { reviews = new ArrayList<>(); for (Project project : listSelectedProjects) { reviews.addAll(reviewService.findReviewsByProject(project)); }/*from www . ja v a2s. co m*/ if (listReviews != null && !listReviews.isEmpty()) { List<Review> reviewsSelectedToDelete = new ArrayList<>(listReviews); reviewsSelectedToDelete.removeAll(listSelectedProjectsByGroup); listReviews.removeAll(reviewsSelectedToDelete); } }
From source file:dk.statsbiblioteket.util.watch.FolderWatcher.java
/** * Wait until the added files has stabilized. * * @param oldContent the old content of the folder. * @return the added files when the list is deemed stable. * @throws java.io.IOException if the content could not be determined. *//*from ww w. j av a 2s .c om*/ private List<File> getStableContent(List<File> oldContent) throws IOException { List<File> added = new ArrayList<File>(getContent()); added.removeAll(oldContent); if (grace == 0) { return added; } long lastSize = -1; long currentSize = addSizes(added); while (lastSize != currentSize) { try { Thread.sleep(grace); } catch (InterruptedException e) { log.warn("Sleeping grace " + grace + "ms was interrupted", e); } added = new ArrayList<File>(getContent()); added.removeAll(oldContent); lastSize = currentSize; currentSize = addSizes(added); } return added; }
From source file:soc.scar.controller.graphView1Controller.java
public void projectByGroup() { listSelectedProjectsByGroup = new ArrayList<>(); for (Group group : listSelectedGroup) { listSelectedProjectsByGroup.addAll(projectService.findProjectByGroup(group)); }/*from w w w .j a va 2 s .c o m*/ if (listProjects != null && !listProjects.isEmpty()) { List<Project> projectSelectedToDelete = new ArrayList<>(listProjects); projectSelectedToDelete.removeAll(listSelectedProjectsByGroup); listProjects.removeAll(projectSelectedToDelete); } }
From source file:com.gargoylesoftware.htmlunit.TestCaseTest.java
private void checkLines(final String relativePath, final String line, final List<String> lines, final String elementName, final List<String> allElements) { final List<String> allExpectedLines = new ArrayList<>(); for (final String element : allElements) { allExpectedLines.add(line.replace(elementName, element)); }/*from ww w.j ava2 s. c om*/ allExpectedLines.removeAll(lines); if (!allExpectedLines.isEmpty()) { fail("You must specify the following line in " + relativePath + ":\n" + StringUtils.join(allExpectedLines, System.lineSeparator())); } }
From source file:org.kuali.mobility.push.dao.PreferenceDaoImpl.java
@Override public List<String> findUsersThatAllowedSender(String senderKey) { // Get all the usernames of users that blocked senders, because we only save users that opted out Query query = getEntityManager().createNamedQuery("Preference.findUsersThatBlockedSenderKey"); query.setParameter("senderKey", senderKey); List<String> blockedUsernames = (List<String>) query.getResultList(); // Find all the users that has devices query = getEntityManager().createNamedQuery("Device.getDeviceUsernames"); List<String> allowedUsers = (List<String>) query.getResultList(); // Now remove all the users that blocked allowedUsers.removeAll(blockedUsernames); // Those that remained should receive the notifications return allowedUsers; }
From source file:net.sf.taverna.t2.activities.rest.RESTActivityFactory.java
@Override public Set<ActivityInputPort> getInputPorts(JsonNode configuration) throws ActivityConfigurationException { Set<ActivityInputPort> activityInputPorts = new HashSet<>(); RESTActivityConfigurationBean configBean = new RESTActivityConfigurationBean(configuration); // ---- CREATE INPUTS ---- // all input ports are dynamic and depend on the configuration // of the particular instance of the REST activity // POST and PUT operations send data, so an input for the message body // is required if (RESTActivity.hasMessageBodyInputPort(configBean.getHttpMethod())) { // the input message will be just an XML string for now activityInputPorts.add(edits.createActivityInputPort(RESTActivity.IN_BODY, 0, true, null, configBean.getOutgoingDataFormat().getDataFormat())); }//w ww . j a v a2 s . c om // now process the URL signature - extract all placeholders and create // an input port for each List<String> placeholders = URISignatureHandler.extractPlaceholders(configBean.getUrlSignature()); String acceptsHeaderValue = configBean.getAcceptsHeaderValue(); if (acceptsHeaderValue != null && !acceptsHeaderValue.isEmpty()) { try { List<String> acceptsPlaceHolders = URISignatureHandler.extractPlaceholders(acceptsHeaderValue); acceptsPlaceHolders.removeAll(placeholders); placeholders.addAll(acceptsPlaceHolders); } catch (URISignatureParsingException e) { logger.error(e); } } for (ArrayList<String> httpHeaderNameValuePair : configBean.getOtherHTTPHeaders()) { try { List<String> headerPlaceHolders = URISignatureHandler .extractPlaceholders(httpHeaderNameValuePair.get(1)); headerPlaceHolders.removeAll(placeholders); placeholders.addAll(headerPlaceHolders); } catch (URISignatureParsingException e) { logger.error(e); } } for (String placeholder : placeholders) { // these inputs will have a dynamic name each; // the data type is string as they are the values to be // substituted into the URL signature at the execution time activityInputPorts.add(edits.createActivityInputPort(placeholder, 0, true, null, String.class)); } return activityInputPorts; }
From source file:com.thoughtworks.go.domain.materials.mercurial.HgModificationSplitter.java
private Modification parseChangeset(Element changeset) { Date modifiedTime = DateUtils.parseRFC822(changeset.getChildText("date")); String author = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("author")); String comment = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("desc")); String revision = changeset.getChildText("node"); Modification modification = new Modification(author, comment, null, modifiedTime, revision); Element files = changeset.getChild("files"); List<File> modifiedFiles = parseFiles(files, "modified"); List<File> addedFiles = parseFiles(files, "added"); List<File> deletedFiles = parseFiles(files, "deleted"); modifiedFiles.removeAll(addedFiles); modifiedFiles.removeAll(deletedFiles); addModificationFiles(modification, ModifiedAction.added, addedFiles); addModificationFiles(modification, ModifiedAction.deleted, deletedFiles); addModificationFiles(modification, ModifiedAction.modified, modifiedFiles); return modification; }
From source file:com.floreantpos.model.dao.TableBookingInfoDAO.java
public List<ShopTable> getFreeTables(Date startDate, Date endDate) { Collection<ShopTable> bookedTables = getBookedTables(startDate, endDate); List<ShopTable> allTables = ShopTableDAO.getInstance().findAll(); allTables.removeAll(bookedTables); return allTables; }
From source file:de.ks.file.FileViewController.java
public void addFiles(List<File> additionalFiles) { additionalFiles.removeAll(files); additionalFiles.forEach(this::addPossibleImage); log.info("Adding addtional files {}", additionalFiles); files.addAll(additionalFiles);//from w ww .jav a2 s .c om if (!additionalFiles.isEmpty()) { Collections.sort(files); Collections.sort(additionalFiles); File lastFile = additionalFiles.get(additionalFiles.size() - 1); fileList.scrollTo(lastFile); fileList.getSelectionModel().clearSelection(); fileList.getSelectionModel().select(lastFile); } }