List of usage examples for org.apache.commons.lang StringUtils isNotBlank
public static boolean isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
From source file:com.dattack.dbtools.drules.engine.report.Report.java
private static Template createTemplate(final AbstractEventActionThrowableBean action) throws ConfigurationException, IOException { if (StringUtils.isNotBlank(action.getTemplateText())) { return TemplateHelper.createTemplate(action.getTemplateText()); }//from ww w .j av a2 s . com if (StringUtils.isNotBlank(action.getTemplateFile())) { return TemplateHelper.loadTemplate(action.getTemplateFile()); } // use default template return TemplateHelper .loadTemplate(GlobalConfiguration.getProperty(GlobalConfiguration.DRULES_TEMPLATE_THROWABLE_KEY)); }
From source file:gov.nih.nci.protexpress.ui.filters.UserFilter.java
/** * {@inheritDoc}//w ww . j a va2 s. com */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { chain.doFilter(request, response); return; } String username = ((HttpServletRequest) request).getRemoteUser(); if (StringUtils.isNotBlank(username)) { User user = ProtExpressRegistry.getUserProvisioningManager().getUser(username); if (user == null) { user = new User(); user.setLoginName(username); } UserHolder.setUser(user); request.setAttribute("currentUser", UserHolder.getUser()); request.setAttribute("currentUserDisplayName", UserHolder.getDisplayNameForUser()); } else { UserHolder.setUser(null); } chain.doFilter(request, response); }
From source file:com.googlecode.jtiger.modules.ecside.core.bean.ColumnDefaults.java
static String getFilterCell(TableModel model, String filterCell) { String result;//from www. j a v a 2 s .c om if (StringUtils.isNotBlank(filterCell)) { result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_FILTER_CELL + filterCell); if (StringUtils.isBlank(result)) { result = filterCell; } } else { result = model.getPreferences() .getPreference(PreferencesConstants.COLUMN_FILTER_CELL + TableConstants.CELL_FILTER); } return result; }
From source file:ddf.catalog.transformer.common.tika.MetacardCreator.java
/** * A convenience method for creating a new {@link Metacard} of type * {@link BasicTypes#BASIC_METACARD} from a {@link Metadata} object. * * @param metadata the {@code Metadata} object containing the metadata relevant to the * metacard, must not be null * @param id the value for the {@link Metacard#ID} attribute that should be set in the * generated {@code Metacard}, may be null * @param metadataXml the XML for the {@link Metacard#METADATA} attribute that should be set in * the generated {@code Metacard}, may be null * @return a new {@code Metacard}/* ww w .java 2s .c o m*/ */ public static Metacard createBasicMetacard(final Metadata metadata, final String id, final String metadataXml) { final Metacard metacard = new MetacardImpl(BasicTypes.BASIC_METACARD); final String contentType = metadata.get(Metadata.CONTENT_TYPE); if (StringUtils.isNotBlank(contentType)) { metacard.setAttribute(new AttributeImpl(Metacard.CONTENT_TYPE, contentType)); } final String title = metadata.get(TikaCoreProperties.TITLE); if (StringUtils.isNotBlank(title)) { metacard.setAttribute(new AttributeImpl(Metacard.TITLE, title)); } final String createdDateStr = metadata.get(TikaCoreProperties.CREATED); final Date createdDate = convertDate(createdDateStr); if (createdDate != null) { metacard.setAttribute(new AttributeImpl(Metacard.CREATED, createdDate)); } final String modifiedDateStr = metadata.get(TikaCoreProperties.MODIFIED); final Date modifiedDate = convertDate(modifiedDateStr); if (modifiedDate != null) { metacard.setAttribute(new AttributeImpl(Metacard.MODIFIED, modifiedDate)); } if (StringUtils.isNotBlank(id)) { metacard.setAttribute(new AttributeImpl(Metacard.ID, id)); } if (StringUtils.isNotBlank(metadataXml)) { metacard.setAttribute(new AttributeImpl(Metacard.METADATA, metadataXml)); } final String lat = metadata.get(Metadata.LATITUDE); final String lon = metadata.get(Metadata.LONGITUDE); final String wkt = toWkt(lon, lat); if (StringUtils.isNotBlank(wkt)) { metacard.setAttribute(new AttributeImpl(Metacard.GEOGRAPHY, wkt)); } return metacard; }
From source file:edu.cornell.kfs.vnd.businessobject.VendorBatchInsuranceTracking.java
public VendorBatchInsuranceTracking(String[] insuranceTracking) { insuranceRequiredIndicator = StringUtils.equalsIgnoreCase("Y", insuranceTracking[0]); if (StringUtils.isNotBlank(insuranceTracking[1])) { insuranceRequirementsCompleteIndicator = StringUtils.equalsIgnoreCase("Y", insuranceTracking[1]); }// w w w. j a va 2s . co m if (StringUtils.isNotBlank(insuranceTracking[2])) { cornellAdditionalInsuredIndicator = StringUtils.equalsIgnoreCase("Y", insuranceTracking[2]); } generalLiabilityCoverageAmount = getAmount(insuranceTracking[3]); generalLiabilityExpiration = getFormatDate(insuranceTracking[4]); automobileLiabilityCoverageAmount = getAmount(insuranceTracking[5]); automobileLiabilityExpiration = getFormatDate(insuranceTracking[6]); workmansCompCoverageAmount = getAmount(insuranceTracking[7]); workmansCompExpiration = getFormatDate(insuranceTracking[8]); excessLiabilityUmbrellaAmount = getAmount(insuranceTracking[9]); excessLiabilityUmbExpiration = getFormatDate(insuranceTracking[10]); if (StringUtils.isNotBlank(insuranceTracking[11])) { healthOffSiteCateringLicenseReq = StringUtils.equalsIgnoreCase("Y", insuranceTracking[11]); } healthOffSiteLicenseExpirationDate = getFormatDate(insuranceTracking[12]); insuranceNotes = insuranceTracking[13]; }
From source file:fi.koku.portlet.filter.userinfo.service.impl.UserinfoServiceKunpoImpl.java
@Override public UserInfo getUserInfoById(String uid) { UserInfo ret = null;/* w ww. j a v a2s . com*/ if (StringUtils.isNotBlank(uid)) { PersonService ps = new PersonService(); List<String> user = new ArrayList<String>(1); user.add(uid);//Add current user try { List<Person> persons = ps.getPersonsByUids(user, PersonConstants.PERSON_SERVICE_DOMAIN_CUSTOMER, uid, UserInfoConstants.COMPONENT_USER_INFO_FILTER); Person p = persons.get(0);//Get the first one (actually should there should be only 0 or 1 persons in list) ret = UserInfoFactory.instance().createUserInfo(uid, p.getPic(), p.getFname(), p.getSname()); } catch (Exception e) { LOG.error("Person not found with uid=" + uid); } } return ret; }
From source file:net.erdfelt.android.sdkfido.configer.Configurable.java
public Configurable(Field field, ConfigOption option, String key, String scope) { this.field = field; this.field.setAccessible(true); this.name = field.getName(); if (StringUtils.isNotBlank(scope)) { this.scope = scope; } else {/*from w ww . j a v a 2 s .c om*/ this.scope = option.scope(); if (StringUtils.isBlank(this.scope)) { this.scope = "options"; } } this.key = key; if (StringUtils.isNotBlank(option.type())) { this.type = option.type(); } else if ((this.field != null) && (this.field.getType() != null)) { this.type = this.field.getType().getSimpleName(); } this.description = option.description(); }
From source file:business.model.CaptchaModel.java
/** * * @param publicKey/*from w w w. j a va2 s. c om*/ * @return */ public static String GetPrivateKeyFromPublicKey(String publicKey) { try { String privateKey = keyList.get(publicKey); if (StringUtils.isBlank(privateKey)) { privateKey = AppInfoServiceClient.getInstance().getMainInfoByApiKey(publicKey).getSecretKey(); if (StringUtils.isNotBlank(privateKey)) { keyList.put(publicKey, privateKey); } } return privateKey; } catch (Exception e) { log.error(e.getMessage(), e); } return ""; }
From source file:com.hzc.framework.util.PropertiesUtil.java
public static String getProperties(String key) { String result = null;// w w w.jav a2 s . c om if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(p.getProperty(key))) { result = p.getProperty(key).trim(); } return result; }
From source file:azkaban.project.CronSchedule.java
/** * @throws IllegalArgumentException if cronExpression is null or blank *///from w w w.ja v a 2s . c o m public CronSchedule(final String cronExpression) { Preconditions.checkArgument(StringUtils.isNotBlank(cronExpression)); this.cronExpression = cronExpression; //todo chengren311: check cronExpression is valid: quartz has CronExpression.isValidExpression() }