Example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang3 StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.mnxfst.stream.pipeline.PipelineElement.java

/**
 * Register possible message destinations
 * @param msg//w w  w. j  a v  a  2  s  .  c  o m
 */
protected void registerMessageDestinations(final PipelineElementReferenceUpdateMessage msg) {

    if (msg != null && msg.getElementReferences() != null && !msg.getElementReferences().isEmpty()) {
        for (String elementId : msg.getElementReferences().keySet()) {

            // avoid self-references
            if (!StringUtils.equalsIgnoreCase(elementId, pipelineElementConfiguration.getElementId())) {
                ActorRef elementRef = msg.getElementReferences().get(elementId);
                if (elementRef != null) {
                    this.messageDestinations.put(elementId, elementRef);
                    context().system().log()
                            .info("Element '" + elementId + "' registered as destination for '"
                                    + pipelineElementConfiguration.getPipelineId() + "#"
                                    + pipelineElementConfiguration.getElementId() + "'");
                }
            }
        }
    }
}

From source file:com.quinsoft.zeidon.standardoe.DefaultJavaOeConfiguration.java

/**
 * Return a ZeidonPreferencesFactory, create one if necessary.  If preferencesFilename is specified
 * then use the extension of the filename to determine what kind of factory to create.  If none is
 * specified then "zeidon.ini" is assumed.
 *///from   w w w.  ja va2s .  c om
@Override
public ZeidonPreferencesFactory getPreferencesFactory() {
    if (zeidonPreferencesFactory == null) {
        if (StringUtils.isBlank(preferencesFilename)) {
            ZeidonIniPreferences iniPref = new ZeidonIniPreferences(getHomeDirectory(), getJmxAppName());
            zeidonPreferencesFactory = new DefaultPreferencesFactory(iniPref, getJmxAppName());
        } else {
            ZeidonPreferences prefs;
            String extension = FilenameUtils.getExtension(preferencesFilename);
            if (StringUtils.equalsIgnoreCase(extension, "ini"))
                prefs = new ZeidonIniPreferences(preferencesFilename, getJmxAppName());
            else if (StringUtils.equalsIgnoreCase(extension, "properties"))
                prefs = new ZeidonPropertyPreferences(preferencesFilename, getJmxAppName());
            else
                throw new ZeidonException("Unknown ZeidonPreferences extension for %s", preferencesFilename);

            zeidonPreferencesFactory = new DefaultPreferencesFactory(prefs, getJmxAppName());
        }
    }

    return zeidonPreferencesFactory;
}

From source file:com.glaf.core.service.impl.MxDataModelServiceImpl.java

@Transactional
public void deleteAllById(String tableName, Collection<Long> rowIds) {
    List<ColumnDefinition> cols = tableDefinitionService.getColumnDefinitionsByTableName(tableName);
    if (cols != null && !cols.isEmpty()) {
        for (ColumnDefinition col : cols) {
            if (StringUtils.equalsIgnoreCase(col.getColumnName(), "ID_")) {
                TableModel tableModel = new TableModel();
                tableModel.setTableName(tableName);
                ColumnModel cm = new ColumnModel();
                cm.setColumnName("ID_");
                cm.setJavaType(col.getJavaType());
                cm.setCollectionValues(rowIds);
                tableModel.addColumn(cm);
                tableDataService.deleteTableData(tableModel);
                break;
            }/*from www. j  a v a2 s  . co  m*/
        }
    }
}

From source file:com.glaf.mail.domain.MailAccount.java

public boolean rememberPassword() {
    if (StringUtils.equalsIgnoreCase(rememberPassword, "1")
            || StringUtils.equalsIgnoreCase(rememberPassword, "Y")
            || StringUtils.equalsIgnoreCase(rememberPassword, "true")) {
        return true;
    }//from w w w.  j  ava  2 s  .  com
    return false;
}

From source file:io.wcm.handler.mediasource.dam.impl.DefaultRenditionHandler.java

/**
 * Get all renditions that match the requested list of file extension.
 * @param fileExtensions List of file extensions
 * @return Matching renditions//from ww w .  j  a  va2 s  . c om
 */
