Package cz.diribet.aqdef.model.builder
Class AqdefObjectModelBuilder
- java.lang.Object
-
- cz.diribet.aqdef.model.builder.AqdefObjectModelBuilder
-
public class AqdefObjectModelBuilder extends Object
Builder that simplifies creation ofAqdefObjectModel.
Sample usage:AqdefObjectModelBuilder builder = new AqdefObjectModelBuilder(); builder.createPartEntry("K1001", "part number"); builder.createPartEntry("K1002", "part title"); for (int i = 0; i <= 2; i++) { builder.createCharacteristicEntry("K2001", "characteristic number " + i); for (int j = 0; j <= 2; j++) { builder.createValueEntry("K0001", new BigDecimal(j)); builder.createValueEntry("K0004", new Date()); builder.nextValue(); } builder.nextCharacteristic(); } AqdefObjectModel objectModel = builder.build();Don't forget to call
nextPart(),nextCharacteristic(),nextValue()before you start writing new record.- Author:
- Vlastimil Dolejs
-
-
Constructor Summary
Constructors Constructor Description AqdefObjectModelBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AqdefObjectModelbuild()voidcreateCharacteristicEntry(KKey key, Object value)voidcreateCharacteristicEntry(String key, Object value)voidcreateGroupEntry(KKey key, Object value)voidcreateGroupEntry(String key, Object value)voidcreateHierarchyNodeOfCharacteristic(int characteristicId, Integer parentCharacteristicId)voidcreateHierarchyNodeOfGroup(int characteristicId, Integer parentCharacteristicId)voidcreateHierarchyNodeOfPart()voidcreatePartEntry(KKey key, Object value)voidcreatePartEntry(String key, Object value)voidcreateValueEntry(KKey key, Object value)voidcreateValueEntry(String key, Object value)voidnextCharacteristic()You have to call this method after all data of current characteristic (and its values) are written.voidnextGroup()You have to call this method after all data of current group are written.voidnextPart()You have to call this method after all data of current part (and its characteristics and values) are written.voidnextValue()You have to call this method after all data of current value are written.voidreplaceCharacteristicEntry(String key, int partIndex, int characteristicIndex, Object value)Replaces value of a given K-key with a new value for: single characteristic of a single part if bothpartIndexandcharacteristicIndexare provided single characteristic of all parts ifpartIndex = 0andcharacteristicIndex > 0all characteristics of single part ifpartIndex > 0andcharacteristicIndex = 0all characteristics of all parts ifpartIndex = 0andcharacteristicIndex = 0voidreplacePartEntry(String key, int index, Object value)Replaces value of a given K-key with a new value for a single part identified by the partindexor for all parts if index is 0.
-
-
-
Method Detail
-
build
public AqdefObjectModel build()
-
replacePartEntry
public void replacePartEntry(String key, int index, Object value)
Replaces value of a given K-key with a new value for a single part identified by the partindexor for all parts if index is 0.If the K-key doesn't have value, it will be added.
- Parameters:
key-index- of part whose value will be replaced or 0value- new value
-
replaceCharacteristicEntry
public void replaceCharacteristicEntry(String key, int partIndex, int characteristicIndex, Object value)
Replaces value of a given K-key with a new value for:- single characteristic of a single part if both
partIndexandcharacteristicIndexare provided - single characteristic of all parts if
partIndex = 0andcharacteristicIndex > 0 - all characteristics of single part if
partIndex > 0andcharacteristicIndex = 0 - all characteristics of all parts if
partIndex = 0andcharacteristicIndex = 0
If the K-key doesn't have value, it will be added.
- Parameters:
key-partIndex-characteristicIndex-value-
- single characteristic of a single part if both
-
createHierarchyNodeOfPart
public void createHierarchyNodeOfPart()
-
createHierarchyNodeOfCharacteristic
public void createHierarchyNodeOfCharacteristic(int characteristicId, Integer parentCharacteristicId)
-
createHierarchyNodeOfGroup
public void createHierarchyNodeOfGroup(int characteristicId, Integer parentCharacteristicId)
-
nextPart
public void nextPart()
You have to call this method after all data of current part (and its characteristics and values) are written.
-
nextCharacteristic
public void nextCharacteristic()
You have to call this method after all data of current characteristic (and its values) are written.
-
nextValue
public void nextValue()
You have to call this method after all data of current value are written.
-
nextGroup
public void nextGroup()
You have to call this method after all data of current group are written.
-
-