List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:de.tobiasbruns.content.storage.StorageService.java
private String renameIfNameChanged(String path, Content<?> content) { File origFile = fsService.getFile(path); if (!StringUtils.equals(origFile.getName(), content.getHeader().getName())) { if (content.getHeader().getType() == ContentItemType.LEAF) { metaDataService.renameMetaDataFile(path, content.getHeader().getName()); }//from www. ja v a 2 s .c o m return fsService.renameFile(path, content.getHeader().getName()); } return path; }
From source file:jease.cms.domain.Access.java
public boolean approves(String login, String password) { return StringUtils.equals(getLogin(), login) && hasPassword(password); }
From source file:com.inkubator.hrm.web.lazymodel.AppraisalProgramDistributionLazyDataModel.java
@Override public AppraisalProgramDistributionViewModel getRowData(String id) { for (AppraisalProgramDistributionViewModel viewModel : list) { if (StringUtils.equals(id, String.valueOf(viewModel.getProgramId()))) { return viewModel; }/*from w ww .ja v a 2 s . com*/ } return null; }
From source file:com.dominion.salud.mpr.negocio.service.admin.impl.UsuariosServiceImpl.java
@Override public <S extends Usuarios> List<S> save(Iterable<S> usuarioss) { Iterator<S> iterador = usuarioss.iterator(); while (iterador.hasNext()) { Usuarios usuarios = iterador.next(); if (usuarios.getIdUsuario() != null && usuariosRepository.exists(usuarios.getIdUsuario())) { Usuarios existe = findOne(usuarios.getIdUsuario()); if (!StringUtils.equals(existe.getTxtPassword(), usuarios.getTxtPassword())) { usuarios.setTxtPassword(DigestUtils.md5Hex(usuarios.getTxtPassword())); }//from w ww . j a v a 2 s .c o m } else { usuarios.setTxtPassword(DigestUtils.md5Hex(usuarios.getTxtPassword())); } } return usuariosRepository.save(usuarioss); }
From source file:com.glaf.activiti.tasklistener.ProcessStarterListener.java
public void notify(DelegateTask delegateTask) { logger.debug("----------------------------------------------------"); logger.debug("------------------ProcessStarterListener------------"); logger.debug("----------------------------------------------------"); CommandContext commandContext = Context.getCommandContext(); DelegateExecution execution = delegateTask.getExecution(); String processInstanceId = delegateTask.getProcessInstanceId(); HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext .getHistoricProcessInstanceEntityManager().findHistoricProcessInstance(processInstanceId); String startUserId = historicProcessInstanceEntity.getStartUserId(); if (startUserId != null) { delegateTask.setAssignee(startUserId); if (sendMail != null && StringUtils.equals(sendMail.getExpressionText(), "true")) { Collection<String> assigneeList = new java.util.ArrayList<String>(); assigneeList.add(startUserId); MailBean bean = new MailBean(); bean.setSubject(subject);//from w w w . ja v a2s . c om bean.setContent(content); bean.setTaskContent(taskContent); bean.setTaskName(taskName); bean.setTemplateId(templateId); bean.sendMail(execution, assigneeList); } } if (sql != null) { ExecutionUtils.executeSqlUpdate(execution, sql); } }
From source file:com.inkubator.hrm.web.career.EmpEliminationApprovalFormController.java
@PostConstruct @Override//from w w w .j a v a 2s. co m public void initialization() { try { super.initialization(); String id = FacesUtil.getRequestParameter("execution"); selectedApprovalActivity = approvalActivityService.getEntiyByPK(Long.parseLong(id.substring(1))); model = new EmpEliminationModel(); isWaitingApproval = selectedApprovalActivity .getApprovalStatus() == HRMConstant.APPROVAL_STATUS_WAITING_APPROVAL; isApprover = StringUtils.equals(UserInfoUtil.getUserName(), selectedApprovalActivity.getApprovedBy()); generateEmpEliminationModel(); } catch (Exception ex) { LOGGER.error("Error", ex); } }
From source file:info.magnolia.security.app.dialog.field.validator.UniqueGroupNameValidator.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; }//from ww w.jav a 2s . c om } catch (RepositoryException e) { log.error("Exception occurred getting node name of node [{}]", ((JcrNodeAdapter) item).getItemId(), e); return false; } } // get all existing groups Collection<Group> groups = securitySupport.getGroupManager().getAllGroups(); for (Group g : groups) { // if there is any group with the same name, the value is invalid if (g.getName().equals(value)) { return false; } } // no group with the same name found, value is valid return true; } return false; }
From source file:com.cognifide.aet.executor.xmlparser.xml.utils.ValidationUtils.java
public static String validateLowerCase(String string, String warnMessage) { String fixedString = string.toLowerCase(); if (!StringUtils.equals(string, fixedString)) { LOGGER.warn(warnMessage);/*from ww w . j a v a 2s . co m*/ } return fixedString; }
From source file:keepinchecker.utility.EmailUtilities.java
protected static boolean hasScheduledEmailBeenSent(User user) { String emailFrequency = user.getEmailFrequency(); long emailLastSentDate = user.getEmailLastSentDate(); Duration timeBetweenLastEmailSentToNow = Duration.between(new Date(emailLastSentDate).toInstant(), Instant.now());/*from w ww . j a va2 s .c o m*/ if (StringUtils.equals(emailFrequency, User.EMAIL_FREQUENCY_WEEKLY) && timeBetweenLastEmailSentToNow.toDays() < 7) { return true; } else if (StringUtils.equals(emailFrequency, User.EMAIL_FREQUENCY_DAILY) && timeBetweenLastEmailSentToNow.toDays() < 1) { return true; } return false; }
From source file:info.magnolia.ui.framework.setup.ReplaceSaveModeTypeFieldDefinitionTask.java
@Override protected void operateOnNode(InstallContext installContext, Node node) { String nodePath = NodeUtil.getPathIfPossible(node); try {/*w w w. j ava2 s. c o m*/ if (StringUtils.contains(nodePath, "fields")) { if (node.hasProperty("multiValueHandlerClass")) { String multiValueHandlerClass = node.getProperty("multiValueHandlerClass").getString(); if (StringUtils.equals("info.magnolia.ui.form.field.property.MultiValuesHandler", multiValueHandlerClass)) { // Simply remove the node. The field definition already contains the default transformerClass. node.remove(); log.debug( "The following node will be removed {}. The field definition already contain the definition of the default transformerClass", nodePath); } else if (StringUtils.equals("info.magnolia.ui.form.field.property.SubNodesValueHandler", multiValueHandlerClass)) { Node parent = node.getParent(); parent.setProperty("transformerClass", MultiValueSubChildrenNodeTransformer.class.getName()); node.remove(); } else if (StringUtils.equals("info.magnolia.ui.form.field.property.CommaSeparatedValueHandler", multiValueHandlerClass)) { Node parent = node.getParent(); parent.setProperty("transformerClass", MultiValueJSONTransformer.class.getName()); node.remove(); } else { log.warn( "Unknown value for property 'multiValueHandlerClass' : {}. This node {} will not be handled", multiValueHandlerClass, nodePath); } } } else { log.debug( "The following node {} is not a field configuration. The child 'saveModeType' will not be handled. ", nodePath); } } catch (RepositoryException re) { log.warn("Could not Migrate 'saveModeType' child node of the following node {}.", nodePath); } }