Example usage for org.apache.commons.lang3 StringUtils isNoneBlank

List of usage examples for org.apache.commons.lang3 StringUtils isNoneBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNoneBlank.

Prototype

public static boolean isNoneBlank(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are blank ("") or null and whitespace only..

 StringUtils.isNoneBlank(null)             = false StringUtils.isNoneBlank(null, "foo")      = false StringUtils.isNoneBlank(null, null)       = false StringUtils.isNoneBlank("", "bar")        = false StringUtils.isNoneBlank("bob", "")        = false StringUtils.isNoneBlank("  bob  ", null)  = false StringUtils.isNoneBlank(" ", "bar")       = false StringUtils.isNoneBlank("foo", "bar")     = true 

Usage

From source file:io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder.java

public Swagger2MarkupConfigBuilder(Configuration configuration) {
    CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
    compositeConfiguration.addConfiguration(new SystemConfiguration());
    compositeConfiguration.addConfiguration(configuration);
    compositeConfiguration.addConfiguration(getDefaultConfiguration());

    Swagger2MarkupProperties swagger2MarkupProperties = new Swagger2MarkupProperties(compositeConfiguration);

    config.markupLanguage = swagger2MarkupProperties.getRequiredMarkupLanguage(MARKUP_LANGUAGE);
    config.swaggerMarkupLanguage = swagger2MarkupProperties.getRequiredMarkupLanguage(SWAGGER_MARKUP_LANGUAGE);
    config.generatedExamplesEnabled = swagger2MarkupProperties.getRequiredBoolean(GENERATED_EXAMPLES_ENABLED);
    config.basePathPrefixEnabled = swagger2MarkupProperties.getRequiredBoolean(BASE_PATH_PREFIX_ENABLED);
    config.separatedDefinitionsEnabled = swagger2MarkupProperties
            .getRequiredBoolean(SEPARATED_DEFINITIONS_ENABLED);
    config.separatedOperationsEnabled = swagger2MarkupProperties
            .getRequiredBoolean(SEPARATED_OPERATIONS_ENABLED);
    config.pathsGroupedBy = swagger2MarkupProperties.getGroupBy(PATHS_GROUPED_BY);
    config.outputLanguage = swagger2MarkupProperties.getLanguage(OUTPUT_LANGUAGE);
    config.inlineSchemaEnabled = swagger2MarkupProperties.getRequiredBoolean(INLINE_SCHEMA_ENABLED);
    config.interDocumentCrossReferencesEnabled = swagger2MarkupProperties
            .getRequiredBoolean(INTER_DOCUMENT_CROSS_REFERENCES_ENABLED);
    config.interDocumentCrossReferencesPrefix = swagger2MarkupProperties
            .getString(INTER_DOCUMENT_CROSS_REFERENCES_PREFIX, null);
    config.flatBodyEnabled = swagger2MarkupProperties.getRequiredBoolean(FLAT_BODY_ENABLED);
    config.pathSecuritySectionEnabled = swagger2MarkupProperties
            .getRequiredBoolean(PATH_SECURITY_SECTION_ENABLED);
    config.anchorPrefix = swagger2MarkupProperties.getString(ANCHOR_PREFIX, null);
    config.overviewDocument = swagger2MarkupProperties.getRequiredString(OVERVIEW_DOCUMENT);
    config.pathsDocument = swagger2MarkupProperties.getRequiredString(PATHS_DOCUMENT);
    config.definitionsDocument = swagger2MarkupProperties.getRequiredString(DEFINITIONS_DOCUMENT);
    config.securityDocument = swagger2MarkupProperties.getRequiredString(SECURITY_DOCUMENT);
    config.separatedOperationsFolder = swagger2MarkupProperties.getRequiredString(SEPARATED_OPERATIONS_FOLDER);
    config.separatedDefinitionsFolder = swagger2MarkupProperties
            .getRequiredString(SEPARATED_DEFINITIONS_FOLDER);
    config.tagOrderBy = swagger2MarkupProperties.getOrderBy(TAG_ORDER_BY);
    config.operationOrderBy = swagger2MarkupProperties.getOrderBy(OPERATION_ORDER_BY);
    config.definitionOrderBy = swagger2MarkupProperties.getOrderBy(DEFINITION_ORDER_BY);
    config.parameterOrderBy = swagger2MarkupProperties.getOrderBy(PARAMETER_ORDER_BY);
    config.propertyOrderBy = swagger2MarkupProperties.getOrderBy(PROPERTY_ORDER_BY);
    config.responseOrderBy = swagger2MarkupProperties.getOrderBy(RESPONSE_ORDER_BY);
    Optional<String> lineSeparator = swagger2MarkupProperties.getString(LINE_SEPARATOR);
    if (lineSeparator.isPresent() && StringUtils.isNoneBlank(lineSeparator.get())) {
        config.lineSeparator = LineSeparator.valueOf(lineSeparator.get());
    }/*from ww w  .  j  av a 2s  . c  o  m*/

    config.pageBreakLocations = swagger2MarkupProperties.getPageBreakLocations(PAGE_BREAK_LOCATIONS);

    Optional<Pattern> headerPattern = swagger2MarkupProperties.getHeaderPattern(HEADER_REGEX);

    config.headerPattern = headerPattern.orElse(null);

    Configuration swagger2markupConfiguration = compositeConfiguration.subset(PROPERTIES_PREFIX);
    Configuration extensionsConfiguration = swagger2markupConfiguration.subset(EXTENSION_PREFIX);
    config.extensionsProperties = new Swagger2MarkupProperties(extensionsConfiguration);
}

From source file:com.zy.broker.dao.BrokerExtInfoDaoImpl.java

@Override
@SuppressWarnings("unchecked")
public PageModel<BrokerExtInfo> queryForPage(BrokerExtInfoDto queryDto, PageModel<BrokerExtInfo> pageModal) {
    StringBuilder hql = new StringBuilder("select l from BrokerExtInfo l where 1=1 ");
    Map<String, Object> params = new HashMap<String, Object>();

    if (StringUtils.isNotBlank(queryDto.getBkName())) {
        hql.append(" and ( l.cnName like :brokerName or l.enName like :brokerName )");
        params.put("brokerName", "%" + queryDto.getBkName() + "%");
    }/* w  w w. j  av  a  2 s  .  co  m*/

    if (StringUtils.isNotBlank(queryDto.getCnName())) {
        hql.append(" and l.cnName like :cnName ");
        params.put("cnName", "%" + queryDto.getCnName() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getEnName())) {
        hql.append(" and l.enName like :enName ");
        params.put("enName", "%" + queryDto.getEnName() + "%");
    }

    slider2Hql(queryDto, hql, params);

    if (StringUtils.isNotBlank(queryDto.getProductType())) {
        slider1Hql(queryDto, hql, params);
        slider3Hql(queryDto, hql, params);
    }

    if (StringUtils.isNotBlank(queryDto.getIsUnionpay())) {
        hql.append(" and l.isUnionpay = :isUnionpay ");
        params.put("isUnionpay", queryDto.getIsUnionpay());
    }
    if (StringUtils.isNotBlank(queryDto.getIsInOutFree())) {
        hql.append(" and l.isInOutFree = :isInOutFree ");
        params.put("isInOutFree", queryDto.getIsInOutFree());
    }

    //??
    if (StringUtils.isNotBlank(queryDto.getExchangeNo1())) {
        hql.append(" and l.exchangeNo1 like :exchangeNo1 ");
        params.put("exchangeNo1", "%" + queryDto.getExchangeNo1() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getExchangeNo2())) {
        hql.append(" and l.exchangeNo2 like :exchangeNo2 ");
        params.put("exchangeNo2", "%" + queryDto.getExchangeNo2() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getExchangeNo3())) {
        hql.append(" and l.exchangeNo3 like :exchangeNo3 ");
        params.put("exchangeNo3", "%" + queryDto.getExchangeNo3() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getExchangeNo4())) {
        hql.append(" and l.exchangeNo4 like :exchangeNo4 ");
        params.put("exchangeNo4", "%" + queryDto.getExchangeNo4() + "%");
    }

    //?
    if (StringUtils.isNotBlank(queryDto.getExTypeP())) {

        if ("0".equals(queryDto.getExTypeP())) {
            hql.append(" and l.exchangeNo1 is not null and l.exchangeNo1 is not empty ");
        }
        if ("1".equals(queryDto.getExTypeP())) {
            hql.append(" and l.exchangeNo2 is not null and l.exchangeNo2 is not empty ");
        }
        if ("2".equals(queryDto.getExTypeP())) {
            hql.append(" and l.exchangeNo3 is not null and l.exchangeNo3 is not empty ");
        }
        if ("3".equals(queryDto.getExTypeP())) {
            hql.append(" and l.exchangeNo4 is not null and l.exchangeNo4 is not empty ");
        }
    }

    if (StringUtils.isNotBlank(queryDto.getPlatform())) {
        hql.append(" and l.platform like :platform ");
        params.put("platform", "%" + queryDto.getPlatform() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getIsShowUrl())) {
        hql.append(" and l.isShowUrl = :isShowUrl ");
        params.put("isShowUrl", queryDto.getIsShowUrl());
    }
    if (StringUtils.isNotBlank(queryDto.getLicenseType())) {
        hql.append(" and l.licenseType = :licenseType ");
        params.put("licenseType", queryDto.getLicenseType());
    }
    if (StringUtils.isNotBlank(queryDto.getCompanyArea())) {
        hql.append(" and l.companyArea = :companyArea ");
        params.put("companyArea", queryDto.getCompanyArea());
    }
    if (StringUtils.isNotBlank(queryDto.getCompanyType())) {
        hql.append(" and l.companyType like :companyType ");
        params.put("companyType", "%" + queryDto.getCompanyType() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getProductType())) {
        hql.append(" and l.productType like :productType ");
        params.put("productType", "%" + queryDto.getProductType() + "%");
    }
    if (StringUtils.isNotBlank(queryDto.getIsEaSupport())) {
        hql.append(" and l.isEaSupport = :isEaSupport ");
        params.put("isEaSupport", queryDto.getIsEaSupport());
    }
    if (StringUtils.isNotBlank(queryDto.getIsOpenFee())) {
        hql.append(" and l.isOpenFee = :isOpenFee ");
        params.put("isOpenFee", queryDto.getIsOpenFee());
    }
    if (StringUtils.isNotBlank(queryDto.getIsCloseFee())) {
        hql.append(" and l.isCloseFee = :isCloseFee ");
        params.put("isCloseFee", queryDto.getIsCloseFee());
    }

    if (queryDto.getDeleteFlag() != null) {
        hql.append(" and l.deleteFlag = :deleteFlag ");
        params.put("deleteFlag", queryDto.getDeleteFlag());
    }

    if (StringUtils.isNoneBlank(queryDto.getOrderP())) {
        hql.append(" order by :orderByParam ");
        params.put("orderByParam", queryDto.getOrderP());
        if (StringUtils.isNotBlank(queryDto.getOrderD())) {
            hql.append(queryDto.getOrderD());
        }
    } else {
        hql.append(" order by l.updateDate desc ");
    }

    return this.queryForPageWithParams(hql.toString(), params, pageModal.getCurrentPage(),
            pageModal.getPageSize());
}

From source file:com.quancheng.saluki.boot.runner.GrpcServiceRunner.java

private String getGroup(SalukiService service) {
    if (StringUtils.isNoneBlank(service.group())) {
        return service.group();
    } else {/*from w  w w. ja v a2  s. c o  m*/
        String group = thrallProperties.getGroup();
        if (StringUtils.isBlank(group)) {
            throw new java.lang.IllegalArgumentException("group can not be null or empty");
        }
        return group;
    }
}

From source file:com.hbc.api.fund.biz.service.MISFundWithdrawService.java

@Transactional
public String tryToTransfer(List<TransInfo> batchTransferList, Double totalAmount, Date transTime, String optId,
        String optName, String pattern) {
    if (batchTransferList == null || batchTransferList.size() <= 0) {
        return "";
    }//from  w ww. j av a  2  s. c o m

    logger.info("??|??->{} ?->{}", batchTransferList, totalAmount);
    String batchNo = IDGenerotor.generateFundWithDrawNo();
    Iterator<TransInfo> transInfoIterator = batchTransferList.iterator();
    while (transInfoIterator.hasNext()) {
        TransInfo transInfo = transInfoIterator.next();
        // TODO ????
        FundWithdrawPaymentExample example = new FundWithdrawPaymentExample();
        example.createCriteria().andDrawNoEqualTo(transInfo.getTransNo());
        List<FundWithdrawPayment> payments = fundWithdrawPaymentMapper.selectByExample(example);
        if (payments != null && payments.size() > 0) {
            Iterator<FundWithdrawPayment> paymentsIterator = payments.iterator();
            while (paymentsIterator.hasNext()) {
                FundWithdrawPayment fundWithdrawPayment = paymentsIterator.next();
                // ? 0? | 1?? | 2? | 3
                Integer transStatus = fundWithdrawPayment.getTransferStatus();
                if (transStatus == FundDrawPaymentStatus.PAYMENT_SUCCESS.value) {
                    throw new FundException(FundReturnCodeEnum.ERR_UPDATE,
                            "??[" + fundWithdrawPayment.getDrawNo() + "] ????.");
                }
            }
        }

        FundWithdrawPayment payment = new FundWithdrawPayment();
        String paymentId = IDGenerotor.generatePaymentId();
        Date currentDate = new Date();
        payment.setPaymentId(paymentId);
        payment.setBatchNo(batchNo);
        payment.setDrawNo(transInfo.getTransNo());
        payment.setCreateTime(currentDate);
        payment.setGuideId(transInfo.getGuideId() == null ? "" : transInfo.getGuideId());
        payment.setOperatorId(optId);
        payment.setOperatorName(optName);
        payment.setPayeeAccount(transInfo.getPayeeAccount());
        payment.setPayeeName(transInfo.getPayeeName());
        payment.setPayerAccount(alipayConfig.sellerEmail);
        payment.setPaymentMethod(FundBankCardType.ALIPAY.value);
        payment.setActualAmount(transInfo.getActualAmount());
        payment.setTransferAmount(transInfo.getTransAmount());
        payment.setTransferDatetime(transTime);
        payment.setTransferStatus(FundDrawPaymentStatus.PAYMENT_INIT.value);
        final String remark = "[" + currentDate + "] - ?[" + optId + "(" + optName + ")"
                + "] ??(?):[" + transInfo.getActualAmount() + "]:["
                + transInfo.getPayeeAccount() + "],?:[" + batchNo + "],??:["
                + transInfo.getTransNo() + "]";
        payment.setRemark(remark);
        logger.info("??|??-> {}", payment);
        fundWithdrawPaymentMapper.insert(payment);

        FundWithdrawal fundWithdrawal = fundWithdrawMapper.selectByPrimaryKey(transInfo.getTransNo());
        if (fundWithdrawal == null) {
            logger.error("?? {} ???", transInfo.getTransNo());
            throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "???");
        }

        Integer oldDrawStatus = fundWithdrawal.getDrawStatus();
        if (oldDrawStatus == FundDrawStatus.AUTO_WITHDRAW_APPLIED.value) {
            logger.error("??|?");
            throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "?");
        }

        FundWithdrawalExample criteria = new FundWithdrawalExample();
        criteria.createCriteria().andDrawNoEqualTo(transInfo.getTransNo());
        fundWithdrawal.setDrawStatus(FundDrawStatus.AUTO_WITHDRAW_APPLIED.value);
        fundWithdrawal.setUpdateTime(currentDate);
        fundWithdrawal.setAccount(transInfo.getActualAccount());
        fundWithdrawal.setDrawComment(
                StringUtils.isNoneBlank(fundWithdrawal.getDrawComment()) ? fundWithdrawal.getDrawComment()
                        : "" + "->" + transInfo.getActualRemark() + "BY:" + optId + " " + optName);
        logger.info("??|??-> {} | ??: {} -> {}", fundWithdrawal,
                FundDrawStatus.getStatus(oldDrawStatus),
                FundDrawStatus.getStatus(fundWithdrawal.getDrawStatus()));
        fundWithdrawMapper.updateByExampleSelective(fundWithdrawal, criteria);
    }

    String aliDate = DateFormatUtils.format(transTime, pattern);
    String returnUrl = gAliTransPayService.getFundTransferUrl(batchNo, batchTransferList, totalAmount, aliDate);
    return returnUrl;
}

