String createAppDataForExportOperation(ExchangeContext ctx) { ExportData exportData = new ExportData(); DataRequest dataRequest = new DataRequest(); Date startDate = (Date) ctx.getVariable("startDate"); if (startDate != null) { dataRequest.setStartDate( XmlTypes.dateTimeAndZeroMilliseconds(formatDate(startDate, "dd.MM.yyyy HH:mm:ss"))); } Date endDate = (Date) ctx.getVariable("endDate"); if (endDate != null) { dataRequest.setEndDate( XmlTypes.dateTimeAndZeroMilliseconds(formatDate(endDate, "dd.MM.yyyy HH:mm:ss"))); } exportData.setDataRequest(dataRequest); dataRequest.setKind((String) ctx.getVariable("exportRequestType")); String postBlockSenderIdentifier = (String) ctx.getVariable("postBlockSenderIdentifier"); final PostBlock postBlock = createPostBlock(ctx, postBlockSenderIdentifier); dataRequest.setPostBlock(postBlock); fillSupplierBillIds(ctx, dataRequest); fillApplicationIds(ctx, dataRequest); fillUnifiedPayerIds(ctx, dataRequest); return new XmlTypes(ExportData.class).toXml(exportData); }
private PostBlock createPostBlock(ExchangeContext ctx, String postBlockSenderIdentifier) { final PostBlock postBlock = new PostBlock(); String postBlockID = ctx.getVariable("postBlockId") == null ? UUID.randomUUID().toString() : (String) ctx.getVariable("postBlockId"); ctx.setVariable("postBlockId", postBlockID); postBlock.setID(postBlockID); // идентификатор запроса postBlock.setSenderIdentifier(postBlockSenderIdentifier); Date postBlockTimeStamp = ctx.getVariable("postBlockTimeStamp") != null ? (Date) ctx.getVariable("postBlockTimeStamp") : new Date(); postBlock.setTimeStamp( XmlTypes.dateTimeAndZeroMilliseconds( formatDate(postBlockTimeStamp, "dd.MM.yyyy HH:mm:ss"))); // дата составления запроса return postBlock; }