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

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

Introduction

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

Prototype

public static boolean equals(final CharSequence cs1, final CharSequence cs2) 

Source Link

Document

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

null s are handled without exceptions.

Usage

From source file:de.micromata.genome.db.jpa.tabattr.impl.AttrSchemaServiceBaseImpl.java

@Override
public <R> R getDefaultValue(final String schemaName, final String propertyName, final Class<R> expectedClass) {
    final AttrSchema schema = getAttrSchema(schemaName);
    if (schema == null) {
        // TODO RK warn
        return null;
    }/*from   www  . j  a v  a 2 s . c o m*/
    for (final AttrGroup group : schema.getGroups()) {
        for (final AttrDescription desc : group.getDescriptions()) {
            if (StringUtils.equals(desc.getPropertyName(), propertyName) == true) {
                return getDefaultValue(desc, expectedClass);
            }
        }
    }
    // TODO RK warn
    return null;
}

From source file:io.wcm.testing.mock.jcr.AbstractItem.java

@Override
public int getDepth() throws RepositoryException {
    if (StringUtils.equals("/", this.path)) {
        return 0;
    } else {//from  w w w . jav a 2  s  .com
        return StringUtils.countMatches(this.path, "/");
    }
}

From source file:com.inkubator.hrm.web.lazymodel.CompetencyUnitLazyDataModel.java

@Override
public AppraisalCompetencyUnit getRowData(String id) {
    for (AppraisalCompetencyUnit appraisalCompetencyUnit : list) {
        if (StringUtils.equals(id, String.valueOf(appraisalCompetencyUnit.getId()))) {
            return appraisalCompetencyUnit;
        }/*from  w  ww .  ja  v  a  2s. co  m*/
    }
    return null;
}

From source file:com.glaf.core.jdbc.datasource.MultiRoutingDataSource.java

private static void reloadDS() {
    if (!loading.get()) {
        try {//from   w w w  . j  a va  2 s .  c o m
            loading.set(true);
            logger.info("--------------MultiRoutingDataSource reloadDS()------------");
            Map<Object, Object> dataSourceMap = new java.util.HashMap<Object, Object>();
            Map<String, Properties> dataSourceProperties = DBConfiguration.getDataSourceProperties();
            Set<Entry<String, Properties>> entrySet = dataSourceProperties.entrySet();
            for (Entry<String, Properties> entry : entrySet) {
                String name = entry.getKey();
                Properties props = entry.getValue();
                if (props != null && StringUtils.isNotEmpty(name)) {
                    try {
                        ConnectionProvider provider = ConnectionProviderFactory.createProvider(name);
                        if (provider != null) {
                            dataSourceMap.put(name, provider.getDataSource());
                            if (StringUtils.equals(name, Environment.DEFAULT_SYSTEM_NAME)) {
                                defaultTargetDataSource = provider.getDataSource();
                            }
                        }
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        logger.error(ex);
                    }
                }
            }

            if (defaultTargetDataSource == null) {
                Properties props = DBConfiguration.getProperties(Environment.DEFAULT_SYSTEM_NAME);
                if (props != null) {
                    ConnectionProvider provider = ConnectionProviderFactory
                            .createProvider(Environment.DEFAULT_SYSTEM_NAME, props);
                    dataSourceMap.put(Environment.DEFAULT_SYSTEM_NAME, provider.getDataSource());
                }
            }

            targetDataSources.putAll(dataSourceMap);

            logger.info("##datasources:" + targetDataSources.keySet());

        } catch (Exception ex) {
            logger.error(ex);
            ex.printStackTrace();
            throw new RuntimeException(ex);
        } finally {
            loading.set(false);
        }
    }
}

From source file:com.hybris.mobile.activity.AccountListActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.account_list);
    setTitle(R.string.account_page_title);

    mLinks = new ArrayList<String>();
    mAdapter = new ArrayAdapter<String>(this, R.layout.row_singleline_with_icon, R.id.textViewSingleLine,
            mLinks);//from w  w  w.j  a v  a  2 s  .c o  m
    setListAdapter(mAdapter);

    getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> a, View v, int position, long l) {
            Intent intent = null;
            if (StringUtils.equals(mLinks.get(position), mLogin)) {
                intent = new Intent(AccountListActivity.this, LoginActivity.class);
                startActivity(intent);
            } else if (StringUtils.equals(mLinks.get(position), mLogout)) {
                logoutUser();
            } else if (StringUtils.equals(mLinks.get(position), mOrderHistory)) {
                intent = new Intent(AccountListActivity.this, OrderListActivity.class);
                startActivity(intent);
            } else if (StringUtils.equals(mLinks.get(position), mAddressBook)) {
                intent = new Intent(AccountListActivity.this, AddressListActivity.class);
                startActivity(intent);
            } else if (StringUtils.equals(mLinks.get(position), mChangePassword)) {
                intent = new Intent(AccountListActivity.this, ChangePasswordActivity.class);
                startActivity(intent);
            } else if (StringUtils.equals(mLinks.get(position), mUpdateProfile)) {
                intent = new Intent(AccountListActivity.this, ProfileDetailActivity.class);
                // TODO
                intent.putExtra("value", JsonUtils.toJson(mProfileDetail));
                startActivity(intent);
            } else if (StringUtils.equals(mLinks.get(position), mPaymentDetails)) {
                intent = new Intent(AccountListActivity.this, PaymentListActivity.class);
                startActivity(intent);
            } else {
                return;
            }
        }
    });

    LinearLayout layoutSwipe = (LinearLayout) findViewById(R.id.layoutSwipe);
    layoutSwipe.setOnTouchListener(new SwipeDetector(new SwipeDetector.OnSwipeListener() {

        @Override
        public void onTopToBottomSwipe() {
            // TODO Auto-generated method stub

        }

        @Override
        public void onRightToLeftSwipe() {
            // TODO Auto-generated method stub

        }

        @Override
        public void onLeftToRightSwipe() {
            Intent intent = new Intent(AccountListActivity.this, SettingsActivity.class);
            startActivity(intent);
        }

        @Override
        public void onBottomToTopSwipe() {
            // TODO Auto-generated method stub

        }
    }));
}

