List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:com.jfaker.app.modules.web.LeaveController.java
/** * ?// w w w. j a va 2 s.c o m */ public void apply() { //?? keepPara(); //??????????? //?????????? setAttr("operator", ShiroUtils.getUsername()); String orderId = getPara(PARA_ORDERID); String taskId = getPara(PARA_TASKID); //?taskId?????? if (StringUtils.isEmpty(orderId) || StringUtils.isNotEmpty(taskId)) { //idapply.jsp render("apply.jsp"); } else { //orderId??taskId????? //????variableflowData? //???orderId????orderId? flowData(orderId, getPara(PARA_TASKNAME)); //? render("applyView.jsp"); } }
From source file:iddb.api.ServerManager.java
public static Server getAuthorizedServer(String key, String remoteAddress, String serverName, String publicIp, Integer port) throws UnauthorizedUpdateException { Server server = serverDAO.findByUid(key); if (server == null) { // Compose. StringBuilder builder = new StringBuilder("Se intenta actualizar servidor no existente.\n"); builder.append("Key: " + key).append("\n"); if (serverName != null) builder.append("Nombre: " + serverName).append("\n"); if (remoteAddress != null) builder.append("IP: " + remoteAddress).append("\n"); String message = builder.toString(); // Throw. throw new UnauthorizedUpdateException(message); }/* w w w.j a v a 2 s . co m*/ if (server.getDisabled()) { // Compose. StringBuilder builder = new StringBuilder("Intento de actualizar servidor deshabilitado.\n"); builder.append("Key: " + key).append("\n"); if (serverName != null) builder.append("Nombre: " + serverName).append("\n"); if (remoteAddress != null) builder.append("IP: " + remoteAddress).append("\n"); String message = builder.toString(); // Throw. throw new UnauthorizedUpdateException(message); } if (StringUtils.isNotEmpty(remoteAddress) && StringUtils.isNotEmpty(server.getAddress()) && !remoteAddress.equals(server.getAddress())) { // Compose. StringBuilder builder = new StringBuilder("Intento de actualizar desde IP no autorizada.\n"); builder.append("Key: " + key).append("\n"); if (serverName != null) builder.append("Nombre: " + serverName).append("\n"); if (remoteAddress != null) builder.append("IP: " + remoteAddress).append("\n"); String message = builder.toString(); // Throw. throw new UnauthorizedUpdateException(message); } if (port != null && StringUtils.isNotEmpty(server.getDisplayAddress())) { try { String[] pIp = server.getDisplayAddress().split(":"); if (!(publicIp.equals(pIp[0]) && port.equals(Integer.parseInt(pIp[1])))) { // Compose. StringBuilder builder = new StringBuilder( "Intento de actualizar desde IP:PORT no autorizado.\n"); builder.append("Key: " + key).append("\n"); if (serverName != null) builder.append("Nombre: " + serverName).append("\n"); if (remoteAddress != null) builder.append("IP: " + remoteAddress).append("\n"); builder.append("IP Pblica: " + publicIp).append("\n"); builder.append("Puerto: " + port.toString()).append("\n"); String message = builder.toString(); // Throw. throw new UnauthorizedUpdateException(message); } } catch (Exception e) { log.error(e.getMessage()); } } return server; }
From source file:com.sailing.hrm.service.datatable.FormDataManager.java
/** * ????/* w ww.ja va2 s . co m*/ * @param formData */ public void save(FormData formData) { if (StringUtils.isNotEmpty(formData.getProcessId())) { if (StringUtils.isNotEmpty(formData.getOrderId()) && StringUtils.isNotEmpty(formData.getTaskId())) { facets.execute(formData.getTaskId(), ShiroUtils.getUsername(), null); } else { Order order = facets.startAndExecute(formData.getProcessId(), ShiroUtils.getUsername(), null); formData.setOrderId(order.getId()); } } List<SqlData> sqlDatas = getInsertSQLs(formData); formDataDao.save(sqlDatas); }
From source file:com.cloudera.nav.plugin.examples.stetson.StetsonExecution.java
public StetsonExecution(String namespace) { // Because the namespace is given to input/output we ensure it // exists when it is used by adding it as a c'tor parameter Preconditions.checkArgument(StringUtils.isNotEmpty(namespace)); setNamespace(namespace);/*ww w . jav a 2 s . co m*/ }
From source file:com.lm.lic.manager.controller.HandangoWithdrawLicHandler.java
/** * @see com.lm.lic.manager.controller.WithdrawLicHandler#handleWithdrawal(javax.servlet.http.HttpServletRequest, * com.lm.lic.manager.form.WithdrawLicForm) *//*from www. j a va 2 s . co m*/ @SuppressWarnings("deprecation") @Override public ModelAndView handleWithdrawal(HttpServletRequest request, HttpServletResponse response, WithdrawLicForm wlf) { logger.info("Start HGO Handling of License Withdrawal Request"); boolean valid = verifyHgoRequest(request); logger.info("HGO_REQUEST_VALID? : " + valid); QuickyProduct product = null; String isvProdId = wlf.getProductId(); int numLics = wlf.getQty(); String isvId = wlf.getIsvId(); Long storeId = lmxContext.findStoreId(ParticipantStoresAtLicmax.Handango, request); if (StringUtils.isNotEmpty(isvId)) product = productService.findQuickyProductByIsvProdStoreId(isvId, isvProdId, storeId + EMPTY); else product = productService.findQuickyProductByIsvProdId(isvProdId, storeId); if (product != null) logger.info("HANDANGO License Withdrawal for product: " + product.getName() + " " + product.getVersion() + " ISV: " + product.getIsv().getName()); RequestForLicense prevRfl = findExistingLicWithdrawalRecord(product, wlf, request); String prodId = product.getId() + EMPTY; isvId = product.getIsv().getId() + EMPTY; int numOverdraft = 0; LicenseBlock licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId); String localeLang = extractLocaleLang(request); if (licenseBlock == null) { numOverdraft = numLics; logger.info("Found 0 " + "Lics to withdraw for HGO - Going OVERDRAFT"); licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numLics, numOverdraft, LicensePaymentStatus.OVERDRAFT); licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId); } List<License> licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId()); if (licenses == null || licenses.size() < numLics) { int licensesSize = 0; if (licenses != null) licensesSize = licenses.size(); numOverdraft = numLics - licensesSize; licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numOverdraft, numOverdraft, LicensePaymentStatus.OVERDRAFT); licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId()); } RequestForLicense currRfl = findRequestForLicenseTrace(request, wlf); if (licenses != null) { logger.info("Found " + licenses.size() + " Lics for HGO"); adjustDrawnLicenses(wlf, licenses, prevRfl, currRfl); licenseService.update(licenses); adjustLicenseBlock(licenseBlock, numLics, numOverdraft); licenseBlockService.update(licenseBlock); } else licenses = generateOverDraftLicenses(prevRfl, currRfl); for (License l : licenses) logger.info("Generated license for HANDANGO request: " + l.getLicKey() + " for product: " + l.getProduct().getName() + " " + l.getProduct().getVersion()); if (currRfl != null) adjustRequestForLicenseTransaction(product, currRfl, prevRfl, licenses, numOverdraft); String successView = getSuccessView(); ModelAndView modelAndView = new ModelAndView(successView); modelAndView.addObject("isvId", isvId); modelAndView.addObject("prodId", prodId); modelAndView.addObject("licenses", licenses); modelAndView.addObject("rfl", currRfl); modelAndView.addObject("product", product); return modelAndView; }
From source file:com.lm.lic.manager.controller.MobiHandWithdrawLicHandler.java
/** * @see com.lm.lic.manager.controller.WithdrawLicHandler#handleWithdrawal(javax.servlet.http.HttpServletRequest, * com.lm.lic.manager.form.WithdrawLicForm) *///w w w.ja v a 2 s. c om @SuppressWarnings("deprecation") @Override public ModelAndView handleWithdrawal(HttpServletRequest request, HttpServletResponse response, WithdrawLicForm wlf) { logger.info("Start MOBIHAND Handling of License Withdrawal Request"); boolean valid = verifyMobiHandRequest(request); logger.info("MOBIHAND_REQUEST_VALID? : " + valid); Product product = null; String isvProdId = wlf.getProductId(); int numLics = wlf.getQty(); String isvId = wlf.getIsvId(); Long storeId = lmxContext.findStoreId(ParticipantStoresAtLicmax.MobiHand, request); if (StringUtils.isNotEmpty(isvId)) product = productService.findQuickyProductByIsvProdStoreId(isvId, isvProdId, storeId + EMPTY); else product = productService.findQuickyProductByIsvProdId(isvProdId, storeId); if (product != null) logger.info("MOBIHAND License Withdrawal for product: " + product.getName() + " " + product.getVersion() + " ISV: " + product.getIsv().getName()); RequestForLicense prevRfl = findExistingLicWithdrawalRecord(product, wlf, request); String prodId = product.getId() + EMPTY; isvId = product.getIsv().getId() + EMPTY; int numOverdraft = 0; LicenseBlock licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId); String localeLang = extractLocaleLang(request); if (licenseBlock == null) { numOverdraft = numLics; logger.info("Found 0 " + "Lics to withdraw for MOBIHAND - Going OVERDRAFT"); licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numLics, numOverdraft, LicensePaymentStatus.OVERDRAFT); licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId); } List<License> licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId()); if (licenses == null || licenses.size() < numLics) { numOverdraft = numLics - licenses.size(); licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numOverdraft, numOverdraft, LicensePaymentStatus.OVERDRAFT); licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId()); } RequestForLicense currRfl = findRequestForLicenseTrace(request, wlf); if (licenses != null) { adjustDrawnLicenses(wlf, licenses, prevRfl, currRfl); licenseService.update(licenses); adjustLicenseBlock(licenseBlock, numLics, numOverdraft); licenseBlockService.update(licenseBlock); logger.info("Found " + licenses.size() + " Lics for MOBIHAND"); } else licenses = generateOverDraftLicenses(prevRfl, currRfl); for (License l : licenses) logger.info("Generated license for MOBIHAND request: " + l.getLicKey() + " for product: " + l.getProduct().getName() + " " + l.getProduct().getVersion()); if (currRfl != null) adjustRequestForLicenseTransaction(product, currRfl, prevRfl, licenses, numOverdraft); String successView = getSuccessView(); ModelAndView modelAndView = new ModelAndView(successView); modelAndView.addObject("isvId", isvId); modelAndView.addObject("prodId", prodId); modelAndView.addObject("licenses", licenses); modelAndView.addObject("rfl", currRfl); modelAndView.addObject("product", product); return modelAndView; }
From source file:ar.com.zauber.labs.kraken.providers.wikipedia.model.impl.InmutableWikiLink.java
/** * Recibe la representacion en texto de la wikipedia y los separa * en topico y anchor./*from w w w. j av a2 s . c o m*/ * * Ej: * [[Almirante Brown (partido)]] * [[Provincia de Santiago del Estero|Santiago del Estero]] * */ public InmutableWikiLink(final String textRepresentation, final WikiPageRetriever wikiPageRetriever, final Language wikiLang) { Validate.isTrue(StringUtils.isNotEmpty(textRepresentation), "Can't create a WikiLink from null"); Validate.notNull(wikiPageRetriever); Validate.notNull(wikiLang); this.wikiPageRetriever = wikiPageRetriever; this.wikiLang = wikiLang; final Matcher m = regex.matcher(textRepresentation); if (m.matches()) { this.href = m.group(1).trim(); String tmp = m.group(2).trim(); this.value = StringUtils.isBlank(tmp) ? null : tmp.substring(1); } else { throw new IllegalArgumentException("Illegal link: " + textRepresentation); } }
From source file:jp.co.nemuzuka.service.impl.KindServiceImpl.java
@Override public KindForm get(String projectKeyString) { KindForm form = new KindForm(); if (StringUtils.isNotEmpty(projectKeyString)) { KindModel model = kindDao.get4ProjectKey(projectKeyString); setForm(form, model);//from www. j av a 2s . c o m } return form; }
From source file:com.clican.pluto.dataprocess.bean.ExecBean.java
@SuppressWarnings("unchecked") public Object getParam(ProcessorContext context) { try {/* w w w . j a v a 2 s .co m*/ Object param = context.getMap(); if (StringUtils.isNotEmpty(getParamName())) { param = context.getAttribute(getParamName()); if (param instanceof Map && getParamNameMap() != null && getParamNameMap().size() != 0) { param = new HashMap<String, Object>((Map) param); if (getParamNameMap() != null && getParamNameMap().size() != 0) { for (String contextName : getParamNameMap().keySet()) { Object obj = PropertyUtils.getNestedProperty(param, contextName); ((Map) param).remove(contextName); if (obj != null) { ((Map) param).put(getParamNameMap().get(contextName), obj); } } } } } else { Map<String, Object> map; if (getParamNameMap() != null && getParamNameMap().size() != 0) { map = context.getMap(); for (String contextName : getParamNameMap().keySet()) { Object obj = PropertyUtils.getNestedProperty(map, contextName); map.remove(contextName); if (obj != null) { map.put(getParamNameMap().get(contextName), obj); } } } else { map = context.getMap(); } param = map; } return param; } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.ecbeta.view.html.HTMLElement.java
public String toHTML() { StringBuilder sb = new StringBuilder(); sb.append("<").append(tag); for (Map.Entry<String, String> ent : this.attribtues.entrySet()) { sb.append(ent.getKey()).append("=\""); sb.append(ent.getValue());//from w w w .j a va 2 s . c o m sb.append("\" "); } sb.append(">"); if (StringUtils.isNotEmpty(innerHTML)) { sb.append(innerHTML); } if (children != null) { for (HTMLElement h : children) { sb.append(h.toHTML()); } } sb.append("</").append(tag).append(">"); return sb.toString(); }