List of usage examples for java.lang String compareToIgnoreCase
public int compareToIgnoreCase(String str)
From source file:com.ibm.domino.das.resources.DocumentResource.java
@GET @Produces(MediaType.APPLICATION_JSON)/*from w w w . j a v a 2 s . com*/ public Response getDocumentByUnid(@Context final UriInfo uriInfo, @PathParam(PARAM_UNID) final String unid, @HeaderParam(HEADER_IF_MODIFIED_SINCE) final String ifModifiedSince, @QueryParam(PARAM_COMPACT) final boolean compact, @QueryParam(PARAM_DOC_STRONGTYPE) final boolean strongType, @QueryParam(PARAM_DOC_HIDDEN) final boolean hidden, @QueryParam(PARAM_DOC_MARKREAD) final String markRead, @QueryParam(PARAM_DOC_MULTIPART) final String multipart, @QueryParam(PARAM_DOC_LOWERCASEFIELDS) final boolean lowercaseItems, @QueryParam(PARAM_DOC_FIELDS) final String items) { DAS_LOGGER.traceEntry(this, "getDocumentByUnid"); // $NON-NLS-1$ final ResponseBuilder builder = Response.ok(); abstract class StreamingOutputImpl implements StreamingOutput { Response response = null; public void setResponse(Response response) { this.response = response; } } StreamingOutputImpl streamJsonEntity = new StreamingOutputImpl() { // @Override public void write(OutputStream outputStream) throws IOException { Document document = null; try { Database database = getDatabase(DB_ACCESS_VIEWS_DOCS); try { document = database.getDocumentByUNID(unid); } catch (NotesException e) { throw new WebApplicationException( ErrorHelper.createErrorResponse(e, Response.Status.NOT_FOUND)); } URI baseUri = UriHelper.copy(uriInfo.getAbsolutePath(), DataService.isUseRelativeUrls()); //Unid don't contain special characters, so don't need encode baseUri = UriHelper.trimAtLast(baseUri, PARAM_SEPERATOR + unid); OutputStreamWriter streamWriter = new OutputStreamWriter(outputStream); String lastModifiedHeader = ifModifiedSince(document, ifModifiedSince); if (lastModifiedHeader != null) { response.getMetadata().add(HEADER_LAST_MODIFIED, lastModifiedHeader); } JsonWriter jsonWriter = new JsonWriter(streamWriter, compact); JsonDocumentContent content = new JsonDocumentContent(document); int sysItems = DocumentParameters.SYS_ITEM_ALL; String rtType = TYPE_MULTIPART; // Handle parameters if (!hidden) { sysItems &= ~DocumentParameters.SYS_ITEM_HIDDEN; } if (multipart != null && multipart.compareToIgnoreCase(PARAM_VALUE_FALSE) == 0) { rtType = TYPE_RICHTEXT; // Deprecated } List<String> defItemFilter = null; if (StringUtil.isNotEmpty(items)) { defItemFilter = DataService.getParameterStringList(PARAM_DOC_FIELDS, items); } try { content.writeDocumentAsJson(jsonWriter, sysItems, true, defItemFilter, lowercaseItems, null, strongType, rtType, baseUri.toString()); } finally { jsonWriter.flush(); } // Handle parameters. if (markRead == null || markRead.compareToIgnoreCase(PARAM_VALUE_TRUE) == 0) { document.markRead(); } else if (markRead.compareToIgnoreCase(PARAM_VALUE_FALSE) != 0) { throw new WebApplicationException( ErrorHelper.createErrorResponse("Invalid parameter.", Response.Status.BAD_REQUEST)); // $NLX-DocumentResource.Invalidparameter-1$ } streamWriter.close(); } catch (NotesException e) { throw new WebApplicationException( ErrorHelper.createErrorResponse(e, Response.Status.BAD_REQUEST)); } catch (ServiceException e) { throw new WebApplicationException( ErrorHelper.createErrorResponse(e, Response.Status.BAD_REQUEST)); } finally { if (document != null) { try { document.recycle(); } catch (NotesException e) { // Ignore } } } } }; builder.type(MediaType.APPLICATION_JSON_TYPE).entity(streamJsonEntity); Response response = builder.build(); streamJsonEntity.setResponse(response); DAS_LOGGER.traceExit(this, "getDocumentByUnid", response); // $NON-NLS-1$ return response; }
From source file:com.microsoft.tfs.core.httpclient.HttpMethodBase.java
/** * <p>//ww w .j a v a 2 s. c o m * Sends the request via the given {@link HttpConnection connection}. * </p> * * <p> * The request is written as the following sequence of actions: * </p> * * <ol> * <li>{@link #writeRequestLine(HttpState, HttpConnection)} is invoked to * write the request line.</li> * <li>{@link #writeRequestHeaders(HttpState, HttpConnection)} is invoked to * write the associated headers.</li> * <li><tt>\r\n</tt> is sent to close the head part of the request.</li> * <li>{@link #writeRequestBody(HttpState, HttpConnection)} is invoked to * write the body part of the request.</li> * </ol> * * <p> * Subclasses may want to override one or more of the above methods to to * customize the processing. (Or they may choose to override this method if * dramatically different processing is required.) * </p> * * @param state * the {@link HttpState state} information associated with this * method * @param conn * the {@link HttpConnection connection} used to execute this HTTP * method * * @throws IOException * if an I/O (transport) error occurs. Some transport exceptions can * be recovered from. * @throws HttpException * if a protocol exception occurs. Usually protocol exceptions * cannot be recovered from. */ protected void writeRequest(final HttpState state, final HttpConnection conn) throws IOException, HttpException { LOG.trace("enter HttpMethodBase.writeRequest(HttpState, HttpConnection)"); writeRequestLine(state, conn); writeRequestHeaders(state, conn); conn.writeLine(); // close head if (Wire.HEADER_WIRE.enabled()) { Wire.HEADER_WIRE.output("\r\n"); } final HttpVersion ver = getParams().getVersion(); final Header expectheader = getRequestHeader("Expect"); String expectvalue = null; if (expectheader != null) { expectvalue = expectheader.getValue(); } if ((expectvalue != null) && (expectvalue.compareToIgnoreCase("100-continue") == 0)) { if (ver.greaterEquals(HttpVersion.HTTP_1_1)) { // make sure the status line and headers have been sent conn.flushRequestOutputStream(); final int readTimeout = conn.getParams().getSoTimeout(); try { conn.setSocketTimeout(RESPONSE_WAIT_TIME_MS); readStatusLine(state, conn); processStatusLine(state, conn); readResponseHeaders(state, conn); processResponseHeaders(state, conn); if (statusLine.getStatusCode() == HttpStatus.SC_CONTINUE) { // Discard status line statusLine = null; LOG.debug("OK to continue received"); } else { return; } } catch (final InterruptedIOException e) { if (!ExceptionUtil.isSocketTimeoutException(e)) { throw e; } // Most probably Expect header is not recongnized // Remove the header to signal the method // that it's okay to go ahead with sending data removeRequestHeader("Expect"); LOG.info("100 (continue) read timeout. Resume sending the request"); } finally { conn.setSocketTimeout(readTimeout); } } else { removeRequestHeader("Expect"); LOG.info("'Expect: 100-continue' handshake is only supported by " + "HTTP/1.1 or higher"); } } writeRequestBody(state, conn); // make sure the entire request body has been sent conn.flushRequestOutputStream(); }
From source file:org.kordamp.json.xml.XMLSerializer.java
private void setValue(JSONObject jsonObject, Element element, String defaultType) { String clazz = getClass(element); String type = getType(element); type = (type == null) ? defaultType : type; String key = removeNamespacePrefix(element.getQualifiedName()); if (hasNamespaces(element) && !skipNamespaces) { setOrAccumulate(jsonObject, key, simplifyValue(jsonObject, processElement(element, type))); return;/* w w w.ja v a2 s .c om*/ } else if (element.getAttributeCount() > 0) { if (isFunction(element)) { Attribute paramsAttribute = element.getAttribute(addJsonPrefix("params")); String text = element.getValue(); String[] params = StringUtils.split(paramsAttribute.getValue(), ","); setOrAccumulate(jsonObject, key, new JSONFunction(params, text)); return; } /*else{ setOrAccumulate( jsonObject, key, simplifyValue( jsonObject, processElement( element, type ) ) ); return; }*/ } boolean classProcessed = false; if (clazz != null) { if (clazz.compareToIgnoreCase(JSONTypes.ARRAY) == 0) { setOrAccumulate(jsonObject, key, processArrayElement(element, type)); classProcessed = true; } else if (clazz.compareToIgnoreCase(JSONTypes.OBJECT) == 0) { setOrAccumulate(jsonObject, key, simplifyValue(jsonObject, processObjectElement(element, type))); classProcessed = true; } } if (!classProcessed) { if (type.compareToIgnoreCase(JSONTypes.BOOLEAN) == 0) { setOrAccumulate(jsonObject, key, Boolean.valueOf(element.getValue())); } else if (type.compareToIgnoreCase(JSONTypes.NUMBER) == 0) { // try integer first try { setOrAccumulate(jsonObject, key, Integer.valueOf(element.getValue())); } catch (NumberFormatException e) { setOrAccumulate(jsonObject, key, Double.valueOf(element.getValue())); } } else if (type.compareToIgnoreCase(JSONTypes.INTEGER) == 0) { setOrAccumulate(jsonObject, key, Integer.valueOf(element.getValue())); } else if (type.compareToIgnoreCase(JSONTypes.FLOAT) == 0) { setOrAccumulate(jsonObject, key, Double.valueOf(element.getValue())); } else if (type.compareToIgnoreCase(JSONTypes.FUNCTION) == 0) { String[] params = null; String text = element.getValue(); Attribute paramsAttribute = element.getAttribute(addJsonPrefix("params")); if (paramsAttribute != null) { params = StringUtils.split(paramsAttribute.getValue(), ","); } setOrAccumulate(jsonObject, key, new JSONFunction(params, text)); } else if (type.compareToIgnoreCase(JSONTypes.STRING) == 0) { // see if by any chance has a 'params' attribute Attribute paramsAttribute = element.getAttribute(addJsonPrefix("params")); if (paramsAttribute != null) { String[] params = null; String text = element.getValue(); params = StringUtils.split(paramsAttribute.getValue(), ","); setOrAccumulate(jsonObject, key, new JSONFunction(params, text)); } else { if (isArray(element, false)) { setOrAccumulate(jsonObject, key, processArrayElement(element, defaultType)); } else if (isObject(element, false)) { setOrAccumulate(jsonObject, key, simplifyValue(jsonObject, processObjectElement(element, defaultType))); } else { String value; if (isKeepCData && isCData(element)) { value = "<![CDATA[" + element.getValue() + "]]>"; } else { value = element.getValue(); } setOrAccumulate(jsonObject, key, trimSpaceFromValue(value)); } } } } }
From source file:it.fub.jardin.server.DbUtils.java
private MessageType getMessageType(final String type) { for (MessageType m : MessageType.values()) { if (type.compareToIgnoreCase(m.toString()) == 0) { return m; }/*from w ww.j a v a 2s .co m*/ } return null; }
From source file:com.krawler.workflow.bizservice.WorkflowServiceImpl.java
public String importWorkflow(String processid) throws ServiceException { String result = "{\"success\":false}"; try {//from ww w . ja va 2s .co m DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); String path = ConfigReader.getinstance().get("workflowpath") + processid; File fdir = new File(path); File file = new File(fdir + System.getProperty("file.separator") + "bpmn.xml"); Document doc = docBuilder.parse(file); int s; int a; String name = ""; ObjectInfo obj = new ObjectInfo(); HashMap<String, ObjectInfo> activityHm = new HashMap<String, ObjectInfo>(); NodeList nodeList = doc.getElementsByTagName("Activity"); for (s = 0; s < nodeList.getLength(); s++) { name = ""; Node node = nodeList.item(s); if (node.getNodeType() == Node.ELEMENT_NODE) { obj = new ObjectInfo(); obj.type = getNodeType(node); getNodeInfo(node, obj); if (obj.type.equals("activity")) { Node graphicsInfoNode = getActivityNode(node, 1); getGraphicsNodeInfo(graphicsInfoNode, obj); } activityHm.put(obj.objId, obj); } } NodeList transitionList = doc.getElementsByTagName("Transitions"); String fromId = ""; String toId = ""; ObjectInfo fromObj; ObjectInfo toObj; ObjectInfo tempObj; JSONObject jobj; JSONObject jtemp = new com.krawler.utils.json.base.JSONObject(); HashMap<String, String> fromConditionHm = new HashMap<String, String>(); MultiMap toConditionHm = new MultiHashMap(); for (int i = 0; i < transitionList.getLength(); i++) { Node node = transitionList.item(i); NodeList childrenList = node.getChildNodes(); for (int cnt = 0; cnt < childrenList.getLength(); cnt++) { node = childrenList.item(cnt); if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attr = node.getAttributes(); for (int b = 0; b < attr.getLength(); b++) { Node attribute = attr.item(b); name = attribute.getNodeName(); if (name.compareToIgnoreCase("From") == 0) { fromId = attribute.getNodeValue(); } else if (name.compareToIgnoreCase("To") == 0) { toId = attribute.getNodeValue(); } } fromObj = activityHm.get(fromId); toObj = activityHm.get(toId); if (fromObj.type.equals("start")) { tempObj = new ObjectInfo(); tempObj = activityHm.get(toId); tempObj.hasStart = "true"; activityHm.put(toId, tempObj); continue; } if (toObj.type.equals("end")) { tempObj = new ObjectInfo(); tempObj = activityHm.get(fromId); tempObj.hasEnd = "true"; activityHm.put(fromId, tempObj); continue; } if (fromObj.type.equals("activity") && toObj.type.equals("activity")) { jobj = new com.krawler.utils.json.base.JSONObject(); jobj.put("fromId", "flowPanel" + fromId); jobj.put("toId", "flowPanel" + toId); jtemp.append("Lines", jobj); tempObj = new ObjectInfo(); tempObj = activityHm.get(fromId); tempObj.derivationRule = "sequence"; activityHm.put(fromId, tempObj); continue; } if (fromObj.type.equals("activity") && toObj.type.equals("condition")) { fromConditionHm.put(toId, fromId); tempObj = new ObjectInfo(); tempObj = activityHm.get(fromId); tempObj.derivationRule = "evaluation"; activityHm.put(fromId, tempObj); continue; } if (fromObj.type.equals("condition") && toObj.type.equals("activity")) { toConditionHm.put(fromId, toId); continue; } } } } Set keys = activityHm.keySet(); Iterator ite = keys.iterator(); while (ite.hasNext()) { String key = (String) ite.next(); obj = new ObjectInfo(); obj = activityHm.get(key); if (obj.type.equals("activity")) { jobj = new com.krawler.utils.json.base.JSONObject(); jobj.put("Id", "flowPanel" + obj.objId); jobj.put("name", obj.name); jobj.put("xpos", obj.xpos); jobj.put("ypos", obj.ypos); jobj.put("height", obj.height); jobj.put("width", obj.width); jobj.put("parent", obj.parentId); jobj.put("refId", obj.refId); jobj.put("hasStart", obj.hasStart); jobj.put("hasEnd", obj.hasEnd); jobj.put("startRefId", obj.startRefId); jobj.put("endRefId", obj.endRefId); jobj.put("derivationRule", obj.derivationRule); jobj.put("domEl", obj.domEl); jtemp.append("data", jobj); } } keys = fromConditionHm.keySet(); ite = keys.iterator(); Iterator ite1 = null; String key = ""; while (ite.hasNext()) { key = (String) ite.next(); fromId = fromConditionHm.get(key); List toList = (List) toConditionHm.get(key); ite1 = toList.iterator(); while (ite1.hasNext()) { toId = (String) ite1.next(); jobj = new com.krawler.utils.json.base.JSONObject(); jobj.put("fromId", "flowPanel" + fromId); jobj.put("toId", "flowPanel" + toId); jtemp.append("Lines", jobj); } } return jtemp.toString(); } catch (ParserConfigurationException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":false}"; throw ServiceException.FAILURE("workflow.reloadWorkflow", ex); } catch (SAXException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":false}"; throw ServiceException.FAILURE("workflow.reloadWorkflow", ex); } catch (IOException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":false}"; throw ServiceException.FAILURE("workflow.reloadWorkflow", ex); } catch (JSONException ex) { logger.warn(ex.getMessage(), ex); result = "{\"success\":false}"; throw ServiceException.FAILURE("workflow.reloadWorkflow", ex); } }
From source file:it.fub.jardin.server.DbUtils.java
/** * @param fields//from w w w . j av a 2s. co m * @param operation * @param value * @param like * @return Restituisce una stringa compresa tra parentesi che rappresenta la * ricerca del valore <i>value</i> in tutti i campi desiderati * combinati con l'operazione <i>operation</i> */ private String fieldTest(final List<String> fields, final String operation, final String value, final boolean like, String comparer) { String result = ""; if (operation.compareToIgnoreCase("OR") == 0) { result += " AND (0"; } else if (operation.compareToIgnoreCase("AND") == 0) { result += " OR (1"; } else { return ""; } for (String field : fields) { result += this.fieldTest(field, operation, value, like, comparer); } result += ")"; return result; }
From source file:org.openmrs.module.vcttrac.db.hibernate.VCTModuleDAOImpl.java
/** * @throws Exception//from ww w. j a v a 2 s . c om * @see org.openmrs.module.vcttrac.db.VCTModuleDAO#getVCTClientBasedOn(java.lang.String) */ @SuppressWarnings("unchecked") @Override public List<Integer> getVCTClientsBasedOn(String reference, String gender, Integer counselingType, Integer location, String tested, String dateFrom, String dateTo, Integer minAge, Integer maxAge, Integer civilStatus, Integer educationLevel, Integer mainActivity, Integer testOrderer, Integer whyGetTested, Integer testResult, Integer gotResult) throws Exception { List<Integer> clientIds = new ArrayList<Integer>(); List<Integer> tempIds = new ArrayList<Integer>(); String query = ""; whereCreated = false; DateFormat df = MohTracUtil.getMySQLDateFormat(); query = "SELECT c.trac_vct_client_id FROM trac_vct_client c"; // boolean whereCreated = false; //location if (location != null) query += whereOrAnd() + " c.location=" + location; //date from if (dateFrom != null) { query += whereOrAnd() + " c.date_registration>='" + df.format(Context.getDateFormat().parse(dateFrom)) + "'"; } //date to if (dateTo != null) { query += whereOrAnd() + " c.date_registration<='" + df.format(Context.getDateFormat().parse(dateTo)) + "'"; } //from vct or pit if (reference != null) query += whereOrAnd() + " c.vct_or_pit=" + reference; //counseling if (counselingType != null) { if (counselingType < 3) query += whereOrAnd() + " c.type_of_counseling=" + counselingType; else query += whereOrAnd() + " c.type_of_counseling IS NULL"; } //hiv test if (tested != null) { if (tested.compareToIgnoreCase("yes") == 0) query += whereOrAnd() + " c.code_test IS NOT NULL"; else query += whereOrAnd() + " c.code_test IS NULL"; } //ordering query += " ORDER BY c.date_registration DESC"; //log.info(">>>>STATISTICS>>QUERY>> " + query); tempIds = getSession().createSQLQuery(query).list(); clientIds = tempIds; VCTClient c; boolean addToTheList; if (gender != null || minAge != null || maxAge != null || civilStatus != null || educationLevel != null || mainActivity != null || testOrderer != null || whyGetTested != null || testResult != null || gotResult != null) { clientIds = new ArrayList<Integer>(); for (Integer cid : tempIds) { c = (VCTClient) getSession().load(VCTClient.class, cid); addToTheList = true; //gender if (gender != null) { if (c.getClient().getGender().compareToIgnoreCase(gender) != 0) { addToTheList = false; } } //minAge : minAge is included if (minAge != null) { if (c.getClient().getAge() > minAge) { addToTheList = false; } } //maxAge : maxAge is included if (maxAge != null) { if (c.getClient().getAge() < maxAge) { addToTheList = false; } } //civil status if (civilStatus != null) { PersonAttribute pa = new PersonAttribute(); pa = c.getClient().getAttribute(VCTConfigurationUtil.getCivilStatusAttributeTypeId()); if (pa != null) { if (pa.getValue().trim().compareToIgnoreCase("") != 0) { if (civilStatus.toString().compareToIgnoreCase(pa.getValue()) != 0) addToTheList = false; } else addToTheList = false; } else addToTheList = false; } //education level if (educationLevel != null) { PersonAttribute pa1 = c.getClient() .getAttribute(VCTConfigurationUtil.getEducationLevelAttributeTypeId()); if (pa1 != null) { if (pa1.getValue().trim().compareToIgnoreCase("") != 0) { if (educationLevel.toString().compareToIgnoreCase(pa1.getValue()) != 0) addToTheList = false; } else addToTheList = false; } else addToTheList = false; } //main activity if (mainActivity != null) { PersonAttribute pa2 = c.getClient() .getAttribute(VCTConfigurationUtil.getMainActivityAttributeTypeId()); if (pa2 != null) { if (pa2.getValue().trim().compareToIgnoreCase("") != 0) { if (mainActivity.toString().compareToIgnoreCase(pa2.getValue()) != 0) addToTheList = false; } else addToTheList = false; } else addToTheList = false; } //program that ordered test if (testOrderer != null) { Obs o = c.getCounselingObs(); if (o != null) { if (VCTModuleTag .convsetObsValueByConcept(o, VCTConfigurationUtil.getProgramThatOrderedTestConceptId()) .compareToIgnoreCase(Context.getConceptService().getConcept(testOrderer) .getDisplayString()) != 0) addToTheList = false; } else addToTheList = false; } //why get tested for hiv if (whyGetTested != null) { Obs o = c.getCounselingObs(); if (o != null) { if (VCTModuleTag .convsetObsValueByConcept(o, VCTConfigurationUtil.getWhyDidYouGetTestedConceptId()) .compareToIgnoreCase(Context.getConceptService().getConcept(whyGetTested) .getDisplayString()) != 0) addToTheList = false; } else addToTheList = false; } //result of test if (testResult != null) { Obs o = c.getResultObs(); if (o != null) { if (VCTModuleTag.convsetObsValueByConcept(o, VCTTracConstant.RESULT_OF_HIV_TEST) .compareToIgnoreCase( Context.getConceptService().getConcept(testResult).getDisplayString()) != 0) addToTheList = false; } else addToTheList = false; } //got result of test if (gotResult != null) { Obs o = c.getResultObs(); if (o != null) { String dateOfReception = VCTModuleTag.convsetObsValueByConcept(o, VCTConfigurationUtil.getDateResultOfHivTestReceivedConceptId()); if (gotResult.intValue() == 1) { if (dateOfReception.compareToIgnoreCase("-") == 0) addToTheList = false; } else if (gotResult.intValue() == 0) { if (dateOfReception.compareToIgnoreCase("-") != 0) addToTheList = false; } } else addToTheList = false; } if (addToTheList) clientIds.add(c.getTracVctClientId()); } } return clientIds; }
From source file:de.escidoc.core.test.EscidocAbstractTest.java
/** * Asserts if the elements requested by the xPath are sorted correctly. * /*from www . ja v a2 s . co m*/ * @param xml * xml. * @param xpath * xpath-expression * @param prerequisiteXpath * prerequisite xpath-expression * @param isAscending * if sort-order is ascending * @param getIdAttribute * if true: get the id-attribute of the element * @throws Exception * e */ public void assertSorted(final String xml, final String xpath, final String prerequisiteXpath, final boolean isAscending, final boolean getIdAttribute) throws Exception { String replacedXpath = xpath; if (getIdAttribute) { replacedXpath += PART_XLINK_HREF; } NodeList nodes = selectNodeList(EscidocAbstractTest.getDocument(xml), replacedXpath); String lastValue = ""; if (!isAscending) { lastValue = "ZZZZZZZZZZZZZZZZZZZZZ"; } for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (prerequisiteXpath != null) { NodeList prerequisite = XPathAPI.selectNodeList(node, prerequisiteXpath); if (prerequisite == null || prerequisite.getLength() == 0) { continue; } } String nodeValue = node.getNodeValue(); if (nodeValue == null) { fail("nodeValue for xpath " + replacedXpath + " is null"); } nodeValue = getObjidFromHref(nodeValue); if (isAscending) { if (nodeValue.compareToIgnoreCase(lastValue) < 0) { fail(nodeValue + " is not sorted correctly, should be >= " + lastValue); } else if (nodeValue.compareTo(lastValue) > 0) { lastValue = nodeValue; } } else { if (nodeValue.compareToIgnoreCase(lastValue) > 0) { fail(nodeValue + " is not sorted correctly, should be <= " + lastValue); } else if (nodeValue.compareTo(lastValue) < 0) { lastValue = nodeValue; } } } }
From source file:gov.nih.nci.evs.browser.utils.SearchUtils.java
public static CodedNodeSet.PropertyType[] createPropertyTypes(String[] types) { if (types == null || types.length == 0) return null; CodedNodeSet.PropertyType[] propertyTypes = new CodedNodeSet.PropertyType[types.length]; int knt = -1; for (int i = 0; i < types.length; i++) { String type = (String) types[i]; if (type.compareToIgnoreCase("PRESENTATION") == 0) { knt++;//from ww w .j a va 2 s . com propertyTypes[knt] = PropertyType.PRESENTATION; } else if (type.compareToIgnoreCase("DEFINITION") == 0) { knt++; propertyTypes[knt] = PropertyType.DEFINITION; } else if (type.compareToIgnoreCase("GENERIC") == 0) { knt++; propertyTypes[knt] = PropertyType.GENERIC; } else if (type.compareToIgnoreCase("COMMENT") == 0) { knt++; propertyTypes[knt] = PropertyType.COMMENT; } } return propertyTypes; }