Auf der Download Seite finden Sie auch die JavaDoc Dokumentation zur Bibliothek.
Versionshinweise
Änderungen in Version 1.0
- Bibliothek wurde aufgesetzt
- Unterstützung zum lesen und schreiben von GAEB90 Dateien
Hilfe / Beispiele
Schreiben einer GAEB90 Datei
package de.ksquared.test.jgaeb.gaeb1990; import static de.ksquared.jgaeb.gaeb1990.file.File.Identifier.*; import static de.ksquared.jgaeb.gaeb1990.frame.Frame.Type.*; import static de.ksquared.jgaeb.gaeb1990.group.Group.Name.*; import java.io.IOException; import java.util.GregorianCalendar; import de.ksquared.jgaeb.gaeb1990.element.Element; import de.ksquared.jgaeb.gaeb1990.element.Element.Type; import de.ksquared.jgaeb.gaeb1990.file.FileBuilder; import de.ksquared.jgaeb.gaeb1990.frame.Frame; import de.ksquared.jgaeb.gaeb1990.frame.FrameBuilder; import de.ksquared.jgaeb.gaeb1990.group.GroupBuilder; public class GAEB1990WriteTest { public static void main(String[] args) { FileBuilder file; GroupBuilder group01,group02,group05; FrameBuilder frame; file = new FileBuilder(KE_86); //optional group: GR_03 (this one could also be template of KE_84, with ZA_07 and without ZA_25) group01 = file.newGroup(GR_01); frame = group01.newFrame(Frame.Type.ZA_T0); frame = group01.newFrame(Frame.Type.ZA_T1); frame.addElement(Element.Type.TEXT,"Contract Information"); frame = group01.newFrame(Frame.Type.ZA_T1); frame.addElement(Element.Type.TEXT,"--------------------------"); frame = group01.newFrame(Frame.Type.ZA_T1); frame.addElement(Element.Type.TEXT,"Copyright Kristian Kraljic"); frame = group01.newFrame(Frame.Type.ZA_T9); group02 = file.newGroup(GR_02); //optional: ZA_06, ZA_07 frame = group02.newFrame(ZA_00); frame.addElement(KE_86.getDP()); frame.addElement(Type.KURZLANG,"L"); //K, L or space on 84 frame.addElement(Type.OZMASKE,"PPPPPPPPP"); //only positions in this file frame.addElement(Element.VERSDTA); frame = group02.newFrame(ZA_01); frame.addElement(Type.LVBEZ,"jGAEB Write Part (Contract description)"); frame.addElement(Type.LVDATUM,GregorianCalendar.getInstance()); frame.addElement(Type.KZPREIS,true); frame = group02.newFrame(ZA_02); frame.addElement(Type.PROBEZ,"Develop the jGAEB-Testsuite (Project description)"); frame = group02.newFrame(ZA_03); frame.addElement(Type.AGBEZ,"kSquared (Employer)"); frame = group02.newFrame(ZA_04); frame.addElement(Type.ANBEZ,"Everybody (Agent)"); frame = group02.newFrame(ZA_08); frame.addElement(Type.WAEKU,"EURO"); frame.addElement(Type.WAEBEZ,"EURO"); group05 = group02.newGroup(GR_05); //optional ZA_24, ZA_30 //first item (item number 1) frame = group05.newFrame(ZA_21); frame.addElement(Type.OZ,"000000001"); //Ordnungszahl (Pos-No.) frame.addElement(Type.POSART1,"N"); //(N)ormalposition, (G)rundposition, W(A)hlposition, (S)Tundenlohnarbeiten frame.addElement(Type.POSART2,"N"); //(N)ormalposition, B(E)darfsposition, Bedarfsposition (M)it Gesamtbetrag frame.addElement(Type.POSTYP,"N"); //(N)ormalposition, (L)eitposition frame.addElement(Type.MENGE,1); frame = group05.newFrame(ZA_23); frame.addElement(Type.OZ,"000000001"); //Ordnungszahl (Pos-No.) frame = group05.newFrame(ZA_25); frame.addElement(Type.KURZTEXT,"Specification document (Item short text)"); frame = group05.newFrame(ZA_26); frame.addElement(Type.LANGTEXT,"Write a valid specification document (Item long text)"); //second item (item number 1) group05 = group02.newGroup(GR_05); //optional ZA_24, ZA_30 frame = group05.newFrame(ZA_21); frame.addElement(Type.OZ,"000000002"); //Ordnungszahl (Pos-No.) frame.addElement(Type.POSART1,"N"); //(N)ormalposition, (G)rundposition, W(A)hlposition, (S)Tundenlohnarbeiten frame.addElement(Type.POSART2,"N"); //(N)ormalposition, B(E)darfsposition, Bedarfsposition (M)it Gesamtbetrag frame.addElement(Type.POSTYP,"N"); //(N)ormalposition, (L)eitposition frame.addElement(Type.MENGE,10); frame.addElement(Type.EINHEIT,"HOUR"); frame = group05.newFrame(ZA_23); frame.addElement(Type.OZ,"000000002"); //Ordnungszahl (Pos-No.) frame = group05.newFrame(ZA_25); frame.addElement(Type.KURZTEXT,"Prototype development (Item short text)"); frame = group05.newFrame(ZA_26); frame.addElement(Type.LANGTEXT,"Write a working prototype (Item long text)"); frame = group02.newFrame(ZA_99); frame.addElement(Type.ANZTEIL,1); //number of GR_05's try { file.getFile().writeTo(new java.io.File("file"+KE_86.getSuffix())); } catch(IOException e) { e.printStackTrace(); } } }
Lesen einer GAEB90 Datei
package de.ksquared.test.jgaeb.gaeb1990; import static de.ksquared.jgaeb.gaeb1990.file.File.Identifier.*; import static de.ksquared.jgaeb.gaeb1990.element.Element.Type.*; import java.io.IOException; import de.ksquared.jgaeb.gaeb1990.file.File; import de.ksquared.jgaeb.gaeb1990.frame.Frame; import de.ksquared.jgaeb.gaeb1990.frame.Frame.Type; import de.ksquared.jgaeb.gaeb1990.group.Group; import de.ksquared.jgaeb.gaeb1990.group.Group.Name; import de.ksquared.jgaeb.gaeb1990.group.GroupElement; public class GAEB1990ReadTest { public static void main(String[] args) throws IOException { File file = File.readFrom(new java.io.File("file"+KE_86.getSuffix())); for(Group group:file.getGroups()) printGroup(group,0); } private static void printGroup(Group group,int padding) { if(group==null) return; Name name = group.getName(); printPadding("-- "+(name!=null?name.getName():"Unnamed Group")+" --",padding); if(Group.Name.GR_05.equals(name)) { printPadding(group.getFrame(Type.ZA_21).getElement(MENGE).getValue()+"x "+group.getFrame(Type.ZA_25).getElement(KURZTEXT),padding+2); printPadding(group.getFrame(Type.ZA_26).getElement(LANGTEXT),padding+4); printGroup(group.getGroup(Group.Name.GR_05),padding); //maybe there is another 05-group } else { for(GroupElement element:group.getElements()) if(element instanceof Frame) { Frame frame = (Frame)element; switch(frame.getType()) { case ZA_T1: printPadding(frame.getElement(TEXT),padding+2); break; case ZA_01: printPadding(frame.getElement(LVBEZ)+" ("+frame.getElement(LVDATUM)+")",padding+2); break; case ZA_02: printPadding("Project description: "+frame.getElement(PROBEZ),padding+2); break; case ZA_03: printPadding("Employer description: "+frame.getElement(AGBEZ),padding+4); break; case ZA_04: printPadding("Agent description: "+frame.getElement(ANBEZ),padding+4); break; } } else if(element instanceof Group) printGroup((Group)element,padding+2); } } private static void printPadding(Object print,int padding) { for(int position=0;position<padding;position++) System.out.print(' '); System.out.println(print); } }
Dokumentation
Im Moment ist keine Dokumentation der jGAEB Bibliothek vorhanden. Bitte schauen Sie sich die JavaDoc Dateien auf der Download Seite an. Die Standarddokumentation des GAEB1990 Dateiformats finden Sie auf der GAEB Homepage.