List of usage examples for java.util ArrayList contains
public boolean contains(Object o)
From source file:com.clustercontrol.hinemosagent.util.AgentConnectUtil.java
public static void sendMessageLocal(OutputBasicInfo outputBasicInfo, ArrayList<String> facilityIdList) throws HinemosUnknown, FacilityNotFound { // ?// ww w. jav a 2 s .com ArrayList<String> facilityList = null; if (!"SYS".equals(outputBasicInfo.getMonitorId())) { try { MonitorInfo entity = QueryUtil.getMonitorInfoPK_NONE(outputBasicInfo.getMonitorId()); String monitorFacilityId = entity.getFacilityId(); facilityList = FacilitySelector.getFacilityIdList(monitorFacilityId, entity.getOwnerRoleId(), 0, false, false); } catch (MonitorNotFound e) { m_log.warn(e.getMessage() + " (" + outputBasicInfo.getMonitorId() + ")", e); } } for (String facilityId : facilityIdList) { if (facilityList != null && !facilityList.contains(facilityId)) { m_log.debug("not match facilityId(" + facilityId + ")"); continue; } String scopeText = ""; try { NodeInfo nodeInfo = new RepositoryControllerBean().getNode(facilityId); scopeText = nodeInfo.getFacilityName(); } catch (FacilityNotFound e) { throw e; } // ?AsyncWorkerPlugin.addTask??? OutputBasicInfo clonedInfo = outputBasicInfo.clone(); clonedInfo.setFacilityId(facilityId); clonedInfo.setScopeText(scopeText); AsyncWorkerPlugin.addTask(NotifyEventTaskFactory.class.getSimpleName(), clonedInfo, false); } }
From source file:fr.fastconnect.factory.tibco.bw.maven.compile.CompileEARMojo.java
protected void cleanVarsDirectory(File varsDirectory, List<Dependency> projlibList) { File[] listFiles = varsDirectory.listFiles(); ArrayList<String> projlibNames = new ArrayList<String>(); for (Dependency dependency : projlibList) { projlibNames.add(dependency.getArtifactId()); }/*ww w . j a va 2 s .c om*/ for (File dir : listFiles) { if (projlibNames.contains(dir.getName()) && dir.isDirectory()) { for (File defaultVarsFile : dir.listFiles()) { cleanDirectory(defaultVarsFile); } dir.delete(); } } }
From source file:org.openmrs.module.emrapi.web.controller.EmrEncounterController_1_111_Test.java
@Test public void shouldAddDiagnosesAdObservation() throws Exception { executeDataSet("baseMetaData.xml"); executeDataSet("diagnosisMetaData.xml"); executeDataSet("shouldAddDiagnosisAsObservation.xml"); String cancerDiagnosisUuid = "d102c80f-1yz9-4da3-bb88-8122ce8868dh"; String encounterDateTime = "2005-01-02T00:00:00.000+0000"; String diagnosisDateTime = "2005-01-02T01:00:00.000+0000"; String postData = "{" + "\"patientUuid\" : \"a76e8d23-0c38-408c-b2a8-ea5540f01b51\", " + "\"visitTypeUuid\" : \"b45ca846-c79a-11e2-b0c0-8e397087571c\", " + "\"encounterTypeUuid\": \"2b377dba-62c3-4e53-91ef-b51c68899891\", " + "\"encounterDateTime\" : \"" + encounterDateTime + "\", " + "\"diagnoses\":[" + "{\"order\":\"PRIMARY\", \"certainty\": \"CONFIRMED\", \"codedAnswer\": { \"uuid\": \"" + cancerDiagnosisUuid + "\"}, \"diagnosisDateTime\": \"" + diagnosisDateTime + "\" }" + "]" + "}"; EncounterTransaction response = deserialize(handle(newPostRequest("/rest/emrapi/encounter", postData)), EncounterTransaction.class); Visit visit = visitService.getVisitByUuid(response.getVisitUuid()); Encounter encounter = visit.getEncounters().iterator().next(); Set<Obs> obsAtTopLevel = encounter.getObsAtTopLevel(false); assertEquals(1, obsAtTopLevel.size()); Obs parentObservation = obsAtTopLevel.iterator().next(); assertTrue(parentObservation.isObsGrouping()); assertEquals(DateUtils.parseDate(diagnosisDateTime, dateTimeFormat), parentObservation.getObsDatetime()); Set<Obs> diagnosisObservationGroupMembers = parentObservation.getGroupMembers(); assertEquals(3, diagnosisObservationGroupMembers.size()); ArrayList<String> valueCodedNames = getValuCodedNames(diagnosisObservationGroupMembers); assertTrue(valueCodedNames.contains("Confirmed")); assertTrue(valueCodedNames.contains("Primary")); assertTrue(valueCodedNames.contains("Cancer")); }
From source file:com.clustercontrol.logfile.session.MonitorLogfileControllerBean.java
/** * /* w w w.j ava2 s . c om*/ * <??> ???Agent???????? * <??> ???Agent????????? * * facilityID?????? * withCalendartrue???MonitorInfo?calendarDTO???? * * * @return Object?2? * @throws HinemosUnknown * @throws MonitorNotFound * */ public ArrayList<MonitorInfo> getLogfileListForFacilityId(String facilityId, boolean withCalendar) throws MonitorNotFound, HinemosUnknown { ArrayList<MonitorInfo> ret = new ArrayList<MonitorInfo>(); JpaTransactionManager jtm = null; try { jtm = new JpaTransactionManager(); jtm.begin(); // ????????????????????????? // (?????????????????????????) ArrayList<MonitorInfo> monitorList = getCache(); for (MonitorInfo monitorInfo : monitorList) { String scope = monitorInfo.getFacilityId(); ArrayList<String> facilityIdList = new RepositoryControllerBean().getExecTargetFacilityIdList(scope, monitorInfo.getOwnerRoleId()); if (facilityIdList != null && facilityIdList.contains(facilityId)) { if (withCalendar) { String calendarId = monitorInfo.getCalendarId(); try { CalendarInfo calendar = new CalendarControllerBean().getCalendarFull(calendarId); monitorInfo.setCalendar(calendar); } catch (Exception e) { m_log.warn("getLogfileList() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); throw new HinemosUnknown(e.getMessage(), e); } } ret.add(monitorInfo); } } jtm.commit(); } catch (HinemosUnknown e) { jtm.rollback(); throw e; } catch (Exception e) { m_log.warn("getLogfileListForFacilityId() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return ret; }
From source file:com.clustercontrol.winevent.session.MonitorWinEventControllerBean.java
/** * /*from w ww. ja v a 2 s. c o m*/ * <??> ???Agent???????? * <??> ???Agent????????? * * ??????????Windows? * * ????????????????????????? * (??? = ?????????readLock???????) * * @param requestedFacilityId ???facilityId * @return Windows? * @throws InvalidRole * @throws HinemosUnknown ?????? * */ public ArrayList<MonitorInfo> getWinEventList(String requestedFacilityId) throws InvalidRole, HinemosUnknown { JpaTransactionManager jtm = null; ArrayList<MonitorInfo> list = new ArrayList<MonitorInfo>(); try { jtm = new JpaTransactionManager(); jtm.begin(); { // ????????????????????????? // (?????????????????????????) ArrayList<MonitorInfo> monitorList = getCache(); for (MonitorInfo monitorInfo : monitorList) { String scope = monitorInfo.getFacilityId(); ArrayList<String> facilityIdList = new RepositoryControllerBean() .getExecTargetFacilityIdList(scope, monitorInfo.getOwnerRoleId()); if (facilityIdList != null && facilityIdList.contains(requestedFacilityId)) { String calendarId = monitorInfo.getCalendarId(); if (calendarId != null) { CalendarInfo calendar = new CalendarControllerBean().getCalendarFull(calendarId); monitorInfo.setCalendar(calendar); } list.add(monitorInfo); } } } jtm.commit(); } catch (InvalidRole | HinemosUnknown e) { if (jtm != null) { jtm.rollback(); } throw e; } catch (Exception e) { m_log.warn("getWinEventList() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return list; }
From source file:br.gov.jfrj.itextpdf.Documento.java
public static ArrayList<String> getAssinantesStringLista(Set<ExMovimentacao> movsAssinatura) { ArrayList<String> assinantes = new ArrayList<String>(); for (ExMovimentacao movAssinatura : movsAssinatura) { String s = movAssinatura.getDescrMov().trim().toUpperCase(); s = s.split(":")[0]; s = s.intern();//from w ww . j a v a2 s . co m if (!assinantes.contains(s)) { assinantes.add(s); } } return assinantes; }
From source file:ispyb.server.security.DatabaseLoginModuleSecurityFilter.java
/** * The role/*from www . j a va 2s .com*/ * * @param username - The name of the user * @param role - Name of a role * @return true if the user is in the role, false otherwise */ public boolean isUserInRole(String username, String role) { boolean valid = false; ArrayList<String> dbRoles = new ArrayList<String>(); for (String dbRole : usernameRoles) { dbRoles.add(dbRole); } if (dbRoles.contains(role)) { valid = true; } return valid; }
From source file:com.esri.geoevent.solutions.processor.eventjoiner.EventJoinerProcessor.java
private void ConstructGeoEventDef(HashMap<String, GeoEvent> rec) throws Exception { try {/*from ww w . j a v a 2 s .c o m*/ fldMgr = new HashMap<String, FieldItem>(); Set<String> keys = rec.keySet(); Iterator<String> it = keys.iterator(); while (it.hasNext()) { String key = it.next(); GeoEvent evt = rec.get(key); List<FieldDefinition> fldDefs = evt.getGeoEventDefinition().getFieldDefinitions(); for (FieldDefinition fldDef : fldDefs) { String fldName = fldDef.getName(); FieldType type = fldDef.getType(); if (fldMgr.containsKey(fldName)) { FieldItem item = fldMgr.get(fldName); if (!fldDef.getTags().isEmpty()) item.appendTags(fldDef.getTags()); item.advance(); } else { FieldItem item = new FieldItem(); item.setId(fldName); item.setType(type); if (!fldDef.getTags().isEmpty()) item.appendTags(fldDef.getTags()); item.advance(); fldMgr.put(fldName, item); } } } Set<String> fldKeys = fldMgr.keySet(); Iterator<String> fldIt = fldKeys.iterator(); List<FieldDefinition> mergedFldDef = new ArrayList<FieldDefinition>(); while (fldIt.hasNext()) { String fldName = fldIt.next(); FieldItem item = fldMgr.get(fldName); FieldType type; FieldType fldtype = item.getType(); ArrayList<String> tags = item.getTags(); if (tags.contains("TRACK_ID")) { tags.remove("TRACK_ID"); } FieldDefinition fd = null; if (item.getCount() > 1) { if (fldName.equals(joinfield)) { tags.add("JOIN_ID"); tags.add("TRACK_ID"); String[] tagarr = new String[tags.size()]; tagarr = tags.toArray(tagarr); fd = new DefaultFieldDefinition(fldName, fldtype, (String[]) tagarr); } else { type = FieldType.Group; String[] groupedTag = { "GROUPED" }; fd = new DefaultFieldDefinition(fldName, type, groupedTag); for (Integer i = 0; i < item.getCount(); ++i) { String childName = defList.get(i); FieldDefinition child = null; if (tags.isEmpty()) { child = new DefaultFieldDefinition(childName, fldtype); } else { String[] tagarr = new String[tags.size()]; tagarr = tags.toArray(tagarr); child = new DefaultFieldDefinition(childName, fldtype, tagarr); } fd.addChild(child); } } } else { type = fldtype; if (!tags.isEmpty()) { fd = new DefaultFieldDefinition(fldName, fldtype, (String[]) tags.toArray()); } else { fd = new DefaultFieldDefinition(fldName, fldtype); } } mergedFldDef.add(fd); } outDef = new DefaultGeoEventDefinition(); outDef.setFieldDefinitions(mergedFldDef); outDef.setName(outdefname); outDef.setOwner(definition.getUri().toString()); Collection<GeoEventDefinition> eventDefs = manager.searchGeoEventDefinitionByName(outdefname); Iterator<GeoEventDefinition> eventDefIt = eventDefs.iterator(); while (eventDefIt.hasNext()) { GeoEventDefinition currentDef = eventDefIt.next(); manager.deleteGeoEventDefinition(currentDef.getGuid()); } manager.addGeoEventDefinition(outDef); } catch (ConfigurationException e) { LOG.error(e.getMessage()); throw (e); } catch (GeoEventDefinitionManagerException e) { LOG.error(e.getMessage()); throw (e); } catch (Exception e) { LOG.error(e.getMessage()); throw (e); } }
From source file:net.i2cat.netconf.test.BaseNetconfTest.java
@Test public void testCapabilities() { ArrayList<Capability> activeCapabilities = session.getActiveCapabilities(); ArrayList<Capability> clientCapabilities = session.getClientCapabilities(); ArrayList<Capability> serverCapabilities = session.getServerCapabilities(); assertTrue("Base capability must be supported and active", activeCapabilities.contains(Capability.BASE)); assertTrue("There is an active capability that we don't support", clientCapabilities.containsAll(activeCapabilities)); assertTrue("There is an active capability that the server doesn't support", serverCapabilities.containsAll(activeCapabilities)); ArrayList<Capability> commonCapabilities = new ArrayList<Capability>(clientCapabilities); commonCapabilities.retainAll(serverCapabilities); assertTrue("Active capabilities equal common client/server capabilities", commonCapabilities.containsAll(activeCapabilities) && activeCapabilities.containsAll(commonCapabilities)); }
From source file:UserInterface.Supplier.SalesOverviewJPanel.java
public void populateTable() { DefaultTableModel dtm = (DefaultTableModel) performanceJTable.getModel(); dtm.setRowCount(0);//w w w. j a va2 s .c om Object[] obj = new Object[3]; ArrayList<String> temp = new ArrayList<>(); for (Order o : moc.getMoc()) { if (o.getSupplier().getCompanyName().equals(s.getCompanyName())) { for (OrderItem oi : o.getListOfItemsOrdered()) { if (!temp.contains(oi.getProduct().getTypeOfDevice())) { obj[0] = oi.getProduct().getTypeOfDevice(); obj[1] = oi.getQuantity(); obj[2] = oi.getProduct().getCost() * oi.getQuantity(); dtm.addRow(obj); temp.add(oi.getProduct().getTypeOfDevice()); } else if (temp.contains(oi.getProduct().getTypeOfDevice())) { for (int i = 0; i < dtm.getRowCount(); i++) { String prodname = (String) dtm.getValueAt(i, 0); if (prodname.equals(oi.getProduct().getTypeOfDevice())) { int q = (int) dtm.getValueAt(i, 1) + oi.getQuantity(); int sale = q * oi.getProduct().getCost(); dtm.setValueAt(q, i, 1); dtm.setValueAt(sale, i, 2); } } } } } } }