From source file:com.quancheng.saluki.boot.runner.GrpcServiceRunner.java

private String getVersion(SalukiService service) {
    if (StringUtils.isNoneBlank(service.version())) {
        return service.version();
    } else {//from ww  w. j  av a 2 s  .c o  m
        String version = thrallProperties.getVersion();
        if (StringUtils.isBlank(version)) {
            throw new java.lang.IllegalArgumentException("version can not be null or empty");
        }
        return version;
    }
}

From source file:aiai.ai.station.TaskProcessor.java

public void fixedDelay() {
    if (globals.isUnitTesting) {
        return;/*from   ww w.  ja  v  a  2 s. co m*/
    }
    if (!globals.isStationEnabled) {
        return;
    }
    if (!globals.timePeriods.isCurrentTimeActive()) {
        return;
    }

    File snippetDir = SnippetUtils.checkEvironment(globals.stationDir);
    if (snippetDir == null) {
        return;
    }

    List<StationTask> tasks = stationTaskService.findAllByFinishedOnIsNull();
    for (StationTask task : tasks) {
        if (StringUtils.isBlank(task.getParams())) {
            log.warn("Params for task {} is blank", task.getTaskId());
            continue;
        }
        if (!currentExecState.isStarted(task.flowInstanceId)) {
            continue;
        }
        File taskDir = stationTaskService.prepareTaskDir(task.taskId);

        final TaskParamYaml taskParamYaml = taskParamYamlUtils.toTaskYaml(task.getParams());
        boolean isResourcesOk = true;
        for (String resourceCode : CollectionUtils.toPlainList(taskParamYaml.inputResourceCodes.values())) {
            AssetFile assetFile = StationResourceUtils.prepareResourceFile(taskDir, Enums.BinaryDataType.DATA,
                    resourceCode, null);
            // is this resource prepared?
            if (assetFile.isError || !assetFile.isContent) {
                log.info("Resource hasn't been prepared yet, {}", assetFile);
                isResourcesOk = false;
            }
        }
        if (!isResourcesOk) {
            continue;
        }

        if (taskParamYaml.snippet == null) {
            stationTaskService.finishAndWriteToLog(task, "Broken task. Snippet isn't defined");
            continue;
        }

        File artifactDir = stationTaskService.prepareTaskSubDir(taskDir, "artifacts");
        if (artifactDir == null) {
            stationTaskService.finishAndWriteToLog(task,
                    "Error of configuring of environment. 'artifacts' directory wasn't created, task can't be processed.");
            continue;
        }

        // at this point all required resources have to be downloaded from server

        taskParamYaml.workingPath = taskDir.getAbsolutePath();
        final String params = taskParamYamlUtils.toString(taskParamYaml);

        task.setLaunchedOn(System.currentTimeMillis());
        task = stationTaskService.save(task);
        SimpleSnippet snippet = taskParamYaml.getSnippet();

        AssetFile snippetAssetFile = null;
        if (!snippet.fileProvided) {
            snippetAssetFile = getResource(Enums.BinaryDataType.SNIPPET, snippet.code);
            if (snippetAssetFile == null) {
                snippetAssetFile = StationResourceUtils.prepareResourceFile(globals.stationResourcesDir,
                        Enums.BinaryDataType.SNIPPET, snippet.code, snippet.filename);
                // is this snippet prepared?
                if (snippetAssetFile.isError || !snippetAssetFile.isContent) {
                    log.info("Resource hasn't been prepared yet, {}", snippetAssetFile);
                    isResourcesOk = false;
                } else {
                    putResource(Enums.BinaryDataType.SNIPPET, snippet.code, snippetAssetFile);
                }
            }
            if (!isResourcesOk || snippetAssetFile == null) {
                continue;
            }
        }

        final File paramFile = prepareParamFile(taskDir, Consts.ARTIFACTS_DIR, params);
        if (paramFile == null) {
            break;
        }
        Interpreter interpreter = new Interpreter(stationService.getEnvYaml().getEnvs().get(snippet.env));
        if (interpreter.list == null) {
            log.warn("Can't process the task, the interpreter wasn't found for env: {}", snippet.env);
            break;
        }

        log.info("all system are checked, lift off");

        ExecProcessService.Result result = null;
        try {
            List<String> cmd = Arrays.stream(interpreter.list).collect(Collectors.toList());

            // bug in IDEA with analyzing !snippet.fileProvided, so we have to add '&& snippetAssetFile!=null'
            if (!snippet.fileProvided && snippetAssetFile != null) {
                cmd.add(snippetAssetFile.file.getAbsolutePath());
            }
            if (StringUtils.isNoneBlank(snippet.params)) {
                cmd.addAll(Arrays.stream(StringUtils.split(snippet.params)).collect(Collectors.toList()));
            }
            cmd.add(Consts.ARTIFACTS_DIR + File.separatorChar + Consts.PARAMS_YAML);

            File consoleLogFile = new File(artifactDir, Consts.SYSTEM_CONSOLE_OUTPUT_FILE_NAME);

            // Exec snippet
            result = execProcessService.execCommand(cmd, taskDir, consoleLogFile);

            // Store result
            stationTaskService.storeExecResult(task.getTaskId(), snippet, result, artifactDir);

            if (result.isOk()) {
                File resultDataFile = new File(taskDir,
                        Consts.ARTIFACTS_DIR + File.separatorChar + taskParamYaml.outputResourceCode);
                if (resultDataFile.exists()) {
                    log.info("Register task for uploading result data to server, resultDataFile: {}",
                            resultDataFile.getPath());
                    uploadResourceActor.add(new UploadResourceTask(resultDataFile, task.taskId));
                } else {
                    String es = "Result data file doesn't exist, resultDataFile: " + resultDataFile.getPath();
                    log.error(es);
                    result = new ExecProcessService.Result(false, -1, es);
                }
            }
        } catch (Throwable th) {
            log.error("Error exec process " + interpreter, th);
            result = new ExecProcessService.Result(false, -1, ExceptionUtils.getStackTrace(th));
        }
        stationTaskService.markAsFinishedIfAllOk(task.getTaskId(), result);
    }
}

