diff --git a/.project b/.project new file mode 100644 index 0000000..d0cafac --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + montevibiano_sian + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3116e87 --- /dev/null +++ b/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + pi + mvtxt + 0.0.1-SNAPSHOT + montevibiano_txt + + + + com.ancientprogramming.fixedformat4j + fixedformat4j + 1.2.2 + + + org.projectlombok + lombok + 1.18.20 + provided + + + + org.beanio + beanio + 2.1.0 + + + + \ No newline at end of file diff --git a/src/main/java/com/pi/txtsian/ents/AnagfctoFile.java b/src/main/java/com/pi/txtsian/ents/AnagfctoFile.java new file mode 100644 index 0000000..0829440 --- /dev/null +++ b/src/main/java/com/pi/txtsian/ents/AnagfctoFile.java @@ -0,0 +1,60 @@ +package com.pi.txtsian.ents; + +import java.util.ArrayList; +import java.util.List; + +import com.ancientprogramming.fixedformat4j.format.FixedFormatManager; +import com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl; + +public class AnagfctoFile { + + private List _Righe = new ArrayList(); + + public List getRighe(){ + return this._Righe; + } + + public void setRighe(List in){ + this._Righe = in; + } + + public void addRiga(AnagfctoRow in) { + + this._Righe.add(in); + } + + public byte[] getByteArray() { + + String rs = ""; + + FixedFormatManager manager = new FixedFormatManagerImpl(); + + //scorro tutti i miei row, converto e inserisco delimitatori di campo + for(AnagfctoRow r : this._Righe) { + + String exportedString = manager.export(r); + + char[] ch = new char[361]; + //in posizione 360 carattere ; + + for (int i = 0; i < exportedString.length(); i++) { + ch[i] = exportedString.charAt(i); + } + + int[] pos = {16,19,36,47,198,349,352,356,360}; + + for (int i=0; i _Righe = new ArrayList(); + + + public List getRighe(){ + return this._Righe; + } + + public void setRighe(List in){ + this._Righe = in; + } + + public void addRiga(OperregiRow in) { + + this._Righe.add(in); + } + + + public byte[] getByteArray() { + + String rs = ""; + + FixedFormatManager manager = new FixedFormatManagerImpl(); + + //non usare, length array non corretta + //ch = exportedString.toCharArray(); + //scorro tutti i miei row, converto e inserisco delimitatori di campo + for(OperregiRow r : this._Righe) { + + String exportedString = manager.export(r); + + char[] ch = new char[877]; + //in posizione 877 carattere ; + + for (int i = 0; i < exportedString.length(); i++) { + ch[i] = exportedString.charAt(i); + } + + int[] pos = {16,27,38,47,58,67,78,89,100,114,128,139,150,161,164,167,170,251,254,335,349,363,377,391,405,419,433,454,755,757,759,761,763,765,767,769,771,773,775,777,795,813,818,829,840,854,863,874,876}; + + for (int i=0; i l1 = new ArrayList(); +// List l2 = new ArrayList(); +// +// OperregiRow r = new OperregiRow(); +// AnagfctoRow r2 = new AnagfctoRow(); +// +// r.setC01("02339040541"); +// r.setC02("26149"); +// r.setC03("1250"); +// r.setC49("I"); +// +// r2.setC01("02339040541"); +// +// l2.add(r2); +// l2.add(r2); +// l2.add(r2); +// l2.add(r2); +// +// l1.add(r); +// l1.add(r); +// l1.add(r); +// l1.add(r); +// l1.add(r); +// +// OperregiFile f = new OperregiFile(); +// AnagfctoFile f2 = new AnagfctoFile(); +// +// f.setRighe(l1); +// +// f2.setRighe(l2); +// +// System.out.print(new String(f.getByteArray(), StandardCharsets.UTF_8)); +// +// System.out.print(new String(f2.getByteArray(), StandardCharsets.UTF_8)); + + + + } + +}