List of usage examples for org.apache.commons.lang StringUtils equals
public static boolean equals(String str1, String str2)
Compares two Strings, returning true
if they are equal.
From source file:com.bluexml.xforms.actions.CreateFormAction.java
/** * Creates a new create page./* w ww . j a v a 2 s . co m*/ */ @Override protected void create() { // retrieve data type String inputDataType = requestParameters.get(MsgId.INT_ACT_PARAM_ANY_DATATYPE.getText()); String formTypeHint = requestParameters.get(MsgId.INT_ACT_PARAM_ANY_HINT.getText()); // push new page PageInfoBean bean = new PageInfoBean(); if (StringUtils.equals(formTypeHint, MsgId.INT_ACT_SUFFIX_GET_FORM_CLASS.getText())) { bean.setFormType(FormTypeEnum.CLASS); } else { bean.setFormType(FormTypeEnum.FORM); } bean.setFormName(inputDataType); bean.setDataType(controller.getDataTypeFromFormName(bean.getFormName())); bean.setLanguage(navigationPath.peekCurrentPage().getLanguage()); navigationPath.setCurrentPage(bean); }
From source file:com.smartitengineering.cms.spi.impl.content.template.persistent.TemplateId.java
@Override public int compareTo(TemplateId o) { if (o == null) { return 1; }/*from w w w .j a v a2 s . c o m*/ if (StringUtils.equals(id, o.id)) { return 0; } if (id != null) { return id.compareTo(o.id); } return -1; }
From source file:com.apexxs.neonblack.detection.LocationInspector.java
public List<DetectedLocation> inspectLocations(List<DetectedLocation> locations, String text) { for (DetectedLocation loc : locations) { String countryCode;/*from w w w .j a v a 2s . com*/ String stateCode; countryCode = isItACountry(loc.name); stateCode = isItAState(loc.name); if (StringUtils.equals("RGX", loc.detectedBy)) continue; if (!StringUtils.isEmpty(countryCode) && !StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add("(countryCode:" + countryCode + " OR " + "admin1:" + stateCode + ")"); //continue; } else { if (!StringUtils.isEmpty(countryCode)) { loc.hints = new ArrayList<>(); loc.hints.add("countryCode:" + countryCode); loc.hints.add("featureCode:PCLI"); loc.countryCode = countryCode; for (Integer pos : loc.startPos) { countryPositions.put(pos, countryCode); } } else if (!StringUtils.isEmpty(stateCode)) { loc.hints = new ArrayList<>(); loc.hints.add(("admin1:" + stateCode)); loc.countryCode = "US"; loc.stateCode = stateCode; for (Integer pos : loc.startPos) { statePositions.put(pos, stateCode); } } } if (loc.hints == null) { String hint = anyHints(loc.name); if (!StringUtils.isEmpty(hint)) { loc.hints = new ArrayList<>(); loc.hints.add(hint); if (StringUtils.endsWithIgnoreCase(loc.name, "province")) { loc.synonym = loc.name.replaceAll("(?i)province", "").trim(); } if (StringUtils.endsWithIgnoreCase(loc.name, "district")) { loc.synonym = loc.name.replaceAll("(?i)district", "").trim(); } if (StringUtils.endsWithIgnoreCase(loc.name, "village")) { loc.synonym = loc.name.replaceAll("(?i)village", "").trim(); } } } } for (DetectedLocation loc : locations) { loc = checkProximity(loc); loc = checkForBigramType1(loc); loc = checkForBigramType2(loc, text); } return locations; }
From source file:net.librec.similarity.AbstractRecommenderSimilarity.java
/** * Build social similarity matrix with trainMatrix in dataModel. * * @param dataModel/* w ww .j av a 2 s .c o m*/ * the input data model */ @Override public void buildSimilarityMatrix(DataModel dataModel) { conf = dataModel.getContext().getConf(); String similarityKey = conf.get("rec.recommender.similarity.key", "user"); if (StringUtils.isNotBlank(similarityKey)) { if (StringUtils.equals(similarityKey, "social")) { buildSocialSimilarityMatrix(dataModel); } else { // calculate the similarity between users, or the similarity between // items. boolean isUser = StringUtils.equals(similarityKey, "user") ? true : false; SparseMatrix trainMatrix = dataModel.getDataSplitter().getTrainData(); int numUsers = trainMatrix.numRows(); int numItems = trainMatrix.numColumns(); int count = isUser ? numUsers : numItems; similarityMatrix = new SymmMatrix(count); for (int i = 0; i < count; i++) { SparseVector thisVector = isUser ? trainMatrix.row(i) : trainMatrix.column(i); if (thisVector.getCount() == 0) { continue; } // user/item itself exclusive for (int j = i + 1; j < count; j++) { SparseVector thatVector = isUser ? trainMatrix.row(j) : trainMatrix.column(j); if (thatVector.getCount() == 0) { continue; } double sim = getCorrelation(thisVector, thatVector); if (!Double.isNaN(sim)) { similarityMatrix.set(i, j, sim); } } } } } }
From source file:com.echosource.ada.core.AdaDirectory.java
/** * Checks if this package is the default one. * /*w ww . j a va 2 s. c o m*/ * @return <code>true</code> the package key is empty, <code>false</code> in any other case */ public boolean isDefault() { return StringUtils.equals(getKey(), DEFAULT_PACKAGE_NAME); }
From source file:com.edgenius.wiki.search.interceptor.TagIndexInterceptor.java
public void afterReturning(Object retValue, Method method, Object[] args, Object target) throws Throwable { //although saveUpdatePageTag will call internalSaveUpdatePageTag() to save tag, but for spring, same service interceptor //does not work twice if methods are in same service. //This means, if PageService call saveUpdatePageTag(), then saveUpdatePageTag() call internalSaveUpdatePageTag(), //the interceptor only work for first method. if (StringUtils.equals(method.getName(), TagService.saveUpdatePageTag)) { List<PageTag> tags = (List<PageTag>) retValue; if (tags != null) { //update all tag for (PageTag pageTag : tags) { sendMessage(pageTag);// w w w.j av a2 s .c o m } } Page page = (Page) args[0]; if (page != null && Shell.enabled && Global.restServiceEnabled) { sendMessage(page.getPageUuid()); } } else if (StringUtils.equals(method.getName(), TagService.saveUpdateSpaceTag)) { List<SpaceTag> tags = (List<SpaceTag>) retValue; if (tags != null) { //update all tag for (SpaceTag pageTag : tags) { sendMessage(pageTag); } } //not suppose to raise Shell request as space update will send such request } else if (StringUtils.equals(method.getName(), TagService.internalSavePageTag)) { PageTag pageTag = (PageTag) retValue; if (pageTag != null) { sendMessage(pageTag); } //not suppose to raise Shell request as this method only used for Page copy method, and it will send pageUpdate Shell request } }
From source file:com.thoughtworks.go.util.json.JsonString.java
public boolean contains(Json json) { if (json instanceof JsonString) { JsonString jsonString = (JsonString) json; if (StringUtils.startsWith(jsonString.value, "RegEx:")) { Pattern pattern = Pattern.compile(replace(jsonString.value, "RegEx:", "")); Matcher matcher = pattern.matcher(this.value); return matcher.find(); } else {/*from w ww .ja v a 2 s.c o m*/ return StringUtils.equals(this.value, jsonString.value); } } else if (json instanceof JsonI18NResolvable) { return json.contains(this); } return false; }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.models.jpa.JpaNavigationModel.java
public boolean equalsDbEntityAttrs(JpaNavigationModel model) { return StringUtils.equals(category, model.getCategory()); }
From source file:net.shopxx.entity.SpecificationItem.java
public boolean isValid(SpecificationValue specificationValue) { if (specificationValue != null && specificationValue.getId() != null && StringUtils.isNotEmpty(specificationValue.getValue()) && CollectionUtils.isNotEmpty(getEntries())) { for (SpecificationItem.Entry entry : getEntries()) { if (entry != null && entry.getIsSelected() && specificationValue.getId().equals(entry.getId()) && StringUtils.equals(entry.getValue(), specificationValue.getValue())) { return true; }//from w w w. j a va 2 s . c o m } } return false; }
From source file:com.cyclopsgroup.tornado.security.SimpleAsset.java
/** * Override method authorize in class SimpleAbstractAsset * * @see com.cyclopsgroup.tornado.security.Asset#authorize(com.cyclopsgroup.tornado.security.Permission) */// www . j a v a 2 s . c o m public boolean authorize(Permission permission) { if (!(permission instanceof SimplePermission)) { return false; } SimplePermission sp = (SimplePermission) permission; if (StringUtils.equals(expression, sp.getExpression())) { return true; } String pattern = '^' + sp.getExpression() + '$'; return Pattern.matches(pattern, expression); }