From source file:com.flipkart.polyguice.dropwiz.PolyguiceApp.java

private void registerServlet(Class<?> type, Environment env) {
    LOGGER.debug("registering servlet: {}", type.getName());
    WebServlet ann = type.getAnnotation(WebServlet.class);
    String srvName = ann.name();//from w  w  w .j  a va 2s . c o  m
    if (StringUtils.isBlank(srvName)) {
        LOGGER.error("servlet {}: name could not be blank", type.getName());
        return;
    }
    String[] paths = ann.urlPatterns();
    if (paths == null || paths.length == 0) {
        paths = ann.value();
        if (paths == null || paths.length == 0) {
            LOGGER.error("url patterns missing for servlet {}", type.getName());
            return;
        }
    }
    int losu = ann.loadOnStartup();
    Servlet servlet = null;
    try {
        servlet = (Servlet) type.newInstance();
        polyguice.getComponentContext().inject(servlet);
    } catch (Exception exep) {
        LOGGER.error("error creating servlet {}", type.getName());
        return;
    }
    ServletRegistration.Dynamic dynamic = env.servlets().addServlet(srvName, servlet);
    dynamic.addMapping(paths);
    dynamic.setLoadOnStartup(losu);
    if (ann.initParams() == null) {
        return;
    }
    for (WebInitParam param : ann.initParams()) {
        String name = param.name();
        String value = param.value();
        if (StringUtils.isNoneBlank(name)) {
            dynamic.setInitParameter(name, value);
        }
    }
}