From source file:com.inkubator.hrm.web.lazymodel.CompetencyGroupLazyDataModel.java

@Override
public AppraisalCompetencyGroup getRowData(String id) {
    for (AppraisalCompetencyGroup appraisalCompetencyGroup : list) {
        if (StringUtils.equals(id, String.valueOf(appraisalCompetencyGroup.getId()))) {
            return appraisalCompetencyGroup;
        }/* w  ww  .j a  v a 2s .  c  o  m*/
    }
    return null;
}

From source file:architecture.ee.web.community.struts2.action.SocialConnectAction.java

public String execute() throws Exception {
    HttpSession session = request.getSession(true);
    if (StringUtils.isNotEmpty(domainName)) {
        String domainNameInSession = (String) session.getAttribute(DOMAIN_NAME_KEY);
        log.debug("domainName: " + domainName);
        log.debug("domainNameInSession: " + domainNameInSession);
        log.debug(StringUtils.equals(domainName, domainNameInSession));
        if (!StringUtils.equals(domainName, domainNameInSession)) {
            session.setAttribute(DOMAIN_NAME_KEY, domainName);
        }/*from   w ww. ja  va 2  s.  co m*/
    }
    Enumeration names = session.getAttributeNames();
    while (names.hasMoreElements()) {
        String key = (String) names.nextElement();
        Object value = session.getAttribute(key);
        log.debug(key + "=" + value);
    }
    return success();
}

From source file:info.magnolia.security.app.dialog.field.validator.UniqueRoleNameValidator.java

@Override
protected boolean isValidValue(String value) {
    if (item instanceof JcrNodeAdapter) {
        // If we're editing an existing node then its allowed to use the current username of course
        if (!(item instanceof JcrNewNodeAdapter)) {
            try {
                String currentName = ((JcrNodeAdapter) item).getJcrItem().getName();
                if (StringUtils.equals(value, currentName)) {
                    return true;
                }/*ww  w .  j a  v a2s  . com*/
            } catch (RepositoryException e) {
                log.error("Exception occurred getting node name of node [{}]",
                        ((JcrNodeAdapter) item).getItemId(), e);
                return false;
            }
        }
        if (securitySupport.getRoleManager().getRole(value) != null) {
            // role with such name already exists
            return false;
        }
        return true;
    }
    return false;
}

From source file:de.micromata.genome.gwiki.pagetemplates_1_0.PtPageSectionEditorActionBean.java

private PtWikiSectionEditorArtefakt<?> createEditor() {

    if (pageId == null) {
        return null;
    }/*from  w ww.  j  a  v  a  2 s  .  c  o  m*/
    element = wikiContext.getWikiWeb().getElement(pageId);

    String fieldNumber = wikiContext.getRequestParameter("field");

    if (StringUtils.equals(editor, EDITOR_RTE)) {
        return new PtWikiRichTextEditor(element, sectionName, editor, hint);
    } else if (StringUtils.equals(editor, EDITOR_RAW)) {
        return new PtWikiRawTextEditor(element, sectionName, editor, hint, allowWikiSyntax);
    } else if (StringUtils.equals(editor, EDITOR_HL)) {
        return new PtWikiHeadlineEditor(element, sectionName, editor, hint);
    } else if (StringUtils.equals(editor, EDITOR_IMAGE)) {
        return new PtWikiImageEditor(element, sectionName, editor, hint, maxWidth, maxFileSize);
    } else if (StringUtils.equals(editor, EDITOR_LINK)) {
        return new PtWikiLinkEditor(element, sectionName, editor, hint, fieldNumber);
    } else if (StringUtils.equals(editor, EDITOR_ATTACHMENT)) {
        if (StringUtils.isNotEmpty(fieldNumber)) {
            return new PtWikiEditAttachmentEditor(element, sectionName, editor, hint, fieldNumber);
        } else {
            return new PtWikiAttachmentEditor(element, sectionName, editor, hint, maxFileSize, fieldNumber);
        }
    }
    return null;
}

From source file:io.wcm.testing.mock.aem.MockTemplate.java

@Override
public boolean equals(Object obj) {
    if (!(obj instanceof MockTemplate)) {
        return false;
    }//from  w ww.j a  va  2 s  . com
    return StringUtils.equals(getPath(), ((MockTemplate) obj).getPath());
}