List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:com.edgenius.wiki.render.filter.NewlineFilter.java
@Override protected void replaceHTML(HTMLNode node, ListIterator<HTMLNode> nodeIter, RenderContext context) { if (!node.isCloseTag() && StringUtils.equalsIgnoreCase(node.getTagName(), "p")) { StringBuffer leadText = new StringBuffer(); //this is only check if this <p> is at beginning of text, don't need add any new line //such as <p>my start</p>, it is not necessary convert to \n\nmy start node.reset("", true); for (HTMLNode subnode = node.previous(); subnode != null; subnode = subnode.previous()) { if (subnode.isTextNode()) { leadText.append(subnode.getText().trim()); if (leadText.length() > 0) { //append 2 newline node.reset(NEWLINE + NEWLINE, true); break; }/* ww w . j a v a 2 s .co m*/ } } //TextNut: it has format like this: <p class="p2"><br></p>, here will try to remove <br> if (node.getPair() != null) { HTMLNode brnode = null; for (HTMLNode subnode = node.next(); subnode != null; subnode = subnode.next()) { if (subnode == node.getPair()) break; if (subnode.isTextNode()) { //skip blank text if (StringUtils.isBlank(subnode.getText())) { continue; } //non-empty text, don't remove BR then brnode = null; break; } if (!subnode.isTextNode() && StringUtils.equalsIgnoreCase(subnode.getTagName(), "br")) { brnode = null; break; } brnode = subnode; } if (brnode != null) brnode.reset("", true); } } else if (!node.isCloseTag() && StringUtils.equalsIgnoreCase(node.getTagName(), "div")) { if (node.getAttributes() == null || node.getAttributes().size() == 0) { node.reset("", true); } } else if (StringUtils.equalsIgnoreCase(node.getTagName(), "br")) { //append 1 newline node.reset(NEWLINE, true); } else if (StringUtils.equalsIgnoreCase(node.getText(), NEWLINE_HIDDEN_TAG)) { node.reset(NEWLINE, true); //clean spaces between <span aid=""> </span>, these spaces normally are added by TinyMCE. for (HTMLNode subnode = node.next(); subnode != null && subnode != node.getPair(); subnode = subnode.next()) { if (subnode.isTextNode() && StringUtils.isBlank(subnode.getText())) subnode.reset("", true); } } if (node.getPair() != null) { //empty it node.getPair().reset("", true); } }
From source file:com.healthcit.analytics.servlet.CAHopeDataSourceServlet.java
/** * Generates the dataTable.//w ww . j av a 2 s.c o m */ @Override public DataTable generateDataTable(Query query, HttpServletRequest request) throws DataSourceException { log.debug("In CAHopeDataSourceServlet"); // validate the query CAHopeDataSourceUtils.validateQuery(query, request); // determine whether or not the resultSet from CouchDB consists of documents // (if not, then the resultSet consists of a custom set of objects emitted by the CouchDB view) boolean emitsDocuments = StringUtils.equalsIgnoreCase(request.getParameter(Constants.DOCUMENT), "true"); // get a mapping of columns to data types (and other metadata, as needed) List<Map<String, Object>> columnDataArray = CAHopeDataSourceUtils.getColumnData(request); // return the datatable DataTable table = DataTableManager.getDataTable(query, request, columnDataArray, emitsDocuments); return table; }
From source file:com.bluexml.xforms.generator.forms.renderable.classes.RenderableAttribute.java
@Override protected boolean isRequired() { return StringUtils.equalsIgnoreCase(getMetaInfoValue("required"), "true"); }
From source file:com.edgenius.wiki.render.GroupProcessor.java
/** * Try to decide if given macro is child. If yes, adopt it. Otherwise, discard it. * @param macro/*from w ww .j av a2 s.com*/ * @param start */ public void adoptChild(Macro macro, int start, int end) { boolean isChild = false; for (String child : children) { for (String mn : macro.getName()) { if (StringUtils.equalsIgnoreCase(mn, child)) { isChild = true; break; } } } if (!isChild) return; childrenMap.put(start, macro); endMap.put(start, end); }
From source file:com.edgenius.wiki.ext.tabs.TabsMacro.java
@Override protected void replaceHTML(HTMLNode node, ListIterator<HTMLNode> iter, RenderContext context) { HTMLNode pair = node.getPair();//from w w w . j a va2s. c o m if (pair == null) { log.error("Unexpected: no close tabs tag."); return; } resetMacroMarkup(TIDY_STYLE_BLOCK, node, iter, "{tabs}", "{tabs}"); //clean all tags/content between <div name="macroTabName">...</div> HTMLNode subnode = node.next(); HTMLNode namePairNode = null; while (subnode != null) { if (subnode == pair || subnode == namePairNode) break; if (namePairNode != null) { subnode.reset("", true); } else if (subnode.getAttributes() != null) { String name = subnode.getAttributes().get(NameConstants.NAME); if (StringUtils.equalsIgnoreCase("macroTabNames", name)) { subnode.reset("", true); namePairNode = subnode.getPair(); if (namePairNode == null) { log.warn("Invalid macro tab name div - no close div"); break; } namePairNode.reset("", true); } } subnode = subnode.next(); } }
From source file:hydrograph.ui.datastructure.property.Schema.java
/** * This method fetches single row from current schema rows. * // www.java2 s. c om * @param fieldName * @return gridRow */ public GridRow getGridRow(String fieldName) { if (!getGridRow().isEmpty()) { for (GridRow row : getGridRow()) { if (StringUtils.equalsIgnoreCase(fieldName, row.getFieldName())) return row.copy(); } } return null; }
From source file:com.sfs.whichdoctor.isb.publisher.PersonIsbXmlWriter.java
/** * Publish./* w ww .j a v a2s . com*/ * * @param actionVal the action * * @return the string * * @throws IOException Signals that an I/O exception has occurred. */ public final String publish(final String actionVal) throws IOException { // Test to see whether the required data is available if (actionVal == null) { throw new IOException("A valid action must be supplied"); } if (StringUtils.equalsIgnoreCase(actionVal, "create")) { this.action = "create"; } if (StringUtils.equalsIgnoreCase(actionVal, "modify")) { this.action = "modify"; } if (StringUtils.equalsIgnoreCase(actionVal, "delete")) { this.action = "delete"; } if (getExistingPerson() == null) { throw new IOException("A valid existing person entity is required"); } if (StringUtils.equals(getAction(), "modify")) { // Modify requires a valid existing and updated person entity if (getUpdatedPerson() == null) { throw new IOException("A valid updated person entity is required"); } } xmlwriter = new XmlWriter(); xmlwriter.writeEntity("identity"); xmlwriter.writeAttribute("id", String.valueOf(getExistingPerson().getPersonIdentifier())); if (StringUtils.isNotBlank(getAction())) { xmlwriter.writeAttribute("action", getAction()); } writeAttribute("title"); writeAttribute("gender"); writeAttribute("preferredName"); writeAttribute("firstName"); writeAttribute("middleName"); writeAttribute("lastName"); writeAttribute("salutation"); writeAttribute("curriculumType"); writeAttribute("curriculumYear"); if (StringUtils.equalsIgnoreCase(this.getAction(), "create")) { // If this is a create action include a generated password writeAttribute("password"); } writeRoles(); writeObjects("emailAddress"); writeObjects("postalAddress"); writeObjects("phoneNumber"); writeObjects("relationship"); xmlwriter.endEntity(); return xmlwriter.getXml(); }
From source file:com.sfs.whichdoctor.beans.ContactBean.java
/** * Gets the status.//w w w . j a v a 2 s .c o m * * @param personStatus the person status * * @return the status */ public final String getStatus(final String personStatus) { StringBuffer contactStatus = new StringBuffer(); if (this.returnedMail) { if (contactStatus.length() > 0) { contactStatus.append(", "); } contactStatus.append("returned mail"); } if (this.requestNoMail) { if (contactStatus.length() > 0) { contactStatus.append(", "); } contactStatus.append("no mail requested"); } if (StringUtils.equalsIgnoreCase(personStatus, "Deceased")) { if (contactStatus.length() > 0) { contactStatus.append(", "); } contactStatus.append("deceased"); } return capitalise(contactStatus.toString()); }
From source file:eionet.meta.dao.domain.DataElement.java
public boolean isReleased() { return StringUtils.equalsIgnoreCase("Released", status); }
From source file:de.tudarmstadt.ukp.clarin.webanno.api.dao.SecurityUtil.java
/** * Determine if the User is a curator or not * * @param aProject the project.//ww w.ja va2 s . com * @param aProjectRepository the respository service. * @param aUser the user. * @return if the user is a curator. */ public static boolean isCurator(Project aProject, RepositoryService aProjectRepository, User aUser) { boolean roleAdmin = false; List<Authority> authorities = aProjectRepository.listAuthorities(aUser); for (Authority authority : authorities) { if (authority.getAuthority().equals("ROLE_ADMIN")) { roleAdmin = true; break; } } boolean curator = false; if (!roleAdmin) { try { List<ProjectPermission> permissionLevels = aProjectRepository.listProjectPermisionLevel(aUser, aProject); for (ProjectPermission permissionLevel : permissionLevels) { if (StringUtils.equalsIgnoreCase(permissionLevel.getLevel().getName(), PermissionLevel.CURATOR.getName())) { curator = true; break; } } } catch (NoResultException ex) { LOG.info("No permision is given to this user " + ex); } } return (curator || roleAdmin); }