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

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

Introduction

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

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

From source file:com.edgenius.wiki.model.PageTag.java

public boolean equals(Object obj) {
    if (!(obj instanceof PageTag))
        return false;

    return StringUtils.equalsIgnoreCase(((PageTag) obj).name, this.name);
}

From source file:com.weixin.core.util.Struts2Utils.java

/**
 * ?contentTypeheaders./*from  w w w .  j  av  a 2s .  c  om*/
 */
private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) {
    // ?headers?
    String encoding = DEFAULT_ENCODING;
    boolean noCache = DEFAULT_NOCACHE;
    HttpServletResponse response = ServletActionContext.getResponse();
    for (String header : headers) {
        String headerName = StringUtils.substringBefore(header, ":");
        String headerValue = StringUtils.substringAfter(header, ":");

        if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) {
            encoding = headerValue;
        } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) {
            noCache = Boolean.parseBoolean(headerValue);
        } else if (StringUtils.equalsIgnoreCase(headerName, "Cache-Control")
                || StringUtils.equalsIgnoreCase(headerName, "Pragma")) {
            response.setHeader(headerName, headerValue);
            noCache = false;
        } else {
            throw new IllegalArgumentException(headerName + "??header");
        }
    }

    // headers?
    String fullContentType = contentType + ";charset=" + encoding;
    response.setContentType(fullContentType);

    response.setHeader("Pragma:", "public");
    if (noCache) {
        ServletUtils.setDisableCacheHeader(response);
    }

    return response;
}

From source file:com.delmar.core.web.filter.ExportFilter.java

/**
 * {@inheritDoc}/*from   ww w  . ja v  a 2  s.c  o  m*/
 */
public void init(FilterConfig filterConfig) {
    log = LogFactory.getLog(ExportFilter.class);
    String bufferParam = filterConfig.getInitParameter("buffer");
    if (log.isDebugEnabled()) {
        log.debug("bufferParam=" + bufferParam);
    }
    buffer = bufferParam == null || StringUtils.equalsIgnoreCase("true", bufferParam);

    log.info("Filter initialized. Response buffering is " + (buffer ? "enabled" : "disabled"));
    this.endcoding = filterConfig.getInitParameter("endcoding");
}

From source file:com.alibaba.otter.node.etl.extract.extractor.FreedomExtractor.java

