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:com.ottogroup.bi.spqr.pipeline.MicroPipelineFactory.java

/**
 * Instantiates, initializes and returns the {@link DelayedResponseOperatorWaitStrategy} configured for the {@link DelayedResponseOperator}
 * whose {@link MicroPipelineComponentConfiguration configuration} is provided when calling this method. 
 * @param delayedResponseOperatorCfg/*  www  .  j  a va2 s  . c o  m*/
 * @return
 */
protected DelayedResponseOperatorWaitStrategy getResponseWaitStrategy(
        final MicroPipelineComponentConfiguration delayedResponseOperatorCfg)
        throws RequiredInputMissingException, UnknownWaitStrategyException {

    /////////////////////////////////////////////////////////////////////////////////////
    // validate input
    if (delayedResponseOperatorCfg == null)
        throw new RequiredInputMissingException("Missing required delayed response operator configuration");
    if (delayedResponseOperatorCfg.getSettings() == null)
        throw new RequiredInputMissingException("Missing required delayed response operator settings");
    String strategyName = StringUtils.lowerCase(StringUtils.trim(delayedResponseOperatorCfg.getSettings()
            .getProperty(DelayedResponseOperator.CFG_WAIT_STRATEGY_NAME)));
    if (StringUtils.isBlank(strategyName))
        throw new RequiredInputMissingException(
                "Missing required strategy name expected as part of operator settings ('"
                        + DelayedResponseOperator.CFG_WAIT_STRATEGY_NAME + "')");
    //
    /////////////////////////////////////////////////////////////////////////////////////

    if (logger.isDebugEnabled())
        logger.debug("Settings provided for strategy '" + strategyName + "'");
    Properties strategyProperties = new Properties();
    for (Enumeration<Object> keyEnumerator = delayedResponseOperatorCfg.getSettings().keys(); keyEnumerator
            .hasMoreElements();) {
        String key = (String) keyEnumerator.nextElement();
        if (StringUtils.startsWith(key, DelayedResponseOperator.CFG_WAIT_STRATEGY_SETTINGS_PREFIX)) {
            String waitStrategyCfgKey = StringUtils.substring(key, StringUtils.lastIndexOf(key, ".") + 1);
            if (StringUtils.isNoneBlank(waitStrategyCfgKey)) {
                String waitStrategyCfgValue = delayedResponseOperatorCfg.getSettings().getProperty(key);
                strategyProperties.put(waitStrategyCfgKey, waitStrategyCfgValue);

                if (logger.isDebugEnabled())
                    logger.debug("\t" + waitStrategyCfgKey + ": " + waitStrategyCfgValue);

            }
        }
    }

    if (StringUtils.equalsIgnoreCase(strategyName, MessageCountResponseWaitStrategy.WAIT_STRATEGY_NAME)) {
        MessageCountResponseWaitStrategy strategy = new MessageCountResponseWaitStrategy();
        strategy.initialize(strategyProperties);
        return strategy;
    } else if (StringUtils.equalsIgnoreCase(strategyName, TimerBasedResponseWaitStrategy.WAIT_STRATEGY_NAME)) {
        TimerBasedResponseWaitStrategy strategy = new TimerBasedResponseWaitStrategy();
        strategy.initialize(strategyProperties);
        return strategy;
    } else if (StringUtils.equalsIgnoreCase(strategyName, OperatorTriggeredWaitStrategy.WAIT_STRATEGY_NAME)) {
        OperatorTriggeredWaitStrategy strategy = new OperatorTriggeredWaitStrategy();
        strategy.initialize(strategyProperties);
        return strategy;
    }

    throw new UnknownWaitStrategyException("Unknown wait strategy '" + strategyName + "'");

}

From source file:io.cloudex.cloud.impl.google.GoogleCloudServiceImpl.java

/**
 * Create VM instances, optionally block until all are created. If any fails then the returned flag is false
 *
 *  body = {//w  ww .  j av a2 s . c o m
'name': NEW_INSTANCE_NAME,
'machineType': &lt;fully-qualified-machine-type-url&gt;,
'networkInterfaces': [{
  'accessConfigs': [{
'type': 'ONE_TO_ONE_NAT',
'name': 'External NAT'
   }],
  'network': &lt;fully-qualified-network-url&gt;
}],
'disk': [{
   'autoDelete': 'true',
   'boot': 'true',
   'type': 'PERSISTENT',
   'initializeParams': {
  'diskName': 'my-root-disk',
  'sourceImage': '&lt;fully-qualified-image-url&gt;',
   }
 }]
}
 * @param configs
 * @param block
 * @throws IOException
 * TODO start VMs in parallel
 */