From source file:com.ottogroup.bi.spqr.node.server.SPQRNodeServer.java

/**
 * Initializes the log4j framework by pointing it to the configuration file referenced by parameter
 * @param log4jConfigurationFile/* ww w. j av a 2  s . c  o  m*/
 */
protected void initializeLog4j(final String log4jConfigurationFile) {
    String log4jPropertiesFile = StringUtils.lowerCase(StringUtils.trim(log4jConfigurationFile));
    if (StringUtils.isNoneBlank(log4jConfigurationFile)) {
        File log4jFile = new File(log4jPropertiesFile);
        if (log4jFile.isFile()) {
            try {
                PropertyConfigurator.configure(new FileInputStream(log4jFile));
            } catch (FileNotFoundException e) {
                System.out.println("No log4j configuration found at '" + log4jConfigurationFile + "'");
            }
        } else {
            System.out.println("No log4j configuration found at '" + log4jConfigurationFile + "'");
        }
    } else {
        System.out.println("No log4j configuration file provided");
    }
}

From source file:cn.afterturn.easypoi.excel.imports.CellValueService.java

/**
 * ?cell//w  w  w  .  j  a va  2s  .c  o  m
 *
 * @param object
 * @param cell
 * @param excelParams
 * @param titleString
 * @param dictHandler
 */
