Example usage for org.apache.commons.lang StringUtils isNotEmpty

List of usage examples for org.apache.commons.lang StringUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

Checks if a String is not empty ("") and not null.

Usage

From source file:cn.cuizuoli.appranking.typehandler.DeviceTypeTypeHandler.java

@Override
public DeviceType getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
    DeviceType deviceType = null;/*from   www.  ja  va2 s  .c  o  m*/
    String s = rs.getString(columnIndex);
    if (StringUtils.isNotEmpty(s)) {
        deviceType = DeviceType.getObject(s);
    }
    return deviceType;
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.AbstractOptionsBaseLoader.java

@SuppressWarnings("unchecked")
protected void loadOptionsEnum(T resultComponent, Element element) {
    String optionsEnumClass = element.attributeValue("optionsEnum");
    if (StringUtils.isNotEmpty(optionsEnumClass)) {
        Scripting scripting = AppBeans.get(Scripting.class);
        resultComponent.setOptionsEnum((Class<? extends EnumClass>) scripting.loadClass(optionsEnumClass));
    }//from   w  ww .  j av  a2s.  co  m
}

From source file:com.baifendian.swordfish.common.job.struct.node.impexp.reader.HiveReader.java

@Override
public boolean checkValid() {
    return StringUtils.isNotEmpty(database)
            && (StringUtils.isNotEmpty(table) || StringUtils.isNotEmpty(querySql))
            && CollectionUtils.isNotEmpty(column);
}

From source file:com.lm.lic.manager.controller.PocketGearWithdrawLicHandler.java

/**
 * @see com.lm.lic.manager.controller.WithdrawLicHandler#handleWithdrawal(javax.servlet.http.HttpServletRequest,
 *      com.lm.lic.manager.form.WithdrawLicForm)
 *///from  w w w. j a v a  2  s  . c o  m
