Class AqdefObjectModelBuilder


  • public class AqdefObjectModelBuilder
    extends Object
    Builder that simplifies creation of AqdefObjectModel.
    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 Detail

      • AqdefObjectModelBuilder

        public AqdefObjectModelBuilder()
    • Method Detail

      • createPartEntry

        public void createPartEntry​(String key,
                                    Object value)
      • createPartEntry

        public void createPartEntry​(KKey key,
                                    Object value)
      • 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 part index or 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 0
        value - new value
      • createCharacteristicEntry

        public void createCharacteristicEntry​(String key,
                                              Object value)
      • createCharacteristicEntry

        public void createCharacteristicEntry​(KKey key,
                                              Object 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 partIndex and characteristicIndex are provided
        • single characteristic of all parts if partIndex = 0 and characteristicIndex > 0
        • all characteristics of single part if partIndex > 0 and characteristicIndex = 0
        • all characteristics of all parts if partIndex = 0 and characteristicIndex = 0

        If the K-key doesn't have value, it will be added.

        Parameters:
        key -
        partIndex -
        characteristicIndex -
        value -
      • createGroupEntry

        public void createGroupEntry​(String key,
                                     Object value)
      • createGroupEntry

        public void createGroupEntry​(KKey key,
                                     Object value)
      • createValueEntry

        public void createValueEntry​(String key,
                                     Object value)
      • createValueEntry

        public void createValueEntry​(KKey key,
                                     Object value)
      • createHierarchyNodeOfPart

        public void createHierarchyNodeOfPart()
      • createHierarchyNodeOfCharacteristic

        public void createHierarchyNodeOfCharacteristic​(int characteristicId,
                                                        Integer parentCharacteristicId)
      • createHierarchyNodeOfGroup

        public void createHierarchyNodeOfGroup​(int characteristicId,
                                               Integer parentCharacteristicId)
      • createCatalogRecordEntry

        public void createCatalogRecordEntry​(String key,
                                             Object value)
      • createCatalogRecordEntry

        public void createCatalogRecordEntry​(KKey key,
                                             Object value)
      • 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.
      • nextCatalogRecord

        public void nextCatalogRecord()
        You have to call this method after all data of the current catalog record are written.