public void extract(DbBatch dbBatch) throws ExtractException {
    Assert.notNull(dbBatch);//from  w w w  .j  a v a2s .com

    // ??
    Pipeline pipeline = getPipeline(dbBatch.getRowBatch().getIdentity().getPipelineId());

    boolean skipFreedom = pipeline.getParameters().getSkipFreedom();
    String bufferSchema = pipeline.getParameters().getSystemSchema();
    String bufferTable = pipeline.getParameters().getSystemBufferTable();

    List<EventData> eventDatas = dbBatch.getRowBatch().getDatas();
    Set<EventData> removeDatas = new HashSet<EventData>();// set???remove
    for (EventData eventData : eventDatas) {
        if (StringUtils.equalsIgnoreCase(bufferSchema, eventData.getSchemaName())
                && StringUtils.equalsIgnoreCase(bufferTable, eventData.getTableName())) {
            if (eventData.getEventType().isDdl()) {
                continue;
            }

            if (skipFreedom) {// ??
                removeDatas.add(eventData);
                continue;
            }

            // ??insert / update
            if (eventData.getEventType().isInsert() || eventData.getEventType().isUpdate()) {
                // ?EventData??
                EventColumn tableIdColumn = getMatchColumn(eventData.getColumns(), TABLE_ID);
                // ?tableIdmedia?
                try {
                    DataMedia dataMedia = null;
                    Long tableId = Long.valueOf(tableIdColumn.getColumnValue());
                    eventData.setTableId(tableId);
                    if (tableId <= 0) { // full_name
                        // ??schema+table name
                        EventColumn fullNameColumn = getMatchColumn(eventData.getColumns(), FULL_NAME);
                        if (fullNameColumn != null) {
                            String[] names = StringUtils.split(fullNameColumn.getColumnValue(), ".");
                            if (names.length >= 2) {
                                dataMedia = ConfigHelper.findSourceDataMedia(pipeline, names[0], names[1]);
                                eventData.setTableId(dataMedia.getId());
                            } else {
                                throw new ConfigException("no such DataMedia " + names);
                            }
                        }
                    } else {
                        // tableId?tableId???
                        dataMedia = ConfigHelper.findDataMedia(pipeline,
                                Long.valueOf(tableIdColumn.getColumnValue()));
                    }

                    DbDialect dbDialect = dbDialectFactory.getDbDialect(pipeline.getId(),
                            (DbMediaSource) dataMedia.getSource());
                    // offer[1-128]??
                    if (!dataMedia.getNameMode().getMode().isSingle()
                            || !dataMedia.getNamespaceMode().getMode().isSingle()) {
                        boolean hasError = true;
                        EventColumn fullNameColumn = getMatchColumn(eventData.getColumns(), FULL_NAME);
                        if (fullNameColumn != null) {
                            String[] names = StringUtils.split(fullNameColumn.getColumnValue(), ".");
                            if (names.length >= 2) {
                                eventData.setSchemaName(names[0]);
                                eventData.setTableName(names[1]);
                                hasError = false;
                            }
                        }

                        if (hasError) {
                            // ?
                            logger.warn("dataMedia mode:{} , fullname:{} ", dataMedia.getMode(),
                                    fullNameColumn == null ? null : fullNameColumn.getColumnValue());
                            removeDatas.add(eventData);
                            // ?
                            continue;
                        }
                    } else {
                        eventData.setSchemaName(dataMedia.getNamespace());
                        eventData.setTableName(dataMedia.getName());
                    }

                    // 
                    EventColumn typeColumn = getMatchColumn(eventData.getColumns(), TYPE);
                    EventType eventType = EventType.valuesOf(typeColumn.getColumnValue());
                    eventData.setEventType(eventType);
                    if (eventType.isUpdate()) {// updateinsert?merge
                                               // sql
                        eventData.setEventType(EventType.INSERT);
                    } else if (eventType.isDdl()) {
                        dbDialect.reloadTable(eventData.getSchemaName(), eventData.getTableName());
                        removeDatas.add(eventData);// ?
                        continue;
                    }
                    // ?
                    EventColumn pkDataColumn = getMatchColumn(eventData.getColumns(), PK_DATA);
                    String pkData = pkDataColumn.getColumnValue();
                    String[] pks = StringUtils.split(pkData, PK_SPLIT);

                    Table table = dbDialect.findTable(eventData.getSchemaName(), eventData.getTableName());
                    List<EventColumn> newColumns = new ArrayList<EventColumn>();
                    Column[] primaryKeyColumns = table.getPrimaryKeyColumns();
                    if (primaryKeyColumns.length > pks.length) {
                        throw new ExtractException(
                                "data pk column size not match , data:" + eventData.toString());
                    }
                    // 
                    Column[] allColumns = table.getColumns();
                    int pkIndex = 0;
                    for (int i = 0; i < allColumns.length; i++) {
                        Column column = allColumns[i];
                        if (column.isPrimaryKey()) {
                            EventColumn newColumn = new EventColumn();
                            newColumn.setIndex(i); // 
                            newColumn.setColumnName(column.getName());
                            newColumn.setColumnType(column.getTypeCode());
                            newColumn.setColumnValue(pks[pkIndex]);
                            newColumn.setKey(true);
                            newColumn.setNull(pks[pkIndex] == null);
                            newColumn.setUpdate(true);
                            // 
                            newColumns.add(newColumn);
                            pkIndex++;
                        }
                    }
                    // ?
                    eventData.setKeys(newColumns);
                    eventData.setOldKeys(new ArrayList<EventColumn>());
                    eventData.setColumns(new ArrayList<EventColumn>());
                    // +??
                    eventData.setSyncMode(SyncMode.ROW);
                    eventData.setSyncConsistency(SyncConsistency.MEDIA);
                    eventData.setRemedy(true);
                    eventData.setSize(1024);// 1kbbinlog???rpc?
                } catch (ConfigException e) {
                    // ?????
                    logger.info("find DataMedia error " + eventData.toString(), e);
                    removeDatas.add(eventData);
                    continue;
                } catch (Throwable e) {
                    // 
                    logger.warn("process freedom data error " + eventData.toString(), e);
                    removeDatas.add(eventData);
                    continue;
                }
            } else {
                removeDatas.add(eventData);// 
            }
        }
    }

    if (!CollectionUtils.isEmpty(removeDatas)) {
        eventDatas.removeAll(removeDatas);
    }
}

From source file:es.pode.empaquetador.presentacion.previsualizar.PrevisualizarControllerImpl.java

/**
 * @see es.pode.empaquetador.presentacion.previsualizar.PrevisualizarController#previsualizar(org.apache.struts.action.ActionMapping,
 *      es.pode.empaquetador.presentacion.previsualizar.PrevisualizarForm,
 *      javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//*from   w  ww.j  av  a 2  s . co  m*/
