List of usage examples for org.apache.commons.lang StringUtils lowerCase
public static String lowerCase(String str)
Converts a String to lower case as per String#toLowerCase() .
From source file:com.activecq.tools.errorpagehandler.impl.ErrorPageHandlerImpl.java
/** * * * @param request//from ww w .j ava 2 s . c o m * @return */ public String getErrorPageName(SlingHttpServletRequest request) { // Get status code from request // Set the servlet name ot find to statusCode; update later if needed String servletName = String.valueOf(getStatusCode(request)); if (StringUtils.isBlank(servletName)) { servletName = this.fallbackErrorName; } final String servletPath = (String) request.getAttribute(ErrorPageHandlerService.SERVLET_NAME); if (StringUtils.isBlank(servletPath)) { return servletName; } try { final PathInfo pathInfo = new PathInfo(servletPath); final String[] parts = StringUtils.split(pathInfo.getResourcePath(), '/'); if (parts.length > 0) { servletName = parts[parts.length - 1]; } } catch (IllegalArgumentException ex) { // Use status code } return StringUtils.lowerCase(servletName); }
From source file:de.iteratec.iteraplan.businesslogic.common.URLBuilder.java
private static String getRelativeURLforFlow(String context, String dialog, Integer objectId) { StringBuilder relativeUrlBuffer = new StringBuilder(BUFFER_SIZE); relativeUrlBuffer.append(context);/* w ww. ja v a 2s . c o m*/ relativeUrlBuffer.append(FLOW_MAPPING); relativeUrlBuffer.append(StringUtils.lowerCase(dialog)); relativeUrlBuffer.append(FORWARD_SLASH); relativeUrlBuffer.append(objectId); return relativeUrlBuffer.toString(); }
From source file:com.sonicle.webtop.core.app.shiro.WTRealm.java
private boolean isSysAdmin(String internetDomain, String username) { return StringUtils.equals(StringUtils.lowerCase(username), "admin") && StringUtils.isBlank(internetDomain); }
From source file:com.haulmont.cuba.security.app.LoginWorkerBean.java
@Override public boolean checkRememberMe(String login, String rememberMeToken) { boolean verified = false; Transaction tx = persistence.createTransaction(); try {//from www . java 2s. c o m EntityManager em = persistence.getEntityManager(); TypedQuery<RememberMeToken> query = em.createQuery( "select rt from sec$RememberMeToken rt where rt.token = :token and rt.user.loginLowerCase = :userLogin", RememberMeToken.class); query.setParameter("token", rememberMeToken); query.setParameter("userLogin", StringUtils.lowerCase(login)); if (query.getFirstResult() != null) { verified = true; } tx.commit(); } finally { tx.end(); } return verified; }
From source file:com.sonicle.webtop.core.app.shiro.WTRealm.java
private boolean isSysAdminImpersonate(String username) { return StringUtils.startsWith(StringUtils.lowerCase(username), "admin!"); }
From source file:com.sonicle.webtop.core.app.shiro.WTRealm.java
private boolean isDomainAdminImpersonate(String username) { return StringUtils.startsWith(StringUtils.lowerCase(username), "admin$"); }
From source file:com.zb.app.web.controller.login.LoginController.java
/** * ,???,?/*w ww . ja v a 2 s .c om*/ * * @param travelCompanyVO * @param travelMemberVO * @return */ @RequestMapping(value = "/doRegister.htm") @TokenPolicy(remove = true, data = ",token,??!") public ModelAndView doRegister(@Valid TravelCompanyVO travelCompanyVO, @Valid TravelMemberVO travelMemberVO, BindingResult bindingResult, ModelAndView mav) { Map<String, Object> model = new HashMap<String, Object>(); if (bindingResult.hasErrors()) { for (FieldError fieldError : bindingResult.getFieldErrors()) { model.put(fieldError.getField(), fieldError.getDefaultMessage()); } return createErrorJsonMav("!", model); } // ? TravelCompanyDO travelCompanyDO = new TravelCompanyDO(); BeanUtils.copyProperties(travelCompanyDO, travelCompanyVO); travelCompanyDO.setcState(0); travelCompanyDO.setcSpell(PinyinParser.converterToFirstSpell(travelCompanyDO.getcName())); companyService.insert(travelCompanyDO); // TravelMemberDO travelMemberDO = new TravelMemberDO(); BeanUtils.copyProperties(travelMemberDO, travelMemberVO); travelMemberDO.setmState(0); travelMemberDO.setmPassword(EncryptBuilder.getInstance().encrypt(travelMemberVO.getmPassword())); travelMemberDO.setcId(travelCompanyDO.getcId()); travelMemberDO.setmUserName(StringUtils.lowerCase(travelMemberVO.getmUserName())); travelMemberDO.setmType(MemberTypeEnum.SUPERADMIN.getValue()); memberService.insert(travelMemberDO); Map<String, String> map = new HashMap<String, String>(); map.put("cName", travelCompanyDO.getcName()); map.put("mUserName", travelMemberDO.getmUserName()); map.put("mEmail", travelMemberDO.getmEmail()); return createSuccessJsonMav("?!", map); }
From source file:com.gst.portfolio.loanaccount.rescheduleloan.data.LoanRescheduleRequestDataValidator.java
/** * Validates a user request to reject a loan reschedule request * //from w w w .ja v a2 s.c o m * @param jsonCommand * the JSON command object (instance of the JsonCommand class) * @return void **/ public void validateForRejectAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { final String jsonString = jsonCommand.json(); if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } final Type typeToken = new TypeToken<Map<String, Object>>() { }.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS); final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors) .resource(StringUtils.lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); final JsonElement jsonElement = jsonCommand.parsedJson(); final LocalDate rejectedOnDate = this.fromJsonHelper .extractLocalDateNamed(RescheduleLoansApiConstants.rejectedOnDateParam, jsonElement); dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejectedOnDateParam) .value(rejectedOnDate).notNull(); if (rejectedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(rejectedOnDate)) { dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejectedOnDateParam).failWithCode( "before.submission.date", "Rejection date cannot be before the request submission date."); } LoanRescheduleRequestStatusEnumData loanRescheduleRequestStatusEnumData = LoanRescheduleRequestEnumerations .status(loanRescheduleRequest.getStatusEnum()); if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) { dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( "request.is.not.in.submitted.and.pending.state", "Loan reschedule request rejection is not allowed. " + "Loan reschedule request is not in submitted and pending approval state."); } if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } }
From source file:com.ah.ui.actions.admin.UsersAction.java
private void removeUserOperation() throws Exception { boolean bln_user = isRemoveAdminUser(); if (bln_user && getAllSelectedIds().size() <= 0) { addActionError(MgrUtil.getUserMessage("action.error.remove.default.user")); }// ww w. j av a 2 s .c o m boolean removeUserSelf = isRemoveUserSelf(); if (removeUserSelf && getAllSelectedIds().size() <= 0) { addActionError(MgrUtil.getUserMessage("action.error.delete.userself")); } HmUser refedHmUser = isRemoveTeacherUserRefed(); if (refedHmUser != null && getAllSelectedIds().size() <= 0) { addActionError( MgrUtil.getUserMessage("action.error.delete.refedteacheruser", refedHmUser.getUserName())); } if (getAllSelectedIds().size() <= 0) { return; } // cache selected user name list List<String> userNameList = new ArrayList<String>(); List<String> userEmailList = new ArrayList<String>(); for (Long userID : getAllSelectedIds()) { HmUser user = QueryUtil.findBoById(HmUser.class, userID); if (user != null) { userNameList.add(user.getUserName()); userEmailList.add(user.getEmailAddress()); } } // remove operation removeOperation(); // filter not removed user for (Iterator<String> iter = userNameList.iterator(); iter.hasNext();) { String userName = iter.next(); HmUser user = QueryUtil.findBoByAttribute(HmUser.class, "userName", userName, getDomain().getId()); if (user != null) { iter.remove(); } } // sync remove users if (NmsUtil.isHostedHMApplication()) { syncRemoveUser(userNameList); } // remove filter for user removeFilters(userNameList); // remove cached session removeSession(getAllSelectedIds()); // add in Geneva for remove user settings for (Iterator<String> iter = userEmailList.iterator(); iter.hasNext();) { String userEmail = iter.next(); HmUser user = QueryUtil.findBoByAttribute(HmUser.class, "lower(emailAddress)", StringUtils.lowerCase(userEmail), getDomain().getId()); if (user != null) { iter.remove(); } } UsersBussiness.removeUserSettings(userEmailList); }
From source file:hydrograph.ui.graph.figure.ComponentFigure.java
@Override protected void paintFigure(Graphics graphics) { Rectangle r = getBounds().getCopy(); graphics.translate(r.getLocation()); Rectangle q = new Rectangle(4, 4 + componentLabelMargin, r.width - 8, r.height - 8 - componentLabelMargin); graphics.fillRoundRectangle(q, 5, 5); graphics.drawImage(canvasIcon, new Point(q.width / 2 - 16, q.height / 2 + componentLabelMargin - 11)); drawPropertyStatus(graphics);/*from w ww .ja v a 2s. com*/ if ((StringUtils.equalsIgnoreCase(component.getCategory(), Constants.TRANSFORM) && !StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.FILTER) && !StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.UNIQUE_SEQUENCE))) { PropertyToolTipInformation propertyToolTipInformation; if (component.isContinuousSchemaPropogationAllow()) { drawSchemaPropogationInfoImageIfSchemaPropogationBreaks(graphics); propertyToolTipInformation = createPropertyToolTipInformation( Messages.CONTINUOUS_SCHEMA_PROPAGATION_STOPPED, Constants.SHOW_TOOLTIP); } else { propertyToolTipInformation = createPropertyToolTipInformation("", Constants.HIDE_TOOLTIP); } component.getTooltipInformation().put(Constants.ISSUE_PROPERTY_NAME, propertyToolTipInformation); } else if (StringUtils.equalsIgnoreCase(Constants.UNION_ALL, component.getComponentName())) { PropertyToolTipInformation propertyToolTipInformation; if (component.getProperties().get(Constants.IS_UNION_ALL_COMPONENT_SYNC) != null && StringUtils.equalsIgnoreCase( ((String) component.getProperties().get(Constants.IS_UNION_ALL_COMPONENT_SYNC)), Constants.FALSE)) { drawSchemaPropogationInfoImageIfSchemaPropogationBreaks(graphics); propertyToolTipInformation = createPropertyToolTipInformation( Messages.INPUTS_SCHEMA_ARE_NOT_IN_SYNC, Constants.SHOW_TOOLTIP); } else { propertyToolTipInformation = createPropertyToolTipInformation("", Constants.HIDE_TOOLTIP); } component.getTooltipInformation().put(Constants.ISSUE_PROPERTY_NAME, propertyToolTipInformation); } else if (component instanceof SubjobComponent) { boolean isTransformComponentPresent = SubjobUtility.INSTANCE .checkIfSubJobHasTransformOrUnionAllComponent(component); PropertyToolTipInformation propertyToolTipInformation; if (isTransformComponentPresent) { drawSchemaPropogationInfoImageIfSchemaPropogationBreaks(graphics); propertyToolTipInformation = createPropertyToolTipInformation( Messages.CONTINUOUS_SCHEMA_PROPAGATION_STOPPED_IN_SUBJOB, Constants.SHOW_TOOLTIP); } else { propertyToolTipInformation = createPropertyToolTipInformation("", Constants.HIDE_TOOLTIP); } component.getTooltipInformation().put(Constants.ISSUE_PROPERTY_NAME, propertyToolTipInformation); } graphics.drawText(acronym, new Point((q.width - (acronym.length() * 5)) / 2, q.height / 2 + componentLabelMargin - 23)); if (componentProperties != null && componentProperties.get(StringUtils.lowerCase(Constants.BATCH)) != null) { if (String.valueOf(componentProperties.get(StringUtils.lowerCase(Constants.BATCH))).length() > 2) { graphics.drawText(StringUtils.substring( String.valueOf(componentProperties.get(StringUtils.lowerCase(Constants.BATCH))), 0, 2) + "..", new Point(q.width - 16, q.height + getComponentLabelMargin() - 20)); } else { graphics.drawText(String.valueOf(componentProperties.get(StringUtils.lowerCase(Constants.BATCH))), new Point(q.width - 14, q.height + getComponentLabelMargin() - 20)); } } trackExecution(graphics); }