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.edgenius.wiki.blogsync.BlogSyncServiceImpl.java
public boolean verifyBlog(BlogMeta blog) { if (blog == null) //non blog, then it treats as correct one return true; try {// w w w .j a va 2 s . co m List<BlogMeta> blogs = getUsersBlogs(blog.getType(), blog.getUrl(), blog.getUsername(), blog.getPassword()); if (blogs == null) return false; for (BlogMeta meta : blogs) { if (StringUtils.equals(meta.getName(), blog.getName())) //here, a little bit tricky, update url with canonical one blog.setUrl(meta.getUrl()); } } catch (BlogSyncException e) { return false; } return true; }
From source file:gov.nih.nci.cabig.caaers.web.rule.notification.NotificationsTab.java
@Override public void postProcess(HttpServletRequest req, ReportDefinitionCommand cmd, Errors errors) { super.postProcess(req, cmd, errors); String action = req.getParameter("_action"); if (StringUtils.equals("delete", action)) { int indexToDelete = NumberUtils.toInt(cmd.getIndexToDelete()); int indexOnTimeScale = NumberUtils.toInt(cmd.getPointOnScale()); int i = 0; for (Iterator<PlannedNotification> it = cmd.getReportDefinition().getPlannedNotifications() .iterator(); it.hasNext();) { PlannedNotification pen = it.next(); if (pen.getIndexOnTimeScale() == indexOnTimeScale) { if (i == indexToDelete) { it.remove();// w ww .ja v a2 s. com break; } i++; } } } else { if (errors.hasErrors()) cmd.setPointOnScale(cmd.getLastPointOnScale()); } }
From source file:com.sammyun.controller.console.ProfileController.java
/** * //from www.j a v a2 s .co m */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update(String currentPassword, String iconPhoto, String password, String email, RedirectAttributes redirectAttributes) { if (!isValid(Admin.class, "email", email)) { return ERROR_VIEW; } Admin pAdmin = adminService.getCurrent(); if (StringUtils.isNotEmpty(currentPassword) && StringUtils.isNotEmpty(password)) { if (!isValid(Admin.class, "password", password)) { return ERROR_VIEW; } if (!StringUtils.equals(DigestUtils.md5Hex(currentPassword), pAdmin.getPassword())) { return ERROR_VIEW; } pAdmin.setPassword(DigestUtils.md5Hex(password)); } pAdmin.setEmail(email); pAdmin.setIconPhoto(iconPhoto); adminService.update(pAdmin); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:edit.ct"; }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.LoginPageModelImpl.java
@Override public void setUserName(final String userName) { if (!StringUtils.equals(this.userName, userName)) { this.userName = userName; setChangedAndNotify(PROP_USER_NAME); }/*from w w w . j av a 2 s . c o m*/ }
From source file:jp.primecloud.auto.tool.management.iaasgw.IaasGatewayScriptService.java
public void importKeyPair(String keyName, String publicKey) throws AutoException { // ??????????? String keyPairs = gateway.describeKeyPairs(); if (StringUtils.isNotEmpty(keyPairs)) { for (String keyPair : keyPairs.split("##")) { if (StringUtils.equals(keyName, keyPair)) { log.info(platformName + " ? " + keyName + " ?????????????"); System.out.println("IMPORT_SKIPPED"); return; }// w w w. j a v a 2 s . com } } gateway.importKeyPair(keyName, publicKey); log.info(keyName + "??????"); }
From source file:com.edgenius.wiki.search.interceptor.SpaceIndexInterceptor.java
public void afterReturning(Object retValue, Method method, Object[] args, Object target) throws Throwable { Space space = null;//from w w w.j a v a 2 s . c o m String removedSpaceUname = null; if (StringUtils.equals(method.getName(), SpaceService.saveHomepage)) { //save space: does not interceptor saveSpace(), saveHomepage() will call immediately after saveSpace(); space = (Space) retValue; if (space.containExtLinkType(Space.EXT_LINK_BLOG)) { sendBlogLinkNotify(space); } } else if (StringUtils.equals(method.getName(), SpaceService.uploadLogo)) { if (Shell.enabled && Global.restServiceEnabled) { //send space update indexing request - although this not necessary for indexing but will trigger Shell request space = (Space) args[0]; if (space != null) { IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_INSERT_SPACE, space.getUid()); jmsTemplate.convertAndSend(queue, mqObj); } } //don't do further update return; } else if (StringUtils.equals(method.getName(), SpaceService.updateSpace)) { space = (Space) retValue; if (space.containExtLinkType(Space.EXT_LINK_BLOG)) { sendBlogLinkNotify(space); } //don't update space index - so don't continue run if (!((Boolean) args[1])) return; } else if (StringUtils.equals(method.getName(), SpaceService.removeSpace)) { removedSpaceUname = (String) args[0]; //delete RSS feed: log.info("JMS message send for space RSS feed remove. Title: " + removedSpaceUname); RSSMQObject mqObj = new RSSMQObject(RSSMQObject.TYPE_DELETE, ((Space) retValue).getUid()); jmsTemplate.convertAndSend(rssQueue, mqObj); } else if (StringUtils.equals(method.getName(), SpaceService.removeSpaceInDelay)) { //only send out notification, but does not update Index!!! space = (Space) retValue; int removeDelayHours = (Integer) args[1]; //please note, here must transfer space object rather than spaceUid etc. especially when removeDelayHours==0, //because the space may be already removed from database. NotifyMQObject pnObj = new NotifyMQObject(WikiUtil.getUserName(), space, removeDelayHours); jmsTemplate.convertAndSend(notifyQueue, pnObj); if (removeDelayHours == 0) { //this will send removeSpaceIndex message but not invoke Index insert Q message. removedSpaceUname = space.getUnixName(); space = null; } } if (space != null && !space.isRemoved()) { log.info("JMS message send for Space index creating. Title: " + space.getName() + ". Unixname:" + space.getUnixName()); IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_INSERT_SPACE, space.getUid()); jmsTemplate.convertAndSend(queue, mqObj); } if (removedSpaceUname != null) { log.info("JMS message send for Space index remove. Title: " + removedSpaceUname); IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_REMOVE_SPACE, removedSpaceUname); jmsTemplate.convertAndSend(queue, mqObj); } }
From source file:com.sfs.beans.BuilderBean.java
/** * Gets the boolean./* w ww . ja v a 2 s . c o m*/ * * @param parameter the parameter * * @return the boolean */ public final boolean getBoolean(final String parameter) { boolean value = false; if (this.parameters != null) { if (this.parameters.containsKey(parameter)) { String stringValue = (String) this.parameters.get(parameter); if (StringUtils.equals(stringValue, "true")) { value = true; } } else { // Check to see if LOAD_ALL flag is set to true, if so return // true and exit if (this.parameters.containsKey("LOAD_ALL")) { String stringValue = (String) this.parameters.get("LOAD_ALL"); if (StringUtils.equals(stringValue, "true")) { value = true; } } } } return value; }
From source file:gov.nih.nci.cabig.caaers.accesscontrol.query.impl.AbstractIdFetcher.java
public boolean isPostgeSQL() { return StringUtils.equals("postgres", getDbName()); }
From source file:com.mmj.app.web.controller.item.ItemController.java
@RequestMapping(value = { "/user/{name}/publish", "/user/{name}" }) public ModelAndView publish(@PathVariable("name") final String name, Integer page) { ModelAndView mav = new ModelAndView("item/publish"); Long userId = 0l;/*w ww . j a va2s.c o m*/ MemberDO member = userService.find(new MemberQuery(name)); if (member == null) { return mav; } if (WebUserTools.hasLogin() && StringUtils.equals(WebUserTools.getName(), member.getName())) { userId = WebUserTools.getUid(); } else { userId = member.getId(); } mav.addObject("member", member); TopicQuery query = new TopicQuery(new TopicDO(userId)); query.setNowPageIndex(Argument.isNotPositive(page) ? 0 : page - 1); PaginationList<TopicDO> list = topicService.listPagination(query, new IPageUrl() { @Override public String parsePageUrl(Object... objs) { return "/user/" + name + "/publish/" + (Integer) objs[1]; } }); initUserInfo4List(list); mav.addObject("list", list); int publishCount = 0; int likedCount = 0; int commentsCount = 0; if (Argument.isNotEmpty(list) && list.getQuery() != null) { publishCount = list.getQuery().getAllRecordNum(); } mav.addObject("publishCount", publishCount); likedCount = userService.count(new CollectQuery(userId, CollectTypeEnum.LIKED)); mav.addObject("likedCount", likedCount); commentsCount = commentsService.count(new CommentsQuery(userId)); mav.addObject("commentsCount", commentsCount); if (WebUserTools.hasLogin()) { List<CollectDO> mySavedList = userService .list(new CollectQuery(WebUserTools.getUid(), CollectTypeEnum.SAVED)); mav.addObject("mySavedList", CollectionUtils.getLongValues(mySavedList, "topicId")); if (StringUtils.equals(WebUserTools.getName(), name)) { mav.addObject("savedCount", mySavedList.size()); } } else { mav.addObject("mySavedList", Collections.<Long>emptyList()); } return mav; }
From source file:com.matricula.Actions.RegistrationAction.java
public void saveRegistration(AjaxBehaviorEvent event) throws FinderException, NotFoundException { boolean isValid = validate(); if (isValid) { completeRecord();/*from w ww .j a va 2 s. c o m*/ if (StringUtils.equals(super.getAction(), Action.CREATE.getValue())) { super.serviceDao.save(editMatricula); } else { super.serviceDao.update(editMatricula); } loadRegistrationList(); } }