public final void previsualizar(ActionMapping mapping,
        es.pode.empaquetador.presentacion.previsualizar.PrevisualizarForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    String tipoVisualizador = form.getTipoVisualizador();
    String action = form.getAction();
    if (logger.isDebugEnabled())
        logger.debug("tipoVisualizador = " + tipoVisualizador + " ; action = " + action);

    OdeVO ode = this.getEmpaquetadorSession(request).getOde();
    String id = this.getSrvGestorManifestService()
            .previsualizarOde(getEmpaquetadorSession(request).getIdLocalizador());
    //String id = this.getSrvEmpaquetadorBasicoService().previsualizarOde(ode);
    String url = request.getSession().getServletContext().getInitParameter("url_visualizador");
    String llamada = null;
    if (tipoVisualizador == null) {// No ha pasado por la pantalla de seleccin de visualizador por no tener secuencia
        llamada = url + "?identificador=" + id + "&usuario=" + ode.getUsuario()
                + "&secuencia=false&comunidadAgrega=false"; // Llamo al previsualizador sin secuencia
    } else if (StringUtils.equalsIgnoreCase("adl", tipoVisualizador)) {//ADL
        url = request.getSession().getServletContext().getInitParameter("url_visualizador_adl");
        llamada = url + "?identificador=" + getEmpaquetadorSession(request).getIdLocalizador();
    } else {//Agrega
        llamada = url + "?identificador=" + id + "&usuario=" + ode.getUsuario()
                + "&secuencia=true&comunidadAgrega=false";
    }

    // URLs tipo host/agrega
    llamada = "http://" + LdapUserDetailsUtils.getHost() + LdapUserDetailsUtils.getSubdominio() + "/" + llamada;
    //20081106 dgonzalezd: Aado parmetro comunidadAgrega=false
    logger.info("Llamando a previsualizador con URL = " + llamada);
    response.sendRedirect(llamada);
}

From source file:de.hybris.platform.acceleratorfacades.urlencoder.impl.DefaultUrlEncoderFacade.java

@Deprecated
@Override/*from  w ww .  j  ava  2 s. c o  m*/
public UrlEncoderPatternData patternForUrlEncoding(final String uri, final String contextPath,
        final boolean newSession) {
    final List<UrlEncoderData> urlEncodingAttributes = variablesForUrlEncoding();
    final UrlEncoderPatternData patternData = new UrlEncoderPatternData();
    final String[] splitUrl = StringUtils.split(uri, "/");
    int splitUrlCounter = (ArrayUtils.isNotEmpty(splitUrl)
            && (StringUtils.remove(contextPath, "/").equals(splitUrl[0]))) ? 1 : 0;
    for (final UrlEncoderData urlEncoderData : urlEncodingAttributes) {
        boolean applicationDriven = false;
        if ((splitUrlCounter) < splitUrl.length) {
            String tempValue = splitUrl[splitUrlCounter];
            if (!isValid(urlEncoderData.getAttributeName(), tempValue)) {
                tempValue = urlEncoderData.getDefaultValue();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Encoding attributes are absent. Injecting default value :  [" + tempValue + "]");
                }
            }
            final UrlEncodingAttributeManager attributeManager = getUrlEncoderService()
                    .getUrlEncodingAttrManagerMap().get(urlEncoderData.getAttributeName());
            //Check if its driven by user and if so redirect
            if (!newSession && !StringUtils.equalsIgnoreCase(urlEncoderData.getCurrentValue(),
                    attributeManager.getCurrentValue())) {
                urlEncoderData.setCurrentValue(attributeManager.getCurrentValue());
                patternData.setRedirectRequired(true);
                applicationDriven = true;
            }
            if (!applicationDriven) {
                urlEncoderData.setCurrentValue(tempValue);
            }
            splitUrlCounter++;
        } else {
            break;
        }
    }
    patternData.setPattern(extractEncodingPattern(urlEncodingAttributes));

    return patternData;
}

From source file:hydrograph.ui.graph.action.debug.ViewDataCurrentJobAction.java

@Override
protected boolean calculateEnabled() {
    Map<String, SubjobDetails> componentNameAndLink = new HashMap();
    int count = 0;
    boolean isWatcher = false;
    List<Object> selectedObject = getSelectedObjects();
    for (Object obj : selectedObject) {
        if (obj instanceof LinkEditPart) {
            Link link = (Link) ((LinkEditPart) obj).getModel();
            String componentId = link.getSource().getComponentId();
            Component component = link.getSource();
            if (StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.SUBJOB_COMPONENT)) {
                String componenet_Id = "";
                String socket_Id = "";
                ViewDataUtils.getInstance().subjobParams(componentNameAndLink, component, new StringBuilder(),
                        link.getSourceTerminal());
                for (Entry<String, SubjobDetails> entry : componentNameAndLink.entrySet()) {
                    String comp_soc = entry.getKey();
                    String[] split = StringUtils.split(comp_soc, "/.");
                    componenet_Id = split[0];
                    for (int i = 1; i < split.length - 1; i++) {
                        componenet_Id = componenet_Id + "." + split[i];
                    }/*from w ww  . j  a  va  2 s . co  m*/
                    socket_Id = split[split.length - 1];
                }

                watchRecordInner.setComponentId(componenet_Id);
                watchRecordInner.setSocketId(socket_Id);
            } else {
                watchRecordInner.setComponentId(componentId);
                String socketId = link.getSourceTerminal();
                watchRecordInner.setSocketId(socketId);
            }
            ViewDataUtils dataUtils = ViewDataUtils.getInstance();
            isWatcher = dataUtils.checkWatcher(link.getSource(), link.getSourceTerminal());
        }
    }

    if (!selectedObject.isEmpty() && isWatcher) {
        for (Object obj : selectedObject) {
            if (obj instanceof LinkEditPart) {
                count++;
            }
        }
    }

    if (count == 1) {
        return true;
    } else {
        return false;
    }
}

