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.cyclopsgroup.waterview.spi.BaseModuleRunnable.java
/** * Run attached module/*from w w w . j a va2 s .c o m*/ * * @param data Runtime data * @param context Context * @throws Exception Simply throw it out */ protected void runModule(RuntimeData data, Context context) throws Exception { if (StringUtils.isNotEmpty(getModulePath())) { ModuleService moduleManager = (ModuleService) data.getServiceManager().lookup(ModuleService.ROLE); moduleManager.runModule(modulePath, data, context); } }
From source file:com.supermap.desktop.icloud.utils.ValidationUtil.java
public static void validate(ReturnLicenseRequest request) { if (request.licenseId != null) { System.out.println("licenseId parameter is required"); }//from w w w .j a v a2 s.co m if (StringUtils.isNotEmpty(request.licenseId.value())) { System.out.println("licenseId parameter is required"); } if (request.returnId != null) { System.out.println("returnId parameter is required"); } if (StringUtils.isNotEmpty(request.returnId.value())) { System.out.println("returnId parameter is required"); } }
From source file:gov.nih.nci.ncicb.tcga.dcc.qclive.common.util.DirectoryListerImpl.java
/** * A method to get all files by a wildcard pattern * @param dirName name of the directory to look * @param filePatternList a list of patterns * @return an arrays of files that match the patterns * @throws IOException /*w w w . j a va2s. c o m*/ */ public static File[] getFilesByPattern(final String dirName, final List<String> filePatternList) { File[] listOfFiles = null; if (StringUtils.isNotEmpty(dirName) && filePatternList != null && filePatternList.size() > 0) { final File dir = new File(dirName); String[] dataSetFiles = dir.list(new WildcardFileFilter(filePatternList)); if (dataSetFiles != null && dataSetFiles.length > 0) { listOfFiles = new File[dataSetFiles.length]; for (int i = 0; i < dataSetFiles.length; i++) { try { listOfFiles[i] = new File(dir.getCanonicalPath() + File.separator + dataSetFiles[i]); } catch (IOException e) { // should never get here, but just in case we do , just return with null // meaning that no files by pattern could be found return null; } } } } return listOfFiles; }
From source file:gov.nih.nci.cabig.caaers.api.impl.DevicesServiceImpl.java
public CaaersServiceResponse createOrUpdateDevices(Devices devices) { CaaersServiceResponse response = Helper.createResponse(); for (DeviceType deviceType : devices.getDevice()) { boolean failed = false; Device inputDevice = deviceConverter.convert(deviceType); try {//from w w w .ja v a2 s.c om DeviceQuery dq = new DeviceQuery(); if (StringUtils.isNotEmpty(inputDevice.getCtepDbIdentifier())) { dq.filterByCtepDbIdentifier(inputDevice.getCtepDbIdentifier()); } else { dq.filterByCtepDbIdentifier(null); dq.filterByCommonName(inputDevice.getCommonName()); dq.filterByBrandName(inputDevice.getBrandName()); } Device dbDevice = loadPersistentDevice(dq); if (dbDevice == null) { log.info("Could not find device with [commonName : " + inputDevice.getCommonName() + ", ctepDbIdentifier : " + inputDevice.getCtepDbIdentifier() + "], so creating new device"); dbDevice = inputDevice; } //BJ: this is an overkill for new-device, // but it is okay, (it will put the last sync date) and we are not loosing much processing power anyway. deviceMigrator.migrate(inputDevice, dbDevice, null); deviceDao.save(dbDevice); } catch (Exception e) { log.error("Error while saving a device [commonName : " + inputDevice.getCommonName() + "]"); failed = true; } String businessIdentifier = (inputDevice.getCtepDbIdentifier() != null ? inputDevice.getCtepDbIdentifier() : inputDevice.getCommonName()); String message = "Device '" + inputDevice.getCommonName() + "' " + (failed ? "failed to create" : "created"); ProcessingOutcome outcome = Helper.createOutcome(Device.class, businessIdentifier, failed, message); Helper.populateProcessingOutcome(response, outcome); } return response; }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.ProgressBarLoader.java
protected void loadIndeterminate(ProgressBar component, Element element) { String indeterminate = element.attributeValue("indeterminate"); if (StringUtils.isNotEmpty(indeterminate)) { component.setIndeterminate(Boolean.parseBoolean(indeterminate)); }//from w w w . j a v a 2 s. c om }
From source file:gov.nih.nci.cabig.caaers.tools.spring.tabbedflow.InPlaceEditableTab.java
protected ModelAndView postProcessInPlaceEditing(HttpServletRequest request, C command, String property, String value) throws Exception { Map<String, String> map = new HashMap<String, String>(); String pathToGet = request.getParameter(PATH_TO_GET); if (StringUtils.isNotEmpty(pathToGet)) { value = (String) new DefaultObjectPropertyReader(command, pathToGet).getPropertyValueFromPath(); }// w w w. ja v a 2 s. c om if (value == null) value = ""; map.put(getFreeTextModelName(), value); return new ModelAndView("", map); }
From source file:com.mmj.app.web.webuser.MMJWebUserBuilderValve.java
@Override protected MMJWebUser createWebUser(HttpServletRequest request, CookieManager cookieManager) { MMJWebUser webUser = MMJWebUserBuilder.create(cookieManager); if (webUser != null && webUser.hasLogin() && webUser.getuId() != null && StringUtils.isNotEmpty(webUser.getName())) { MemberThinDO member = userService.fetchMemberById(webUser.getuId()); if (member != null) { webUser.setImg(member.getPic()); webUser.setIsBan(BooleanEnum.getByValue(member.getIsBan())); webUser.setMobile(member.getMobile()); webUser.setState(StateEnum.getEnum(member.getUserState())); webUser.setPasswd(member.getPasswd()); }/*from w w w . j a v a 2 s. c o m*/ } return webUser; }
From source file:cn.cuizuoli.appranking.typehandler.CountryTypeHandler.java
@Override public Country getNullableResult(ResultSet rs, int columnIndex) throws SQLException { Country country = null;// w w w.java 2 s . c o m String s = rs.getString(columnIndex); if (StringUtils.isNotEmpty(s)) { country = Country.getObject(s); } return country; }
From source file:apps.core.wcm.components.page.v1.page.Head.java
@Override public void activate() throws Exception { Page currentPage = getCurrentPage(); Tag[] tags = currentPage.getTags();//from ww w.ja va 2 s. co m ResourceResolver resourceResolver = getResourceResolver(); keywords = new String[tags.length]; int index = 0; for (Tag tag : tags) { keywords[index++] = tag.getTitle(); } Design design = getCurrentDesign(); if (design != null) { String designPath = design.getPath(); if (StringUtils.isNotEmpty(designPath)) { designPathCSS = designPath + ".css"; } icoFavicon = designPath + "/favicon.ico"; pngFavicon = designPath + "/favicon.png"; if (resourceResolver.getResource(icoFavicon) == null) { icoFavicon = null; } if (resourceResolver.getResource(pngFavicon) == null) { pngFavicon = null; } if (resourceResolver.getResource(designPath + "/static.css") != null) { staticDesignPath = designPath + "/static.css"; } } title = currentPage.getTitle(); if (StringUtils.isEmpty(title)) { title = currentPage.getName(); } }
From source file:com.microsoft.alm.plugin.external.commands.AddCommand.java
/** * Returns the files that were added//from w w w. ja va 2s. co m * <p/> * Output example: * /Users/leantk/tfvc-tfs/tfsTest_01/.idea: * misc.xml * modules.xml * <p/> * /Users/leantk/tfvc-tfs/tfsTest_01: * TestAdd.txt */ @Override public List<String> parseOutput(final String stdout, final String stderr) { super.throwIfError(stderr); final List<String> filesAdded = new ArrayList<String>(); final String[] output = getLines(stdout); // parse output for directory paths and file names to combine String path = StringUtils.EMPTY; for (final String line : output) { if (isFilePath(line)) { path = line; } else if (StringUtils.isNotEmpty(line)) { filesAdded.add(getFilePath(path, line, "")); } } return filesAdded; }