public Object getValue(IExcelDataHandler<?> dataHandler, Object object, Object cell,
        Map<String, ExcelImportEntity> excelParams, String titleString, IExcelDictHandler dictHandler)
        throws Exception {

    ExcelImportEntity entity = excelParams.get(titleString);
    String classFullName = "class java.lang.Object";
    Class clazz = null;
    if (!(object instanceof Map)) {
        Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0
                ? entity.getMethods().get(entity.getMethods().size() - 1)
                : entity.getMethod();
        Type[] ts = setMethod.getGenericParameterTypes();
        classFullName = ts[0].toString();
        clazz = (Class) ts[0];
    }
    Object result = null;
    if (cell instanceof Cell) {
        result = getCellValue(classFullName, (Cell) cell, entity);
    } else {
        result = cell;
    }
    if (entity != null) {
        result = handlerSuffix(entity.getSuffix(), result);
        result = replaceValue(entity.getReplace(), result);
        result = replaceValue(entity.getReplace(), result);
        if (dictHandler != null && StringUtils.isNoneBlank(entity.getDict())) {
            result = dictHandler.toValue(entity.getDict(), object, entity.getName(), result);
        }
    }
    result = handlerValue(dataHandler, object, result, titleString);
    return getValueByType(classFullName, result, entity, clazz);
}

