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.bstek.dorado.config.text.TextParserHelper.java
public TextParser getTextParser(Class<?> beanType) throws Exception { TextParser textParser = null;//from w w w. j a v a2s.c o m TextSectionInfo textSectionInfo = getTextSectionInfo(beanType); if (textSectionInfo != null) { if (StringUtils.isNotEmpty(textSectionInfo.getParser())) { textParser = (TextParser) BeanFactoryUtils.getBean(textSectionInfo.getParser()); } } return textParser; }
From source file:com.jfaker.framework.security.model.User.java
public Page<User> paginate(int pageNumber, int pageSize, User user) { StringBuilder from = new StringBuilder("from sec_user u left join sec_org o on u.org=o.id where 1=1 "); List<String> params = new ArrayList<String>(); String username = user.getStr("username"); String fullname = user.getStr("fullname"); if (StringUtils.isNotEmpty(username)) { from.append(" and u.username=? "); params.add(username);/* www. ja v a 2s . c o m*/ } if (StringUtils.isNotEmpty(fullname)) { from.append(" and u.fullname=? "); params.add(fullname); } from.append(" order by id desc"); return paginate(pageNumber, pageSize, "select u.*,o.name as orgName", from.toString(), params.toArray()); }
From source file:com.photon.phresco.impl.BuildInfoParameterImpl.java
@Override public PossibleValues getValues(Map<String, Object> map) throws PhrescoException { try {/*from w w w .j av a 2s. c o m*/ String rootModulePath = ""; String subModuleName = ""; PossibleValues possibleValues = new PossibleValues(); ApplicationInfo applicationInfo = (ApplicationInfo) map.get(KEY_APP_INFO); String rootModule = (String) map.get(KEY_ROOT_MODULE); if (StringUtils.isNotEmpty(rootModule)) { rootModulePath = Utility.getProjectHome() + rootModule; subModuleName = applicationInfo.getAppDirName(); } else { rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName(); } String buildInfoPath = getBuildInfoPath(rootModulePath, subModuleName).toString(); List<BuildInfo> buildInfos = Utility.getBuildInfos(new File(buildInfoPath)); if (buildInfos != null) { for (BuildInfo buildInfo : buildInfos) { Value value = new Value(); value.setValue(Integer.toString(buildInfo.getBuildNo())); possibleValues.getValue().add(value); } } return possibleValues; } catch (PhrescoException e) { throw new PhrescoException(e); } }
From source file:com.cyclopsgroup.tornado.ui.action.admin.security.SaveUserAction.java
/** * Overwrite or implement method execute() * * @see com.cyclopsgroup.waterview.Action#execute(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.ActionContext) *//* w ww. j a va 2s. c o m*/ public void execute(RuntimeData data, ActionContext context) throws Exception { String newPassword = data.getParameters().getString("new_password"); if (StringUtils.isNotEmpty(newPassword) && !StringUtils.equals(newPassword, data.getParameters().getString("confirmed_password"))) { context.error("confirmed_password", "Two passwords are not the same"); return; } PersistenceManager persist = (PersistenceManager) lookup(PersistenceManager.ROLE); User user = (User) persist.load(User.class, data.getParameters().getString("user_id")); TypeUtils.getBeanUtils().copyProperties(user, data.getParameters().toProperties()); if (StringUtils.isNotEmpty(newPassword)) { user.setPrivatePassword(newPassword); } persist.update(user); context.addMessage("User " + user.getDisplayName() + " is changed"); }
From source file:com.adobe.cq.wcm.core.components.context.CoreComponentTestContext.java
/** * Creates a new instance of {@link AemContext}, adds the project specific Sling Models and loads test data from the JSON file * "/test-content.json" in the current classpath * * @param testBase Prefix of the classpath resource to load test data from. Optional, can be null. If null, test data will be * loaded from /test-content.json * @param contentRoot Path to import the JSON content to * @return New instance of {@link AemContext} *//*www . ja va2 s . co m*/ public static AemContext createContext(final String testBase, final String contentRoot) { return new AemContext(new AemContextCallback() { @Override public void execute(AemContext context) throws IOException { context.registerService(FormStructureHelperFactory.class, new FormStructureHelperFactory() { @Override public FormStructureHelper getFormStructureHelper(Resource formElement) { return null; } }); context.registerService(ImplementationPicker.class, new ResourceTypeBasedResourcePicker()); context.addModelsForPackage("com.adobe.cq.wcm.core.components.models"); if (StringUtils.isNotEmpty(testBase)) { context.load().json(testBase + "/test-content.json", contentRoot); } else { context.load().json("/test-content.json", contentRoot); } } }, ResourceResolverType.JCR_MOCK); }
From source file:com.evolveum.midpoint.web.component.prism.ItemWrapperComparator.java
private String getDisplayName(ItemDefinition def) { String displayName = def.getDisplayName(); if (StringUtils.isNotEmpty(displayName)) { return displayName; }/* w w w . j a v a 2 s. c o m*/ return def.getName().getLocalPart(); }
From source file:com.opoopress.maven.plugins.plugin.InitMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { if (skipInit) { getLog().info("Skiping initialize site."); return;/*from w w w . j a v a2 s.c o m*/ } Locale loc = null; if (StringUtils.isNotEmpty(locale)) { loc = LocaleUtils.toLocale(locale); } try { siteManager.initialize(baseDirectory, loc); } catch (Exception e) { throw new MojoFailureException(e.getMessage(), e); } }
From source file:com.bstek.dorado.data.config.definition.InterceptableDefinition.java
@Override protected MethodInterceptor[] getMethodInterceptors(CreationInfo creationInfo, CreationContext context) throws Exception { MethodInterceptor[] interceptors = null; String interceptor = (String) creationInfo.getUserData("interceptor"); if (StringUtils.isNotEmpty(interceptor)) { MethodInterceptor interceptorInvoker = getInterceptorInvoker(interceptor); if (interceptorInvoker != null) { interceptors = new MethodInterceptor[] { interceptorInvoker }; }/*ww w . j a va 2 s .c o m*/ } return interceptors; }
From source file:com.github.dbourdette.glass.configuration.Version.java
@PostConstruct public void initialize() throws IOException, ParseException { Properties properties = new Properties(); InputStream propertyStream = getClass().getResourceAsStream("/glass-version.txt"); properties.load(propertyStream);//w w w . jav a2 s .c om propertyStream.close(); applicationVersion = properties.getProperty(APPLICATION_VERSION_NAME); String compilationDateAsString = properties.getProperty(COMPILATION_DATE_NAME); if (StringUtils.isNotEmpty(compilationDateAsString)) { compilationDate = new SimpleDateFormat(COMPILATION_DATE_FORMAT).parse(compilationDateAsString); } }
From source file:com.haulmont.cuba.desktop.TopLevelFrame.java
protected void initUI() { setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); glassPane = new DisabledGlassPane(); JRootPane rootPane = SwingUtilities.getRootPane(this); rootPane.setGlassPane(glassPane);/*from w ww.j a v a 2 s. c o m*/ Configuration configuration = AppBeans.get(Configuration.NAME); DesktopConfig config = configuration.getConfig(DesktopConfig.class); DesktopResources resources = App.getInstance().getResources(); if (StringUtils.isNotEmpty(config.getWindowIcon())) { setIconImage(resources.getImage(config.getWindowIcon())); } }