@SuppressWarnings("deprecation")
@Override
public ModelAndView handleWithdrawal(HttpServletRequest request, HttpServletResponse response,
        WithdrawLicForm wlf) {
    logger.info("Start POCKETGEAR Handling of License Withdrawal Request");
    boolean valid = verifyPocketGearRequest(request);

    logger.info("POCKETGEAR_REQUEST_VALID? : " + valid);

    Product product = null;
    String isvProdId = wlf.getProductID();
    if (StringUtils.isNotEmpty(isvProdId)) {
        int index = isvProdId.indexOf('=');
        if (index > 0)
            isvProdId = isvProdId.substring(index + 1);
    }

    int numLics = NUM_POCKETGEAR_REQUESTED_LICENSES;
    String isvId = wlf.getIsvId();

    Long storeId = lmxContext.findStoreId(ParticipantStoresAtLicmax.PocketGear, request);

    if (StringUtils.isNotEmpty(isvId))
        product = productService.findQuickyProductByIsvProdStoreId(isvId, isvProdId, storeId + EMPTY);
    else
        product = productService.findQuickyProductByIsvProdId(isvProdId, storeId);

    if (product != null)
        logger.info("POCKETGEAR 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 POCKETGEAR - 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) {
        adjustDrawnLicenses(wlf, licenses, prevRfl, currRfl);
        licenseService.update(licenses);

        adjustLicenseBlock(licenseBlock, numLics, numOverdraft);
        licenseBlockService.update(licenseBlock);
        logger.info("Found " + licenses.size() + " Lics for POCKETGEAR");
    } else
        licenses = generateOverDraftLicenses(prevRfl, currRfl);

    for (License l : licenses)
        logger.info("Generated license for POCKETGEAR 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.enonic.cms.core.mail.MailServiceBeans.java

@Bean
public JavaMailSender javaMailSender() {
    JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();
    javaMailSender.setHost(smtpHost);/*  w ww.j  a va2 s.  c  om*/
    if (StringUtils.isNotEmpty(smtpUser)) {
        javaMailSender.setUsername(smtpUser);
    }
    if (StringUtils.isNotEmpty(smtpPassword)) {
        javaMailSender.setPassword(smtpPassword);
    }
    javaMailSender.setPort(smtpPort);
    return javaMailSender;
}

From source file:com.baifendian.swordfish.execserver.job.storm.StormSubmitArgsUtil.java

private static List<String> jarArgs(StormJarParam stormJarParam) {
    List<String> args = new ArrayList<>();
    args.add(JAR);/*from w  ww. ja  v  a 2s  .co  m*/

    //add mainJar
    args.add(stormJarParam.getMainJar().getRes());

    //add mainClass
    args.add(stormJarParam.getMainClass());

    //add Jars
    List<ResourceInfo> jars = stormJarParam.getJars();
    if (CollectionUtils.isNotEmpty(jars)) {
        args.add(JARS);
        args.add(StringUtils.join(jars.stream().map(p -> p.getRes()).toArray(), ","));
    }

    if (StringUtils.isNotEmpty(stormJarParam.getArgs())) {
        args.add(stormJarParam.getArgs());
    }

    if (StringUtils.isNotEmpty(stormJarParam.getArtifacts())) {
        args.add(ARTIFACTS);
        args.add(stormJarParam.getArtifacts());
    }

    if (StringUtils.isNotEmpty(stormJarParam.getArtifactRepositories())) {
        args.add(ARTIFACTREPOSITORIES);
        args.add(stormJarParam.getArtifactRepositories());
    }

    return args;

}

From source file:com.zanshang.services.company.CompanySaveActor.java

@Override
public void onReceive(Object o) throws Exception {
    Company company = (Company) o;//from  w w  w.ja va 2 s . c  o  m
    //?????
    Company origin = getMongoTemplate().findById(company.getUid(), Company.class);

    AuthorInformationIndexByIdentity byIdentity = getMongoTemplate().findById(company.getCompanyCode(),
            AuthorInformationIndexByIdentity.class);
    Publisher publisher = getMongoTemplate().findById(company.getUid(), Publisher.class);

    boolean legalInformationModified;
    if (origin == null) {
        legalInformationModified = false;
    } else {
        legalInformationModified = (!origin.getCompanyCode().equals(company.getCompanyCode()))
                || (!origin.getLicense().equals(company.getLicense()));
    }
    //??????,  origin = null ?check
    if ((byIdentity != null || publisher != null) && legalInformationModified) {
        logger.error("Try to modify company Legal information after verified. " + company.getUid());
        return;
    } else {
        //?check
        boolean filled = StringUtils.isNotEmpty(company.getCompanyCode())
                && (StringUtils.isNotEmpty(company.getLicense()))
                && (StringUtils.isNotEmpty(company.getCompanyName()))
                && (StringUtils.isNotEmpty(company.getContactPhone()));
        if (filled) {
            getMongoTemplate().save(company);
            if (legalInformationModified) {
                AuditAuthorInformation auditAuthorInformation = new AuditAuthorInformation(company.getUid());
                getMongoTemplate().save(auditAuthorInformation);
            }
        } else {
            logger.error("Try to modify company Legal information with blank field. " + company.getUid());
            return;
        }
    }
}

From source file:io.github.jeddict.jpa.modeler.properties.extend.ClassSelectionPanel.java

@Override
public void setValue(ReferenceClass referenceClass) {
    this.referenceClass = referenceClass;
    if (referenceClass != null && StringUtils.isNotEmpty(referenceClass.getName())) {
        class_EditorPane.setText(referenceClass.getName());
    } else {//from www .  j a  va2s . co m
        dataType_ActionActionPerformed(null);
    }
}

From source file:com.elasticbox.jenkins.k8s.plugin.builders.DeployChartBuildStep.java

@DataBoundConstructor
public DeployChartBuildStep(String id, String kubeName, String chartsRepo, String chartName,
        boolean deleteChartWhenFinished) {
    super();//from  w  w  w.j a  v a2s  .  com
    this.id = StringUtils.isNotEmpty(id) ? id : NAME_PREFIX + UUID.randomUUID().toString();
    this.kubeName = kubeName;
    this.chartsRepo = chartsRepo;
    this.chartName = chartName;
    this.deleteChartWhenFinished = deleteChartWhenFinished;
    injectMembers();
}

From source file:com.xhsoft.framework.common.exception.BaseRuntimeException.java

/**
 * <p>Description:getMessage</p>
 * @return String// w w  w.  j a  va 2  s .  c o  m
 * @author wenzhi
 * @version 1.0
 */
public String getMessage() {
    if (code == null || code.length() == 0) {
        return super.getMessage();
    }
    String i18n = "";
    if (StringUtils.isNotEmpty(i18n)) {
        return i18n;
    }
    String paramsStr = "NA";
    if (params != null) {
        paramsStr = StringUtils.join(params, ",");
    }
    String codeMessage = "code:" + code + ";parameters:" + paramsStr;
    return codeMessage;
}