From source file:com.quancheng.saluki.boot.runner.GrpcReferenceRunner.java

private String getGroup(SalukiReference reference, String serviceName, Class<?> referenceClass) {
    Pair<String, String> groupVersion = findGroupAndVersionByServiceName(serviceName);
    if (StringUtils.isNoneBlank(reference.group())) {
        return reference.group();
    } else if (StringUtils.isNoneBlank(groupVersion.getLeft())) {
        String replaceGroup = groupVersion.getLeft();
        Matcher matcher = REPLACE_PATTERN.matcher(replaceGroup);
        if (matcher.find()) {
            String replace = matcher.group().substring(2, matcher.group().length() - 1).trim();
            String[] replaces = StringUtils.split(replace, ":");
            if (replaces.length == 2) {
                String realGroup = env.getProperty(replaces[0], replaces[1]);
                return realGroup;
            } else {
                throw new IllegalArgumentException("replaces formater is #{XXXgroup:groupName}");
            }//  ww w.  j a v  a2s .  c  o m
        } else {
            return replaceGroup;
        }
    } else if (this.isGenericClient(referenceClass)) {
        return StringUtils.EMPTY;
    }
    throw new java.lang.IllegalArgumentException(
            String.format("reference group can not be null or empty,the servicName is %s", serviceName));

}