@Override
public boolean startInstance(List<VmConfig> configs, boolean block) throws IOException {

    for (VmConfig config : configs) {
        log.debug("Creating VM for config: " + config);
        String zoneId = config.getZoneId();
        zoneId = zoneId != null ? zoneId : this.zone;
        Instance content = new Instance();

        // Instance config
        content.setMachineType(
                RESOURCE_BASE_URL + this.projectId + ZONES + zoneId + MACHINE_TYPES + config.getVmType());
        content.setName(config.getInstanceId());
        //content.setZone(zoneId);
        // startup script
        if (StringUtils.isNoneBlank(config.getStartupScript())) {
            config.getMetaData().addValue(GoogleMetaData.STARTUP_SCRIPT, config.getStartupScript());
        }
        content.setMetadata(this.getGoogleMetaData(config.getMetaData()));

        // service account
        ServiceAccount sa = new ServiceAccount();
        sa.setEmail(this.serviceAccount).setScopes(this.scopes);
        content.setServiceAccounts(Lists.newArrayList(sa));

        // network
        NetworkInterface inf = new NetworkInterface();
        inf.setNetwork(RESOURCE_BASE_URL + this.projectId + NETWORK + config.getNetworkId());
        // add ability to turn off external IP addresses
        if (config.getNoExternalIp() == null || Boolean.FALSE.equals(config.getNoExternalIp())) {
            AccessConfig accessConf = new AccessConfig();
            accessConf.setType(ONE_TO_ONE_NAT).setName(EXT_NAT);
            inf.setAccessConfigs(Lists.newArrayList(accessConf));
        }

        content.setNetworkInterfaces(Lists.newArrayList(inf));

        // scheduling
        Scheduling scheduling = new Scheduling();
        scheduling.setAutomaticRestart(false);
        scheduling.setOnHostMaintenance(MIGRATE);
        content.setScheduling(scheduling);

        // Disk
        AttachedDisk disk = new AttachedDisk();

        AttachedDiskInitializeParams params = new AttachedDiskInitializeParams();
        params.setDiskName(config.getInstanceId());
        params.setSourceImage(RESOURCE_BASE_URL + config.getImageId());
        if (config.getDiskSize() != null) {
            params.setDiskSizeGb(config.getDiskSize());
        }

        disk.setAutoDelete(true).setBoot(true).setDeviceName(config.getInstanceId()).setType(PERSISTENT)
                .setInitializeParams(params);

        if (StringUtils.isNotBlank(config.getDiskType())) {
            // standard or SSD based disks
            params.setDiskType(
                    RESOURCE_BASE_URL + this.projectId + ZONES + zoneId + DISK_TYPES + config.getDiskType());
        }

        content.setDisks(Lists.newArrayList(disk));

        Insert insert = this.getCompute().instances().insert(this.projectId, zoneId, content)
                .setOauthToken(this.getOAuthToken());

        Operation operation = insert.execute();
        log.debug("Successuflly initiated operation: " + operation);
    }

    boolean success = true;

    // we have to block until all instances are provisioned
    if (block) {

        for (VmConfig config : configs) {
            String status = InstanceStatus.PROVISIONING.toString();

            int retries = 20;

            do {

                // sleep for some seconds before checking the vm status
                ApiUtils.block(this.getApiRecheckDelay());

                String zoneId = config.getZoneId();
                zoneId = zoneId != null ? zoneId : this.zone;
                // check the instance status
                Instance instance = null;

                // seems the Api sometimes return a not found exception
                try {
                    instance = this.getInstance(config.getInstanceId(), zoneId);
                    status = instance.getStatus();
                    log.debug(config.getInstanceId() + ", current status is: " + status);

                } catch (GoogleJsonResponseException e) {
                    if (e.getMessage().indexOf(NOT_FOUND) == 0) {
                        log.warn("Instance not found: " + config.getInstanceId());
                        if (retries <= 0) {
                            throw e;
                        }
                        retries--;
                        ApiUtils.block(5);

                    } else {
                        throw e;
                    }
                }
                // FIXME INFO: ecarf-evm-1422261030407, current status is: null
            } while (InstanceStatus.IN_PROGRESS.contains(status));

            if (InstanceStatus.TERMINATED.equals(status)) {
                success = false;
            }
        }
    }

    return success;
}

From source file:com.taobao.android.TPatchTool.java

/**
 * ?apkFileList//from  w ww .j ava2s  . com
 *
 * @return
 */
public ApkFileList getNewApkFileList() {
    String newApkFileListStr = null;
    try {
        if (null != newApkFileList && newApkFileList.exists()) {
            newApkFileListStr = FileUtils.readFileToString(newApkFileList);
            if (StringUtils.isNoneBlank(newApkFileListStr)) {
                return JSON.parseObject(newApkFileListStr, ApkFileList.class);
            }
        }
    } catch (IOException e) {
    }

    return null;
}

From source file:com.taobao.android.TPatchTool.java

/**
 * ?apkFileList/* ww  w .j av  a  2  s .  com*/
 *
 * @return
 */
public ApkFileList getBaseApkFileList() {
    String baseApkFileListStr = null;
    try {
        if (null != baseApkFileList && baseApkFileList.exists()) {
            baseApkFileListStr = FileUtils.readFileToString(baseApkFileList);
            if (StringUtils.isNoneBlank(baseApkFileListStr)) {
                return JSON.parseObject(baseApkFileListStr, ApkFileList.class);
            }
        }
    } catch (IOException e) {
    }

    return null;
}

From source file:fi.foyt.fni.materials.MaterialController.java

private FileData getCharacterSheetMaterialData(String contextPath, CharacterSheet characterSheet)
        throws UnsupportedEncodingException {
    StringBuilder htmlBuilder = new StringBuilder();
    htmlBuilder.append("<!DOCTYPE html>");
    htmlBuilder.append("<html>");
    htmlBuilder.append("<head>");
    htmlBuilder.append("<meta charset=\"UTF-8\">");

    htmlBuilder.append(/*from  w  w w  .  ja  va 2  s  . c o m*/
            "<script type=\"text/javascript\" charset=\"utf8\" src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>");
    htmlBuilder.append(
            "<script type=\"text/javascript\" charset=\"utf8\" src=\"//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js\"></script>");
    htmlBuilder.append(
            "<script type=\"text/javascript\" charset=\"utf8\" src=\"//cdnjs.cloudflare.com/ajax/libs/Base64/0.3.0/base64.min.js\"></script>");
    htmlBuilder.append(
            "<link rel=\"StyleSheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.4/css/jquery-ui.min.css\"></link>");
    htmlBuilder.append("<script type=\"text/javascript\" charset=\"utf8\" src=\"" + contextPath
            + "/scripts/gui/character-sheet.js\"></script>");

    if (StringUtils.isNotBlank(characterSheet.getTitle())) {
        htmlBuilder.append("<title>");
        htmlBuilder.append(StringEscapeUtils.escapeHtml4(characterSheet.getTitle()));
        htmlBuilder.append("</title>");
    }

    if (StringUtils.isNoneBlank(characterSheet.getStyles())) {
        htmlBuilder.append("<style type=\"text/css\">");
        htmlBuilder.append(characterSheet.getStyles());
        htmlBuilder.append("</style>");
    }

    if (StringUtils.isNoneBlank(characterSheet.getScripts())) {
        htmlBuilder.append("<script type=\"text/javascript\">");
        htmlBuilder.append(characterSheet.getScripts());
        htmlBuilder.append("</script>");
    }

    htmlBuilder.append("</head>");
    htmlBuilder.append("<body>");
    htmlBuilder.append(characterSheet.getContents());
    htmlBuilder.append("</body>");
    htmlBuilder.append("</html>");

    return new FileData(null, characterSheet.getUrlName(), htmlBuilder.toString().getBytes("UTF-8"),
            "text/html", characterSheet.getModified());
}

From source file:com.ihandy.quote_core.service.impl.picc.RBServiceImpl.java

@Override
public HebaoResponse getHebaoResponse(String licenseNo) {
    HebaoResponse response = new HebaoResponse();
    //???//from w w w .j  a  v  a  2 s. c o  m
    Map<String, String> noMap = CacheConstant.proposalNoInfo.get(licenseNo);
    String biNo = noMap.get("biNo");//???
    String ciNo = noMap.get("ciNo");//???
    HebaoSearchQueryUndwrtMsgPage hebaoSearchQueryUndwrtMsgPage = new HebaoSearchQueryUndwrtMsgPage(1);
    Request request3 = new Request();
    Map request3ParamMap = new HashMap();
    request3.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSEARCHUNDWRTMSG);
    request3ParamMap.put("bizType", "PROPOSAL");
    request3ParamMap.put("bizNo", biNo);
    request3.setRequestParam(request3ParamMap);
    Response response3 = new Response();
    Map<String, String> biMap = new HashMap<>();//
    Map<String, String> ciMap = new HashMap<>();//
    // 
    if (StringUtils.isNoneBlank(biNo)) {
        response3 = hebaoSearchQueryUndwrtMsgPage.run(request3);
        biMap = (Map) response3.getResponseMap().get("nextParams");
    }
    request3ParamMap.remove("bizNo");
    request3ParamMap.put("bizNoCI", ciNo);
    // 
    if (StringUtils.isNoneBlank(ciNo)) {
        response3 = hebaoSearchQueryUndwrtMsgPage.run(request3);
        ciMap = (Map) response3.getResponseMap().get("nextParams");
    }
    response.setSource(2);//?
    response.setBizNo(biNo);
    response.setForceNo(ciNo);
    if (!biMap.isEmpty()) {//?
        String msg = biMap.get("msg");
        logger.info("?API???licenseNo" + licenseNo + "biNo"
                + biNo + "msg" + msg);
        if (msg.contains("?") || msg.contains("??") || msg.contains("")
                || msg.contains("?")) {//
            response.setSubmitStatus(0);
            response.setSubmitResult(msg);
            return response;
        }
    }
    if (!ciMap.isEmpty()) {//?
        String msg = ciMap.get("msg");
        logger.info("?API???licenseNo" + licenseNo + "ciNo"
                + ciNo + "msg" + msg);
        if (msg.contains("?") || msg.contains("??") || msg.contains("")
                || msg.contains("?")) {//
            response.setSubmitStatus(0);
            response.setSubmitResult(msg);
            return response;
        }
    }
    if (biMap.isEmpty() && ciMap.isEmpty()) {//
        response.setSubmitStatus(3);
        response.setSubmitResult("?");
        return response;
    }
    response.setSubmitStatus(1);
    response.setSubmitResult("??");
    return response;
}

From source file:com.ihandy.quote_core.service.impl.picc.QuoteThreadPicc.java

/**
 * ?????/*from ww w  . ja va  2s. c om*/
 * @param quoteParam
 * @param param3
 * @param owner
 * @param id
 * @param mobile
 * @return
 */
private String makeQuoteInsuredInfoParam(Map<String, String> quoteParam, String param3, String owner, String id,
        String mobile) {
    //?
    if (StringUtils.isBlank(id) && StringUtils.isNoneBlank(owner)) {
        QuoteGetUserInfoByNamePage quoteGetUserInfoByNamePage = new QuoteGetUserInfoByNamePage(1);
        Request request = new Request();
        request.setUrl(
                "http://10.134.136.48:8300/cif/customperson/findCustomPersonIntf.do?pageSize=10&pageNo=1");
        Map<String, String> param = new HashMap<>();
        param.put("name", owner);
        request.setRequestParam(param);
        Response response = quoteGetUserInfoByNamePage.run(request);
        Map<String, String> result = response.getResponseMap();
        id = result.get("identifyNumber");
        mobile = result.get("customMobile");
    }
    try {
        owner = java.net.URLEncoder.encode(owner, "gb2312");
    } catch (Exception e) {
        logger.error("? API?????" + e.getMessage());
    }
    //
    if (StringUtils.isNoneBlank(owner)) {//?
        param3 = param3.replace("prpCinsureds%5B0%5D.insuredName=", "prpCinsureds%5B0%5D.insuredName=" + owner);//??
        param3 = param3.replace("prpCinsureds%5B0%5D.identifyType=", "prpCinsureds%5B0%5D.identifyType=01");//?
        param3 = param3.replace("prpCinsureds%5B0%5D.identifyNumber=",
                "prpCinsureds%5B0%5D.identifyNumber=" + id);//???
        param3 = param3.replace("prpCinsureds%5B0%5D.phoneNumber=",
                "prpCinsureds%5B0%5D.phoneNumber=" + mobile);//
        param3 = param3.replace("prpCinsureds%5B0%5D.mobile=", "prpCinsureds%5B0%5D.mobile=" + mobile);//
    }

    String InsuredName = quoteParam.get("InsuredName");
    String InsuredIdCard = quoteParam.get("InsuredIdCard");
    String InsuredIdType = quoteParam.get("InsuredIdType");
    String InsuredMobile = quoteParam.get("InsuredMobile");
    if (StringUtils.isBlank(InsuredName)) {// ?????
        // ?\?
        param3 = param3.replace("prpCinsureds%5B1%5D.insuredName=", "prpCinsureds%5B1%5D.insuredName=" + owner);// ??
        param3 = param3.replace("prpCinsureds%5B1%5D.identifyType=", "prpCinsureds%5B1%5D.identifyType=01");// ?
        param3 = param3.replace("prpCinsureds%5B1%5D.identifyNumber=",
                "prpCinsureds%5B1%5D.identifyNumber=" + id);// ???
        param3 = param3.replace("prpCinsureds%5B1%5D.phoneNumber=",
                "prpCinsureds%5B1%5D.phoneNumber=" + mobile);// 
        param3 = param3.replace("prpCinsureds%5B1%5D.mobile=", "prpCinsureds%5B1%5D.mobile=" + mobile);// 
    } else {
        // ?\?
        try {
            InsuredName = java.net.URLEncoder.encode(InsuredName, "gb2312");
        } catch (Exception e) {
            e.printStackTrace();
        }
        param3 = param3.replace("prpCinsureds%5B1%5D.insuredName=",
                "prpCinsureds%5B1%5D.insuredName=" + InsuredName);// ??
        param3 = param3.replace("prpCinsureds%5B1%5D.identifyType=", "prpCinsureds%5B1%5D.identifyType=01");// ?
        param3 = param3.replace("prpCinsureds%5B1%5D.identifyNumber=",
                "prpCinsureds%5B1%5D.identifyNumber=" + InsuredIdCard);// ???
        param3 = param3.replace("prpCinsureds%5B1%5D.phoneNumber=",
                "prpCinsureds%5B1%5D.phoneNumber=" + InsuredMobile);// 
        param3 = param3.replace("prpCinsureds%5B1%5D.mobile=", "prpCinsureds%5B1%5D.mobile=" + InsuredMobile);// 

        if (StringUtils.isBlank(owner)) {
            param3 = param3.replace("prpCinsureds%5B0%5D.insuredName=",
                    "prpCinsureds%5B0%5D.insuredName=" + InsuredName);//??
            param3 = param3.replace("prpCinsureds%5B0%5D.identifyType=", "prpCinsureds%5B0%5D.identifyType=01");//?
            param3 = param3.replace("prpCinsureds%5B0%5D.identifyNumber=",
                    "prpCinsureds%5B0%5D.identifyNumber=" + InsuredIdCard);//???
            param3 = param3.replace("prpCinsureds%5B0%5D.phoneNumber=",
                    "prpCinsureds%5B0%5D.phoneNumber=" + InsuredMobile);//
            param3 = param3.replace("prpCinsureds%5B0%5D.mobile=",
                    "prpCinsureds%5B0%5D.mobile=" + InsuredMobile);//
        }

    }
    return param3;
}

From source file:com.ihandy.quote_core.service.impl.picc.QuoteThreadPicc.java

/**
 * ???/*w  ww  . jav a  2  s  . c  o  m*/
 * @param url
 * @return
 */
public String commitHeBaoInfo(String url, String LicenseNo) {
    String code = "";
    String DAAno = "";
    String DZAno = "";
    Response response = new Response();
    HebaoCalAnciInfoPage hebaoCalAnciInfoPage = new HebaoCalAnciInfoPage(1);
    Request request = new Request();
    //?
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    url = url.replace("2016-05-23", sdf.format(new Date()));
    Map preMap = new HashMap();
    preMap.put("nextParams", url);
    request.setRequestParam(preMap);//
    request.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_CALANCIINFO);// GET
    Response responseHebaoCalAnciInfo = hebaoCalAnciInfoPage.run(request);
    if (responseHebaoCalAnciInfo.getReturnCode() == SysConfigInfo.SUCCESS200) {
        Map nextParamsMap = responseHebaoCalAnciInfo.getResponseMap();
        //?1?
        HebaoSaveCheckEngageTimePage hebaoSaveCheckEngageTimePage = new HebaoSaveCheckEngageTimePage(1);
        Request request1 = new Request();
        request1.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE1);
        request1.setRequestParam(nextParamsMap);
        Response response1 = hebaoSaveCheckEngageTimePage.run(request1);
        //?2?
        HeBaoSaveCheckAgentTypePage heBaoSaveCheckAgentTypePage = new HeBaoSaveCheckAgentTypePage(1);
        Request request2 = new Request();
        request2.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE2);
        request2.setRequestParam(response1.getResponseMap());
        Response response2 = heBaoSaveCheckAgentTypePage.run(request2);
        //?3?
        HebaoSaveQueryPayForPage hebaoSaveQueryPayForPage = new HebaoSaveQueryPayForPage(1);
        Request request3 = new Request();
        request3.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE3);
        request3.setRequestParam((Map) response2.getResponseMap().get("nextParams"));
        Response response3 = hebaoSaveQueryPayForPage.run(request3);
        //?4?
        HebaoSaveRefreshPlanByTimesPage hebaoSaveRefreshPlanByTimesPage = new HebaoSaveRefreshPlanByTimesPage(
                1);
        Request request4 = new Request();
        request4.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE4);
        request4.setRequestParam((Map) response3.getResponseMap().get("nextParams"));
        Response response4 = hebaoSaveRefreshPlanByTimesPage.run(request4);
        //?5?
        HeBaoSaveCheckBeforeSavePage heBaoSaveCheckBeforeSavePage = new HeBaoSaveCheckBeforeSavePage(1);
        Request request5 = new Request();
        request5.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE5);
        request5.setRequestParam((Map) response4.getResponseMap().get("nextParams"));
        Response response5 = heBaoSaveCheckBeforeSavePage.run(request5);
        //?6?
        HebaoSaveInsertPage hebaoSaveInsertPage = new HebaoSaveInsertPage(1);
        Request request6 = new Request();
        request6.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOSAVE6);
        request6.setRequestParam((Map) response4.getResponseMap().get("nextParams"));
        Response response6 = hebaoSaveInsertPage.run(request6);

        //???1?
        HebaoCommitEditCheckFlagPage hebaoCommitEditCheckFlagPage = new HebaoCommitEditCheckFlagPage(1);
        Request requestCommit1 = new Request();
        requestCommit1.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOCOMMIT1);
        requestCommit1.setRequestParam((Map) response6.getResponseMap().get("nextParams"));
        Response responseCommit1 = hebaoCommitEditCheckFlagPage.run(requestCommit1);

        //???2?
        HebaoCommitEditSubmitUndwrtPage hebaoCommitEditSubmitUndwrtPage = new HebaoCommitEditSubmitUndwrtPage(
                1);
        Request requestCommit2 = new Request();
        requestCommit2.setUrl(SysConfigInfo.PICC_DOMIAN + SysConfigInfo.PICC_HEBAOCOMMIT2);
        requestCommit2.setRequestParam((Map) response6.getResponseMap().get("nextParams"));
        Response responseCommit2 = hebaoCommitEditSubmitUndwrtPage.run(requestCommit2);
        //???
        Map mapTDAA = (Map) response6.getResponseMap().get("nextParams");
        DAAno = String.valueOf(mapTDAA.get("TDAA"));
        //????
        DZAno = String.valueOf(mapTDAA.get("TDZA"));
    } else {
        logger.info("????");
    }
    logger.info("?AIP??????" + DAAno
            + "???" + DZAno);
    code = "DAAno = " + DAAno + ",DZAno = " + DZAno;
    //?
    Map<String, String> proposalInfoMap = new HashMap<>();
    if (StringUtils.isNoneBlank(DAAno) && !"null".equals(DAAno)) {
        proposalInfoMap.put("biNo", DAAno);
    }
    if (StringUtils.isNoneBlank(DZAno) && !"null".equals(DZAno)) {
        proposalInfoMap.put("ciNo", DZAno);
    }
    CacheConstant.proposalNoInfo.put(LicenseNo, proposalInfoMap);
    return code;
}

From source file:com.ihandy.quote_core.service.impl.picc.QuoteThreadPicc.java

/**
 * /*from   www.j ava  2  s. c o  m*/
 * @param startDate
 *                 yyyy-MM-dd
 * @param startDateCi
 *                 yyyy-MM-dd
 * @param enrollDate
 *                 yyyy-MM-dd
 * @return
 */
public int calUseYear(String startDateStr, String startDateCiStr, String enrollDateStr) {
    int useYears = 0;
    try {
        String inputDateStr = null;
        if (StringUtils.isNoneBlank(startDateStr)) {
            inputDateStr = startDateStr;
        } else {
            inputDateStr = startDateCiStr;
        }
        int inputYear = Integer.parseInt(inputDateStr.split("-")[0]);
        int inputMonth = Integer.parseInt(inputDateStr.split("-")[1]);
        int inputDay = Integer.parseInt(inputDateStr.split("-")[2]);

        int enrollYear = Integer.parseInt(enrollDateStr.split("-")[0]);
        int enrollMonth = Integer.parseInt(enrollDateStr.split("-")[1]);
        int enrollDay = Integer.parseInt(enrollDateStr.split("-")[2]);

        int useMonth = (inputYear - enrollYear) * 12 + (inputMonth - enrollMonth);//
        if ((inputDay - enrollDay) < 0) {
            useMonth = useMonth - 1;
        }

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date enrollDate = sdf.parse(enrollDateStr);
        Date inputDate = sdf.parse(inputDateStr);

        Date date1 = DateUtils.addDays(enrollDate, 270);
        Date date2 = DateUtils.addDays(enrollDate, 2);
        if (date1.getTime() > inputDate.getTime()) {
            useYears = 0;
        } else {
            if (date2.getTime() > inputDate.getTime()) {
                useYears = 1;
            } else {
                useYears = useMonth / 12;
            }
        }
    } catch (Exception e) {
        logger.info("? API???" + e.getMessage());
    }
    return useYears;
}

From source file:org.alfresco.rm.rest.api.recordcategories.RecordCategoryChildrenRelation.java

@Override
@WebApiDescription(title = "Create one (or more) nodes as children of a record category identified by 'recordCategoryId'")
public List<RecordCategoryChild> create(String recordCategoryId, List<RecordCategoryChild> nodeInfos,
        Parameters parameters) {//  www. j a v  a2 s .  c o m
    checkNotBlank("recordCategoryId", recordCategoryId);
    mandatory("nodeInfos", nodeInfos);
    mandatory("parameters", parameters);

    NodeRef parentNodeRef = apiUtils.lookupAndValidateNodeType(recordCategoryId,
            RecordsManagementModel.TYPE_RECORD_CATEGORY);

    List<RecordCategoryChild> result = new ArrayList<>(nodeInfos.size());
    Map<String, UserInfo> mapUserInfo = new HashMap<>();
    for (RecordCategoryChild nodeInfo : nodeInfos) {
        // Resolve the parent node
        NodeRef nodeParent = parentNodeRef;
        if (StringUtils.isNoneBlank(nodeInfo.getRelativePath())) {
            nodeParent = apiUtils.lookupAndValidateRelativePath(parentNodeRef, nodeInfo.getRelativePath(),
                    RecordsManagementModel.TYPE_RECORD_CATEGORY);
        }

        // Create the node
        NodeRef newNode = apiUtils.createRMNode(nodeParent, nodeInfo.getName(), nodeInfo.getNodeType(),
                nodeInfo.getProperties(), nodeInfo.getAspectNames());
        FileInfo info = fileFolderService.getFileInfo(newNode);
        result.add(nodesModelFactory.createRecordCategoryChild(info, parameters, mapUserInfo, false));
    }

    return result;
}