private Set<RenditionMetadata> getRendtionsMatchingFileExtensions(String[] fileExtensions) {

    // if no file extension restriction get all renditions
    Set<RenditionMetadata> allRenditions = getAvailableRenditions();
    if (fileExtensions == null || fileExtensions.length == 0) {
        return allRenditions;
    }

    // otherwise return those with matching extensions
    Set<RenditionMetadata> matchingRenditions = new TreeSet<RenditionMetadata>();
    for (RenditionMetadata rendition : allRenditions) {
        for (String fileExtension : fileExtensions) {
            if (StringUtils.equalsIgnoreCase(fileExtension, rendition.getFileExtension())) {
                matchingRenditions.add(rendition);
                break;
            }
        }
    }
    return matchingRenditions;
}

From source file:com.ottogroup.bi.spqr.operator.json.aggregator.JsonContentAggregator.java

/**
 * @see com.ottogroup.bi.spqr.pipeline.component.MicroPipelineComponent#initialize(java.util.Properties)
 *///ww  w  . jav a 2s  .com
public void initialize(Properties properties)
        throws RequiredInputMissingException, ComponentInitializationFailedException {

    /////////////////////////////////////////////////////////////////////////////////////
    // assign and validate properties
    if (StringUtils.isBlank(this.id))
        throw new RequiredInputMissingException("Missing required component identifier");

    this.pipelineId = StringUtils.trim(properties.getProperty(CFG_PIPELINE_ID));
    this.documentType = StringUtils.trim(properties.getProperty(CFG_DOCUMENT_TYPE));
    if (StringUtils.equalsIgnoreCase(properties.getProperty(CFG_FORWARD_RAW_DATA), "false"))
        this.storeForwardRawData = false;

    for (int i = 1; i < Integer.MAX_VALUE; i++) {
        String name = properties.getProperty(CFG_FIELD_PREFIX + i + ".name");
        if (StringUtils.isBlank(name))
            break;

        String path = properties.getProperty(CFG_FIELD_PREFIX + i + ".path");
        String valueType = properties.getProperty(CFG_FIELD_PREFIX + i + ".type");

        this.fields.add(new JsonContentAggregatorFieldSetting(name, path.split("\\."),
                StringUtils.equalsIgnoreCase("STRING", valueType) ? JsonContentType.STRING
                        : JsonContentType.NUMERICAL));
    }
    /////////////////////////////////////////////////////////////////////////////////////

    if (logger.isDebugEnabled())
        logger.debug("json content aggregator [id=" + id + "] initialized");

}

From source file:de.micromata.genome.util.runtime.LocalSettings.java

/**
 * Gets the boolean value.//from  w  w  w. j a  v a 2  s . c o m
 * 
 * @param key the key
 * @param defaultValue the default value
 * @return the boolean value
 */
@Override
public boolean getBooleanValue(String key, boolean defaultValue) {
    if (containsKey(key) == false) {
        return defaultValue;
    }
    String v = get(key);
    return StringUtils.equalsIgnoreCase(v, "true");
}

From source file:com.github.dziga.orest.client.HttpRestClient.java

void addHeader(String headerName, String headerValue) {
    Header foundHeader = null;/*w  ww .ja v a 2  s .c o m*/
    for (Header header : headers) {
        if (StringUtils.equalsIgnoreCase(header.getName(), headerName)) {
            foundHeader = header;
            break;
        }
    }
    if (foundHeader != null) {
        headers.remove(foundHeader);
    }
    headers.add(new BasicHeader(headerName, headerValue));
}

From source file:com.sonicle.webtop.core.app.servlet.DocEditor.java

