parent
a950dfcf33
commit
30161a3291
7 changed files with 281 additions and 97 deletions
|
|
@ -5,6 +5,8 @@ import org.slf4j.LoggerFactory;
|
|||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.JournalEventExportedRequest;
|
||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.swt.exporter.util.ConvertionContext;
|
||||
import ru.spcex.clearing.swt.exporter.util.SWTHeaderData;
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.ResultStatuses;
|
||||
import ru.spcex.platform.enumeration.SwtTable;
|
||||
|
|
@ -26,6 +28,7 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
private final DateTimeFormatter dtInFileHeaderFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'/'HHmm");
|
||||
private final KafkaSender kafkaSender;
|
||||
protected final FileStorage fileStorage;
|
||||
protected final Class<T> mapClass;
|
||||
|
||||
protected AbstractExporterService(FileStorage fileStorage,
|
||||
KafkaSender kafkaSender, ImdgProvider imdgProvider,
|
||||
|
|
@ -34,6 +37,7 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
this.fileStorage = fileStorage;
|
||||
this.kafkaSender = kafkaSender;
|
||||
this.type = type;
|
||||
this.mapClass = mapClass;
|
||||
Objects.requireNonNull(type, "SWT table type not set");
|
||||
this.sdfImdg = imdgProvider.getImdg(mapName, mapClass);
|
||||
}
|
||||
|
|
@ -48,6 +52,9 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
|
||||
protected abstract String typeForHeader();
|
||||
|
||||
protected abstract SWTHeaderData getHeader(T record);
|
||||
|
||||
|
||||
public void process() {
|
||||
LocalDateTime exportAt = LocalDateTime.now();
|
||||
|
||||
|
|
@ -55,15 +62,16 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
log.debug("Start export {} Lim file", fileName);
|
||||
|
||||
try {
|
||||
byte[] data;
|
||||
{
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
Collection<T> records = selectItems();
|
||||
log.debug("Prepared {} record from {} to file {}",
|
||||
records.size(), sdfImdg.getMapName(), fileName);
|
||||
makeSWTData(typeForHeader(), exportAt, records, outBuffer);
|
||||
data = outBuffer.toByteArray();
|
||||
}
|
||||
byte[] data;
|
||||
{
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
Collection<T> records = selectItems();
|
||||
log.debug("Prepared {} record from {} to file {}",
|
||||
records.size(), sdfImdg.getMapName(), fileName);
|
||||
SWTHeaderData swtHeaderData = makeSwtHeader(records);
|
||||
makeSWTData(swtHeaderData, records, outBuffer);
|
||||
data = outBuffer.toByteArray();
|
||||
}
|
||||
fileStorage.saveFile(fileName, data);
|
||||
} catch (Exception e) { // IOException, ...
|
||||
log.error("Failed export {} file", fileName);
|
||||
|
|
@ -75,6 +83,15 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
sendSwtExportedNotification(exportAt, null, ResultStatuses.success);
|
||||
}
|
||||
|
||||
protected SWTHeaderData makeSwtHeader(Collection<T> records) {
|
||||
Optional<T> optional = records.stream().findAny();
|
||||
T value = null;
|
||||
if(optional.isPresent()){
|
||||
value = optional.get();
|
||||
}
|
||||
return getHeader(value);
|
||||
}
|
||||
|
||||
protected abstract String getDocumentNameForJournal();
|
||||
|
||||
void sendSwtExportedNotification(LocalDateTime registrationAt, Long registrationNumber, ResultStatuses resultStatus) {
|
||||
|
|
@ -110,47 +127,21 @@ public abstract class AbstractExporterService<T extends SpcexObjectBase> {
|
|||
}
|
||||
|
||||
// Конвертация (поля см. meta.xml)
|
||||
protected abstract LinkedHashMap<String, Object> convertRecord(T record);
|
||||
protected abstract String convertRecord(T record, ConvertionContext context);
|
||||
|
||||
// protected abstract String[] swtHeader();
|
||||
|
||||
protected void makeSWTData(String type, LocalDateTime time, Collection<T> records, OutputStream outStream) {
|
||||
protected void makeSWTData(SWTHeaderData header, Collection<T> records, OutputStream outStream) {
|
||||
PrintWriter out = new PrintWriter(outStream);
|
||||
// todo SWT txt не понял формат. Надо уточнить формат файла. Должен соответствовать мете.
|
||||
out.println("To:CSO");
|
||||
out.println("From:SPCE");
|
||||
if (type != null)
|
||||
out.println("Type:" + type);// Type:009
|
||||
if (time != null) {
|
||||
String timeS = dtInFileHeaderFormatter.format(time);
|
||||
out.println("Date/Time:" + timeS);// Date/Time:20230227/0932
|
||||
}
|
||||
/*
|
||||
To:CSO
|
||||
From:SPCE
|
||||
Type:009
|
||||
Date/Time:20230227/0932
|
||||
:20:0ef63e17-83ac-4e22-a76b-fd8a4df10de3
|
||||
:21:SDC230227084839
|
||||
:18A:46
|
||||
*/
|
||||
StringBuilder line = new StringBuilder();
|
||||
out.print(header.buildString());
|
||||
int counter = 0;
|
||||
int totalSize = records.size();
|
||||
for (T row : records) {
|
||||
LinkedHashMap<String, Object> rowData = convertRecord(row);
|
||||
line.setLength(0);
|
||||
for (Map.Entry<String, Object> r : rowData.entrySet()) {
|
||||
String value = convertItem(r.getValue());
|
||||
line.append(value).append(':');
|
||||
}
|
||||
if (line.length() > 0) // remove :
|
||||
line.setLength(line.length() - 1);
|
||||
out.println(line);
|
||||
ConvertionContext context = new ConvertionContext(mapClass, counter, totalSize);
|
||||
String data = convertRecord(row, context);
|
||||
out.println(data);
|
||||
counter++;
|
||||
}
|
||||
//out.println("2"); // todo что значит 2?
|
||||
}
|
||||
|
||||
protected String convertItem(Object o) {
|
||||
//todo date/time/etc.
|
||||
return String.valueOf(o);
|
||||
out.println(totalSize);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
|||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.swt.exporter.services.AbstractExporterService;
|
||||
import ru.spcex.clearing.swt.exporter.services.FileStorage;
|
||||
import ru.spcex.clearing.swt.exporter.util.ConvertionContext;
|
||||
import ru.spcex.clearing.swt.exporter.util.SWTHeaderData;
|
||||
import ru.spcex.platform.enumeration.SwtTable;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@Service
|
||||
|
|
@ -37,26 +40,34 @@ public class DF09Exporter extends AbstractExporterService<SDf09> {
|
|||
return "009";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SWTHeaderData getHeader(SDf09 record){
|
||||
SWTHeaderData swtHeaderData = new SWTHeaderData();
|
||||
swtHeaderData.setTo("CSO");
|
||||
swtHeaderData.setFrom("SPCE");
|
||||
swtHeaderData.setType(typeForHeader());
|
||||
swtHeaderData.setDateTime(LocalDateTime.now());
|
||||
swtHeaderData.setValFor20Tag(java.util.UUID.randomUUID().toString());
|
||||
if(record!=null){
|
||||
swtHeaderData.setValFor21Tag(record.getInDocument());
|
||||
}
|
||||
return swtHeaderData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDocumentNameForJournal() {
|
||||
return "Уведомление об исполнении операции загрузки ценных бумаг или уведомление об ошибке";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LinkedHashMap<String, Object> convertRecord(SDf09 record) {
|
||||
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("id", record.getId());
|
||||
|
||||
row.put("outDocument", record.getOutDocument());
|
||||
row.put("inDocument", record.getInDocument());
|
||||
row.put("depoCode", record.getDepoCode());
|
||||
row.put("quantity", record.getQuantity());
|
||||
row.put("securityCode", record.getSecurityCode());
|
||||
row.put("clientName", record.getClientName());
|
||||
row.put("result", record.getResult());
|
||||
row.put("generationTime", record.getGenerationTime());
|
||||
row.put("generationId", record.getGenerationId());
|
||||
return row;
|
||||
protected String convertRecord(SDf09 record, ConvertionContext context) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(record.getDepoCode()).append(':');
|
||||
stringBuilder.append(record.getQuantity()).append(':');
|
||||
stringBuilder.append(record.getSecurityCode()).append(':');
|
||||
stringBuilder.append(record.getClientName()).append(':');
|
||||
stringBuilder.append(record.getResult()).append('\n');
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,18 @@
|
|||
package ru.spcex.clearing.swt.exporter.services.exportimpl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf09;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf11;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.swt.exporter.services.AbstractExporterService;
|
||||
import ru.spcex.clearing.swt.exporter.services.FileStorage;
|
||||
import ru.spcex.clearing.swt.exporter.util.ConvertionContext;
|
||||
import ru.spcex.clearing.swt.exporter.util.SWTHeaderData;
|
||||
import ru.spcex.platform.enumeration.SwtTable;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
|
||||
|
|
@ -44,20 +48,26 @@ public class DF11Exporter extends AbstractExporterService<SDf11> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected LinkedHashMap<String, Object> convertRecord(SDf11 record) {
|
||||
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("id", record.getId());
|
||||
|
||||
row.put("outDocument", record.getOutDocument());
|
||||
row.put("inDocument", record.getInDocument());
|
||||
row.put("depoCode", record.getDepoCode());
|
||||
row.put("quantity", record.getQuantity());
|
||||
row.put("securityCode", record.getSecurityCode());
|
||||
row.put("clientName", record.getClientName());
|
||||
row.put("result", record.getResult());
|
||||
row.put("generationTime", record.getGenerationTime());
|
||||
row.put("generationId", record.getGenerationId());
|
||||
return row;
|
||||
protected String convertRecord(SDf11 record, ConvertionContext context) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(record.getDepoCode()).append(':');
|
||||
stringBuilder.append(record.getQuantity()).append(':');
|
||||
stringBuilder.append(record.getSecurityCode()).append(':');
|
||||
stringBuilder.append(record.getClientName()).append(':');
|
||||
stringBuilder.append(record.getResult()).append('\n');
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
@Override
|
||||
protected SWTHeaderData getHeader(SDf11 record){
|
||||
SWTHeaderData swtHeaderData = new SWTHeaderData();
|
||||
swtHeaderData.setTo("CSO");
|
||||
swtHeaderData.setFrom("SPCE");
|
||||
swtHeaderData.setType(typeForHeader());
|
||||
swtHeaderData.setDateTime(LocalDateTime.now());
|
||||
swtHeaderData.setValFor20Tag(java.util.UUID.randomUUID().toString());
|
||||
if(record!=null){
|
||||
swtHeaderData.setValFor21Tag(record.getInDocument());
|
||||
}
|
||||
return swtHeaderData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,26 @@
|
|||
package ru.spcex.clearing.swt.exporter.services.exportimpl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf11;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf12;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.swt.exporter.services.AbstractExporterService;
|
||||
import ru.spcex.clearing.swt.exporter.services.FileStorage;
|
||||
import ru.spcex.clearing.swt.exporter.util.ConvertionContext;
|
||||
import ru.spcex.clearing.swt.exporter.util.SWTHeaderData;
|
||||
import ru.spcex.platform.enumeration.SwtTable;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
|
||||
@Service
|
||||
public class DF12Exporter extends AbstractExporterService<SDf12> {
|
||||
|
||||
public static final String DIRECTION_CONST = "DELFREE";
|
||||
|
||||
public DF12Exporter(FileStorage fileStorage,
|
||||
KafkaSender kafkaSender,
|
||||
ImdgProvider imdgProvider) {
|
||||
|
|
@ -48,19 +54,33 @@ public class DF12Exporter extends AbstractExporterService<SDf12> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected LinkedHashMap<String, Object> convertRecord(SDf12 record) {
|
||||
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("id", record.getId());
|
||||
|
||||
row.put("outDocument", record.getOutDocument());
|
||||
row.put("quantity", record.getQuantity());
|
||||
row.put("securityCode", record.getSecurityCode());
|
||||
row.put("depoCodeSender", record.getDepoCodeSender());
|
||||
row.put("depoCodeAdressee", record.getDepoCodeAdressee());
|
||||
row.put("result", record.getResult());
|
||||
row.put("generationTime", record.getGenerationTime());
|
||||
row.put("generationId", record.getGenerationId());
|
||||
return row;
|
||||
protected String convertRecord(SDf12 record, ConvertionContext context) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(context.getCountOfRecord()).append('\n');
|
||||
stringBuilder.append(context.getTotalCountOfRecords()).append('\n');
|
||||
stringBuilder.append(":23:").append(DIRECTION_CONST).append('\n'); //fixme
|
||||
stringBuilder.append(":35A:").append(record.getQuantity()).append('\n');
|
||||
stringBuilder.append(":35B:").append(record.getSecurityCode()).append('\n');
|
||||
stringBuilder.append(":82D:").append(record.getDepoCodeSender()).append('\n');
|
||||
stringBuilder.append(":87C:").append(record.getDepoCodeAdressee()).append('\n');
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SWTHeaderData getHeader(SDf12 record) {
|
||||
SWTHeaderData swtHeaderData = new SWTHeaderData();
|
||||
swtHeaderData.setTo("RDS");
|
||||
swtHeaderData.setFrom("SPCEX");
|
||||
swtHeaderData.setType(typeForHeader());
|
||||
swtHeaderData.setDateTime(LocalDateTime.now());
|
||||
if (record != null) {
|
||||
swtHeaderData.setValFor20Tag(record.getOutDocument());
|
||||
swtHeaderData.setValFor23Tag(DIRECTION_CONST); //FIXME
|
||||
swtHeaderData.setValFor35ATag(record.getQuantity());
|
||||
swtHeaderData.setValFor35BTag(record.getSecurityCode());
|
||||
swtHeaderData.setValFor82DTag(record.getDepoCodeSender());
|
||||
swtHeaderData.setValFor87CTag(record.getDepoCodeAdressee());
|
||||
}
|
||||
return swtHeaderData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,27 @@
|
|||
package ru.spcex.clearing.swt.exporter.services.exportimpl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf11;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf12;
|
||||
import ru.clearing.classes.statics.data.sdf.SDf14;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||
import ru.spcex.clearing.swt.exporter.services.AbstractExporterService;
|
||||
import ru.spcex.clearing.swt.exporter.services.FileStorage;
|
||||
import ru.spcex.clearing.swt.exporter.util.ConvertionContext;
|
||||
import ru.spcex.clearing.swt.exporter.util.SWTHeaderData;
|
||||
import ru.spcex.platform.enumeration.SwtTable;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
|
||||
@Service
|
||||
public class DF14Exporter extends AbstractExporterService<SDf14> {
|
||||
|
||||
private static final String RESULT_CONST = "OK";
|
||||
|
||||
public DF14Exporter(FileStorage fileStorage,
|
||||
KafkaSender kafkaSender,
|
||||
ImdgProvider imdgProvider) {
|
||||
|
|
@ -30,7 +37,7 @@ public class DF14Exporter extends AbstractExporterService<SDf14> {
|
|||
|
||||
@Override
|
||||
protected String sectionForFileName() {
|
||||
return "bond"; // todo bond / fund
|
||||
return "bond"; // todo bond / fund
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,15 +55,20 @@ public class DF14Exporter extends AbstractExporterService<SDf14> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected LinkedHashMap<String, Object> convertRecord(SDf14 record) {
|
||||
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("id", record.getId());
|
||||
|
||||
row.put("outDocument", record.getOutDocument());
|
||||
row.put("result", record.getResult());
|
||||
row.put("generationTime", record.getGenerationTime());
|
||||
row.put("generationId", record.getGenerationId());
|
||||
return row;
|
||||
protected String convertRecord(SDf14 record, ConvertionContext context) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(RESULT_CONST).append('\n');
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SWTHeaderData getHeader(SDf14 record){
|
||||
SWTHeaderData swtHeaderData = new SWTHeaderData();
|
||||
swtHeaderData.setTo("CSO");
|
||||
swtHeaderData.setFrom("SPCE");
|
||||
swtHeaderData.setType(typeForHeader());
|
||||
swtHeaderData.setDateTime(LocalDateTime.now());
|
||||
swtHeaderData.setValFor20Tag(java.util.UUID.randomUUID().toString());
|
||||
return swtHeaderData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package ru.spcex.clearing.swt.exporter.util;
|
||||
|
||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
|
||||
public class ConvertionContext {
|
||||
private Class<? extends SpcexObjectBase> clazz;
|
||||
private Integer countOfRecord;
|
||||
private Integer totalCountOfRecords;
|
||||
|
||||
public ConvertionContext(Class<? extends SpcexObjectBase> clazz, Integer countOfRecord, Integer totalCountOfRecords) {
|
||||
this.clazz = clazz;
|
||||
this.countOfRecord = countOfRecord;
|
||||
this.totalCountOfRecords = totalCountOfRecords;
|
||||
}
|
||||
|
||||
public Class<? extends SpcexObjectBase> getClazz() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
public void setClazz(Class<? extends SpcexObjectBase> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public Integer getCountOfRecord() {
|
||||
return countOfRecord;
|
||||
}
|
||||
|
||||
public void setCountOfRecord(Integer countOfRecord) {
|
||||
this.countOfRecord = countOfRecord;
|
||||
}
|
||||
|
||||
public Integer getTotalCountOfRecords() {
|
||||
return totalCountOfRecords;
|
||||
}
|
||||
|
||||
public void setTotalCountOfRecords(Integer totalCountOfRecords) {
|
||||
this.totalCountOfRecords = totalCountOfRecords;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package ru.spcex.clearing.swt.exporter.util;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class SWTHeaderData {
|
||||
private static final DateTimeFormatter dtInFileHeaderFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'/'HHmm");
|
||||
private String to;
|
||||
private String from;
|
||||
private String type;
|
||||
private LocalDateTime dateTime;
|
||||
private String valFor20Tag;
|
||||
private String valFor21Tag;
|
||||
private String valFor23Tag;
|
||||
private String valFor35ATag;
|
||||
private String valFor35BTag;
|
||||
private String valFor82DTag;
|
||||
private String valFor87CTag;
|
||||
|
||||
public void setTo(String to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setDateTime(LocalDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public void setValFor20Tag(String valFor20Tag) {
|
||||
this.valFor20Tag = valFor20Tag;
|
||||
}
|
||||
|
||||
public void setValFor21Tag(String valFor21Tag) {
|
||||
this.valFor21Tag = valFor21Tag;
|
||||
}
|
||||
|
||||
public void setValFor23Tag(String valFor23Tag) {
|
||||
this.valFor23Tag = valFor23Tag;
|
||||
}
|
||||
|
||||
public void setValFor35ATag(String valFor35ATag) {
|
||||
this.valFor35ATag = valFor35ATag;
|
||||
}
|
||||
|
||||
public void setValFor35BTag(String valFor35BTag) {
|
||||
this.valFor35BTag = valFor35BTag;
|
||||
}
|
||||
|
||||
public void setValFor82DTag(String valFor82DTag) {
|
||||
this.valFor82DTag = valFor82DTag;
|
||||
}
|
||||
|
||||
public void setValFor87CTag(String valFor87CTag) {
|
||||
this.valFor87CTag = valFor87CTag;
|
||||
}
|
||||
|
||||
public String buildString() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (to != null) {
|
||||
stringBuilder.append("To:").append(to).append('\n');
|
||||
}
|
||||
if (from != null) {
|
||||
stringBuilder.append("From:").append(from).append('\n');
|
||||
}
|
||||
if (type != null)
|
||||
stringBuilder.append("Type:").append(type).append('\n');
|
||||
if (dateTime != null) {
|
||||
String timeS = dtInFileHeaderFormatter.format(dateTime);
|
||||
stringBuilder.append("Date/Time:").append(timeS).append('\n');
|
||||
}
|
||||
if (valFor20Tag != null) {
|
||||
stringBuilder.append(":20:").append(valFor20Tag).append('\n');
|
||||
}
|
||||
if (valFor21Tag != null) {
|
||||
stringBuilder.append(":21:").append(valFor21Tag).append('\n');
|
||||
}
|
||||
if (valFor23Tag != null) {
|
||||
stringBuilder.append(":23:").append(valFor23Tag).append('\n');
|
||||
}
|
||||
if (valFor35ATag != null) {
|
||||
stringBuilder.append(":35A:SHS").append(valFor35ATag).append('\n');
|
||||
}
|
||||
if (valFor35BTag != null) {
|
||||
stringBuilder.append(":35B:ISIN ").append(valFor35BTag).append('\n');
|
||||
}
|
||||
if (valFor82DTag != null) {
|
||||
stringBuilder.append(":82D:").append(valFor82DTag).append('\n');
|
||||
}
|
||||
if (valFor87CTag != null) {
|
||||
stringBuilder.append(":87C:").append(valFor87CTag).append('\n');
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue