Search in sources :

Example 1 with SystemFtpClientResultObj

use of com.netsteadfast.greenstep.model.SystemFtpClientResultObj in project bamboobsc by billchen198318.

the class SystemFtpClientUtils method getFileOnly.

/**
	 * 取出FTP或SFTP上的檔案
	 * 
	 * @param tranId	TB_SYS_FTP_TRAN.TRAN_ID
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
public static SystemFtpClientResultObj getFileOnly(String tranId) throws ServiceException, Exception {
    if (StringUtils.isBlank(tranId)) {
        throw new Exception(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    logger.info("getFileOnly begin...");
    SystemFtpClientResultObj resultObj = new SystemFtpClientResultObj();
    SysFtpTranVO tran = findSysFtpTran(tranId);
    SysFtpVO ftp = findSysFtp(tran.getFtpId());
    List<TbSysFtpTranSegm> segms = findSysFtpTranSegm(tran.getFtpId(), tran.getTranId());
    resultObj.setSysFtp(ftp);
    resultObj.setSysFtpTran(tran);
    resultObj.setSysFtpTranSegms(segms);
    getFiles(resultObj);
    logger.info("getFileOnly end...");
    return resultObj;
}
Also used : TbSysFtpTranSegm(com.netsteadfast.greenstep.po.hbm.TbSysFtpTranSegm) SysFtpTranVO(com.netsteadfast.greenstep.vo.SysFtpTranVO) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SystemFtpClientResultObj(com.netsteadfast.greenstep.model.SystemFtpClientResultObj) SysFtpVO(com.netsteadfast.greenstep.vo.SysFtpVO)

Example 2 with SystemFtpClientResultObj

use of com.netsteadfast.greenstep.model.SystemFtpClientResultObj in project bamboobsc by billchen198318.

the class SystemFtpClientUtils method getDatas.

/**
	 * 取出FTP或SFTP上的檔案, 並將TXT文字檔切割成資料放至map中, XML則只將內容讀取至變數中
	 * 
	 * @param tranId			TB_SYS_FTP_TRAN.TRAN_ID
	 * @param classesToBeBound	將xml轉成Object ( 只有在TRAN_TYPE = 'GET-XML' 才需要 ) 
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
public static SystemFtpClientResultObj getDatas(String tranId) throws ServiceException, Exception {
    logger.info("getDatas begin...");
    SystemFtpClientResultObj resultObj = getFileOnly(tranId);
    SysFtpTranVO tran = resultObj.getSysFtpTran();
    if (SystemFtpClientModel.TRAN_GET_TEXT.equals(tran.getTranType())) {
        // 分割 txt 檔案
        processText(resultObj);
    } else if (SystemFtpClientModel.TRAN_GET_XML.equals(tran.getTranType())) {
        // 處理 xml 檔案			
        processXml(resultObj);
    }
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put(SystemFtpClientModel.RESULT_OBJ_VARIABLE, resultObj);
    ScriptExpressionUtils.execute(tran.getExprType(), tran.getHelpExpression(), null, paramMap);
    logger.info("getDatas end...");
    return resultObj;
}
Also used : HashMap(java.util.HashMap) SysFtpTranVO(com.netsteadfast.greenstep.vo.SysFtpTranVO) SystemFtpClientResultObj(com.netsteadfast.greenstep.model.SystemFtpClientResultObj)

Aggregations

SystemFtpClientResultObj (com.netsteadfast.greenstep.model.SystemFtpClientResultObj)2 SysFtpTranVO (com.netsteadfast.greenstep.vo.SysFtpTranVO)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 TbSysFtpTranSegm (com.netsteadfast.greenstep.po.hbm.TbSysFtpTranSegm)1 SysFtpVO (com.netsteadfast.greenstep.vo.SysFtpVO)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1