From source file:info.magnolia.cms.security.MgnlUser.java

/**
 * checks is any object exist with the given name under this node
 * @param name//from  w w w.ja  v a  2  s  . c o m
 * @param nodeName
 */
private boolean hasAny(String name, String nodeName) {
    try {
        HierarchyManager hm;
        if (StringUtils.equalsIgnoreCase(nodeName, NODE_ROLES))
            hm = MgnlContext.getHierarchyManager(ContentRepository.USER_ROLES);
        else
            hm = MgnlContext.getHierarchyManager(ContentRepository.USER_GROUPS);

        Content node = userNode.getContent(nodeName);
        for (Iterator iter = node.getNodeDataCollection().iterator(); iter.hasNext();) {
            NodeData nodeData = (NodeData) iter.next();
            // check for the existence of this ID
            try {
                if (hm.getContentByUUID(nodeData.getString()).getName().equalsIgnoreCase(name)) {
                    return true;
                }
            } catch (ItemNotFoundException e) {
                if (log.isDebugEnabled())
                    log.debug("Role [ " + name + " ] does not exist in the ROLES repository");
            } catch (IllegalArgumentException e) {
                if (log.isDebugEnabled())
                    log.debug(nodeData.getHandle() + " has invalid value");
            }
        }
    } catch (RepositoryException e) {
        log.debug(e.getMessage(), e);
    }
    return false;
}

From source file:com.microsoft.alm.common.utils.UrlHelper.java

public static String getHttpsUrlFromHttpUrl(final String httpUrl) {
    final URI uri = createUri(httpUrl);
    String httpsUrl = httpUrl;//from w w w .  jav  a 2 s.  c o m
    if (uri != null && StringUtils.equalsIgnoreCase(uri.getScheme(), "http")) {
        final URI httpsUri = createUri("https://" + uri.getAuthority() + uri.getPath());
        httpsUrl = httpsUri.toString();
    }

    if (StringUtils.startsWithIgnoreCase(httpsUrl, "https://")) {
        return httpsUrl;
    } else {
        return null;
    }
}

From source file:hydrograph.ui.common.util.TransformMappingFeatureUtility.java

public void highlightInputAndOutputFields(Text text, TableViewer inputFieldTableViewer,
        TableViewer outputFieldViewer, TransformMapping transformMapping,
        List<FilterProperties> finalSortedList) {
    Table inputtable = inputFieldTableViewer.getTable();
    Table outputTable = outputFieldViewer.getTable();

    if (text != null) {
        MappingSheetRow mappingSheetRow = null;
        setForegroundColorToBlack(inputtable, outputTable);
        for (MappingSheetRow mappingSheetRowIterate : transformMapping.getMappingSheetRows()) {
            if (StringUtils.equals(text.getText(), mappingSheetRowIterate.getOperationID())) {
                mappingSheetRow = mappingSheetRowIterate;
                break;
            }// w  ww  . j  a v a 2  s  . c  om
        }
        if (mappingSheetRow != null) {
            for (FilterProperties filterProperties : mappingSheetRow.getInputFields()) {
                for (TableItem tableItem : inputtable.getItems()) {

                    if (StringUtils.equalsIgnoreCase(tableItem.getText(), filterProperties.getPropertyname())) {
                        tableItem.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry(0, 128, 255));
                        break;
                    }
                }
            }
        }
        List<FilterProperties> templist = getObjectReferencePresentInOutputTable(finalSortedList,
                mappingSheetRow);
        for (FilterProperties filterProperties : mappingSheetRow.getOutputList()) {
            for (TableItem tableItem : outputTable.getItems()) {

                if (StringUtils.equalsIgnoreCase(tableItem.getText(), filterProperties.getPropertyname())
                        && templist.contains(filterProperties)) {
                    tableItem.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry(0, 128, 255));
                    break;
                }
            }
        }

    } else {
        setForegroundColorToBlack(inputtable, outputTable);
    }
}