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.cloudera.nav.sdk.client.MetadataExtractorTest.java
@Test public void testExtractAll() { MetadataResultSet res = extractor.extractMetadata(); assertNotNull(res); assertTrue(StringUtils.isNotEmpty(res.getMarker())); }
From source file:ch.puzzle.itc.mobiliar.business.shakedown.xmlmodel.TestSet.java
public OverallStatus getOverallStatus() { if (StringUtils.isNotEmpty(failure)) { return OverallStatus.failed; }/*from w w w. j a v a2 s . c o m*/ if (tests != null) { boolean potentialWarning = false; for (Test t : tests) { if (t.getTestStatus().equals("failed")) { return OverallStatus.failed; } else if (t.getTestStatus().equals("missing")) { potentialWarning = true; } } return potentialWarning ? OverallStatus.warning : OverallStatus.success; } return OverallStatus.warning; }
From source file:cec.easyshop.storefront.interceptors.beforeview.GoogleMapsBeforeViewHandler.java
@Override public void beforeView(final HttpServletRequest request, final HttpServletResponse response, final ModelAndView modelAndView) throws Exception { modelAndView.addObject("googleApiVersion", configurationService.getConfiguration().getString(GOOGLE_API_VERSION)); final String googleApiKey = hostConfigService.getProperty(GOOGLE_API_KEY_ID, request.getServerName()); if (StringUtils.isNotEmpty(googleApiKey)) { modelAndView.addObject("googleApiKey", googleApiKey); }/*from ww w. ja v a 2 s .c o m*/ }
From source file:com.cloudera.nav.plugin.examples.stetson.StetsonScript.java
public StetsonScript(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);/*from www. j ava 2 s . com*/ }
From source file:com.lm.lic.manager.controller.BlackBerryWithdrawLicHandler.java
/** * @see com.lm.lic.manager.controller.WithdrawLicHandler#handleWithdrawal(javax.servlet.http.HttpServletRequest, * com.lm.lic.manager.form.WithdrawLicForm) *//* www.j a va 2 s . c o m*/ @SuppressWarnings("deprecation") @Override public ModelAndView handleWithdrawal(HttpServletRequest request, HttpServletResponse response, WithdrawLicForm wlf) { logger.info("Start BlackBerry Handling of License Withdrawal Request"); Product product = null; String name = wlf.getProduct(); String version = wlf.getVersion(); String isvId = wlf.getIsvId(); Long storeId = lmxContext.findStoreId(ParticipantStoresAtLicmax.BlackBerryAppWorld, request); if (StringUtils.isNotEmpty(isvId)) product = productService.findProductByNameAndVersion(isvId, name, version); else product = productService.findQuickyProductByNameAndVersion(name, version, storeId); if (product == null) { if (StringUtils.isNotEmpty(isvId)) product = productService.findProductByName(isvId, name); else product = productService.findProductByName(name); } if (product != null) logger.info("BlackBerry License Withdrawal for product: " + product.getName() + " " + product.getVersion() + " ISV: " + product.getIsv().getName()); RequestForLicense prevRfl = findExistingLicWithdrawalRecord(product, wlf, request); boolean exceeds = exceedsMaxAllowedTrialLicsPerProduc(product, prevRfl); logger.info("BB EXCEEDS for Product " + product.getName() + " : " + exceeds); String prodId = product.getId() + EMPTY; isvId = product.getIsv().getId() + EMPTY; LicenseBlock licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId); Integer numOverdraft = 0; Integer numLics = NUM_BLACKBERRY_REQUESTED_LICENSES; String localeLang = extractLocaleLang(request); if (licenseBlock == null) { numOverdraft = NUM_BLACKBERRY_REQUESTED_LICENSES; licenseAvailabilityAdvisor.generateLicenses(wlf.getPIN(), 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 = NUM_BLACKBERRY_REQUESTED_LICENSES; logger.info("Found 0 " + " Lics to withdraw for BlackBerryAppWorld - Going OVERDRAFT"); licenseAvailabilityAdvisor.generateLicenses(wlf.getPIN(), localeLang, product, numLics, numOverdraft, LicensePaymentStatus.OVERDRAFT); licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId()); } RequestForLicense currRfl = findRequestForLicenseTrace(request, wlf); if (licenses != null && licenses.size() > 0) { adjustDrawnLicenses(wlf, licenses, prevRfl, currRfl); licenseService.update(licenses); adjustLicenseBlock(licenseBlock, numLics, numOverdraft); licenseBlockService.update(licenseBlock); logger.info("Found " + licenses.size() + " Lics for BlackBerryAppWorld"); for (License l : licenses) logger.info("Generated license for BlackBerry 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:info.magnolia.cms.security.Authenticator.java
/** * Authenticate authorization request using JAAS login module as configured * @param request as received by the servlet engine * @return boolean//w ww . j ava 2s. com */ public static boolean authenticate(HttpServletRequest request) { String credentials = request.getHeader("Authorization"); String userid; String pswd; CredentialsCallbackHandler callbackHandler; String loginModuleToInitialize = "magnolia"; // default login module if (StringUtils.isEmpty(credentials) || credentials.length() <= 6) { // check for form based login request if (StringUtils.isNotEmpty(request.getParameter(PARAMETER_USER_ID))) { userid = request.getParameter(PARAMETER_USER_ID); pswd = StringUtils.defaultString(request.getParameter(PARAMETER_PSWD)); callbackHandler = new PlainTextCallbackHandler(userid, pswd.toCharArray()); } else { // select login module to use if user is authenticated against the container if (request.getUserPrincipal() != null) { loginModuleToInitialize = "magnolia_authorization"; callbackHandler = new PlainTextCallbackHandler(request.getUserPrincipal().getName(), "".toCharArray()); } else { // invalid auth request return false; } } } else { // its a basic authentication request callbackHandler = new Base64CallbackHandler(credentials); } Subject subject; try { LoginContext loginContext = new LoginContext(loginModuleToInitialize, callbackHandler); loginContext.login(); subject = loginContext.getSubject(); // ok, we NEED a session here since the user has been authenticated HttpSession httpsession = request.getSession(true); httpsession.setAttribute(ATTRIBUTE_JAAS_SUBJECT, subject); } catch (LoginException le) { if (log.isDebugEnabled()) log.debug("Exception caught", le); HttpSession httpsession = request.getSession(false); if (httpsession != null) { httpsession.invalidate(); } return false; } return true; }
From source file:edu.sampleu.bookstore.kew.BookTypeQualifierResolver.java
public List<Map<String, String>> resolve(RouteContext context) { List<Map<String, String>> qualifiers = new ArrayList<Map<String, String>>(); MaintenanceDocument doc = (MaintenanceDocument) getDocument(context); Maintainable maint = doc.getNewMaintainableObject(); Book book = (Book) maint.getDataObject(); if (StringUtils.isNotEmpty(book.getTypeCode())) { qualifiers.add(Collections.singletonMap(BookstoreKimAttributes.BOOK_TYPE_CODE, book.getTypeCode())); decorateWithCommonQualifiers(qualifiers, context, null); } else {/*from www . j a va2s.c om*/ Map<String, String> basicQualifier = new HashMap<String, String>(); qualifiers.add(basicQualifier); } return qualifiers; }
From source file:br.com.semanticwot.cd.discovery.cache.CacheInterceptor.java
@Override public void filter(ContainerRequestContext requestContext) throws IOException { if (requestContext.getMethod().equals("GET")) { String unparsedDate = requestContext.getHeaderString("If-Modified-Since"); if (StringUtils.isNotEmpty(unparsedDate)) { Date date = dateProvider.fromString(unparsedDate); String path = requestContext.getUriInfo().getPath(); if (!entityCache.isUpdated(path, date)) { // Modificado de NOT_MODIFIED para FOUND, pois o primeiro no // permite anexar uma entidade na resposta // e a semantica do FOUND cabe aqui. // Cache muito importante, por causa do custo computacional // do raciocinio em ontologias Response response = Response.status(Status.FOUND) .entity(entityCache.getEntityDatePairEntity(path)).build(); requestContext.abortWith(response); }//from w ww.j av a 2 s . com } } }
From source file:com.alibaba.otter.manager.web.webx.valve.auth.url.URLProtectedEditor.java
/** * ??Pattern,?URL/*from w w w . j a va 2 s. c om*/ */ private List<URLPatternHolder> convertTextToPatterns(String text) { List<URLPatternHolder> list = new ArrayList<URLPatternHolder>(); if (StringUtils.isNotEmpty(text)) { BufferedReader br = new BufferedReader(new StringReader(text)); int counter = 0; String line; while (true) { counter++; try { line = br.readLine(); } catch (IOException ioe) { throw new IllegalArgumentException(ioe.getMessage()); } if (line == null) { break; } line = StringUtils.trim(line); if (StringUtils.isBlank(line)) { continue; } if (logger.isDebugEnabled()) { logger.debug("Line " + counter + ": " + line); } list.add(convertStringToPattern(line)); } } return list; }
From source file:com.clican.pluto.dataprocess.spring.parser.ConditionProcessorParser.java
@SuppressWarnings("unchecked") public void customiseBeanDefinition(BeanDefinition beanDef, Element element, ParserContext parserContext) { NodeList nodeList = element.getChildNodes(); ManagedMap processorMap = new ManagedMap(); ManagedMap exceptionMap = new ManagedMap(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { String localName = node.getLocalName(); if ("cond".equals(localName)) { Element condElement = (Element) node; String expr = condElement.getAttribute("expr"); String nextDataProcessor = condElement.getAttribute("nextDataProcessor"); String exception = condElement.getAttribute("exception"); if (StringUtils.isNotEmpty(exception)) { exceptionMap.put(expr, exception); } else if (StringUtils.isNotEmpty(nextDataProcessor)) { processorMap.put(expr, new RuntimeBeanReference(nextDataProcessor)); } else { processorMap.put(expr, null); }// w ww . j av a 2 s .com } } } beanDef.getPropertyValues().addPropertyValue("exceptionMap", exceptionMap); beanDef.getPropertyValues().addPropertyValue("dataProcessorMap", processorMap); }