Search in sources :

Example 6 with SysFtpTranVO

use of com.netsteadfast.greenstep.vo.SysFtpTranVO in project bamboobsc by billchen198318.

the class SystemFtpClientUtils method findSysFtpTran.

public static SysFtpTranVO findSysFtpTran(String tranId) throws ServiceException, Exception {
    SysFtpTranVO tran = new SysFtpTranVO();
    tran.setTranId(tranId);
    DefaultResult<SysFtpTranVO> result = sysFtpTranService.findByUK(tran);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    tran = result.getValue();
    return tran;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFtpTranVO(com.netsteadfast.greenstep.vo.SysFtpTranVO)

Example 7 with SysFtpTranVO

use of com.netsteadfast.greenstep.vo.SysFtpTranVO 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

SysFtpTranVO (com.netsteadfast.greenstep.vo.SysFtpTranVO)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)4 SysFtpVO (com.netsteadfast.greenstep.vo.SysFtpVO)3 File (java.io.File)3 IOException (java.io.IOException)3 SystemFtpClientData (com.netsteadfast.greenstep.model.SystemFtpClientData)2 SystemFtpClientResultObj (com.netsteadfast.greenstep.model.SystemFtpClientResultObj)2 TbSysFtpTranSegm (com.netsteadfast.greenstep.po.hbm.TbSysFtpTranSegm)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Map (java.util.Map)1 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1