protected void processRequestAsAdmin(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    DomainURIPath path = new DomainURIPath(URIUtils.removeTrailingSeparator(request.getPathInfo()));
    WebTopApp wta = WebTopApp.get(request);
    DocEditorManager docEdMgr = wta.getDocEditorManager();

    String domainId = WT.findDomainIdByPublicName(path.getDomainPublicName());
    if (domainId == null)
        throw new WTServletException("Invalid domain public name [{0}]", path.getDomainPublicName());
    if (!wta.getDocumentServerEnabled(domainId))
        throw new WTServletException("DocumentServer not enabled for domain [{}]", domainId);

    String remainingPath = path.getRemainingPath();
    if (StringUtils.equalsIgnoreCase(remainingPath, DOWNLOAD_PATH)) {
        String editingId = ServletUtils.getStringParameter(request, EDITING_ID_PARAM, true);

        BaseDocEditorDocumentHandler docHandler = docEdMgr.getDocumentHandler(editingId);
        if (docHandler == null)
            throw new WTServletException("Missing DocumentHandler [{}]", editingId);

        ServletUtils.setContentTypeHeader(response, "application/octet-stream");
        IOUtils.copy(docHandler.readDocument(), response.getOutputStream());

    } else if (StringUtils.equalsIgnoreCase(remainingPath, TRACK_PATH)) {
        String editingId = ServletUtils.getStringParameter(request, EDITING_ID_PARAM, true);
        Payload<MapItem, DocEditorCallbackPayload> payload = ServletUtils.getPayload(request,
                DocEditorCallbackPayload.class);

        if (payload.data.status == 1) {
            logger.debug("Document is being edited [{}, {}]", editingId, payload.data.key);

            ServletUtils.writeJsonResponse(response, new DocEditorCallbackResponse(0));

        } else if ((payload.data.status == 2) || (payload.data.status == 6)) {
            BaseDocEditorDocumentHandler docHandler = docEdMgr.getDocumentHandler(editingId);
            if (docHandler == null)
                throw new WTServletException("Missing DocumentHandler [{}]", editingId);

            if (payload.data.status == 2) {
                logger.debug("Document is ready for saving [{}, {}]", editingId, payload.data.key);
            } else if (payload.data.status == 6) {
                logger.debug("Document is being edited, but the current document state is saved [{}, {}]",
                        editingId, payload.data.key);
            }/*from  w ww  .  j a  v a  2 s  . c om*/
            if (!docHandler.isWriteSupported())
                throw new WTServletException("Write is not supported here [{}]", editingId);

            URI url = URIUtils.createURIQuietly(payload.data.url);
            if (url == null)
                throw new WTServletException("Invalid URL [{}]", payload.data.url);

            /*
            if (true) {
               long lastModified = docHandler.getLastModifiedTime();
               if (lastModified != -1) {
                  String key = docEdMgr.buildDocumentKey(docHandler.getDocumentUniqueId(), lastModified);
                  if (!StringUtils.equals(payload.data.key, key)) {
             throw new WTServletException("Original file was modified outside this session [{}]", editingId);
                  }
               }
            }
            */

            InputStream is = null;
            try {
                HttpClient httpCli = HttpClientUtils
                        .createBasicHttpClient(HttpClientUtils.configureSSLAcceptAll(), url);
                is = HttpClientUtils.getContent(httpCli, url);
                docHandler.writeDocument(is);
            } catch (IOException ex) {
                throw new WTServletException("Unable to save edited content [{}]", editingId, ex);
            } finally {
                IOUtils.closeQuietly(is);
            }

            //UserProfileId profileId = new UserProfileId(payload.data.users.get(0));
            if (payload.data.status == 2) {
                docEdMgr.unregisterDocumentHandler(editingId);
            }
            ServletUtils.writeJsonResponse(response, new DocEditorCallbackResponse(0));

        } else if ((payload.data.status == 3) || (payload.data.status == 7)) {
            if (payload.data.status == 3) {
                logger.error("Document saving error has occurred [{}, {}]", editingId, payload.data.key);
                logger.error("Changes URL: {}", payload.data.changesurl);

            } else if (payload.data.status == 7) {
                logger.error("Error has occurred while force saving the document [{}, {}]", editingId,
                        payload.data.key);
            }
            docEdMgr.unregisterDocumentHandler(editingId);
            ServletUtils.writeJsonResponse(response, new DocEditorCallbackResponse(0));

        } else if (payload.data.status == 4) {
            logger.debug("Document is closed with no changes [{}, {}]", editingId, payload.data.key);
            docEdMgr.unregisterDocumentHandler(editingId);
            ServletUtils.writeJsonResponse(response, new DocEditorCallbackResponse(0));
        }
    }
}

From source file:com.glaf.mail.domain.MailTask.java

public boolean isHtml() {
    if (StringUtils.equalsIgnoreCase(isHtml, "1") || StringUtils.equalsIgnoreCase(isHtml, "Y")
            || StringUtils.equalsIgnoreCase(isHtml, "true")) {
        return true;
    }/*  w  ww.jav a 2s .c om*/
    return false;
}