Search in sources :

Example 1 with Interpretation

use of dev.hawala.xns.level4.filing.FilingCommon.Interpretation in project dodo by devhawala.

the class AttributeUtils method courier2file_ordering.

private static void courier2file_ordering(Attribute a, FileEntry fe) {
    Ordering ord;
    try {
        ord = a.decodeData(Ordering::make);
    } catch (Exception e) {
        // ignored, use defaults
        ord = Ordering.make();
    }
    final int interpretation;
    switch(ord.interpretation.get()) {
        case bool:
            interpretation = FsConstants.intrBoolean;
            break;
        case cardinal:
            interpretation = FsConstants.intrCardinal;
            break;
        case longCardinal:
            interpretation = FsConstants.intrLongCardinal;
            break;
        case time:
            interpretation = FsConstants.intrTime;
            break;
        case integer:
            interpretation = FsConstants.intrInteger;
            break;
        case longInteger:
            interpretation = FsConstants.intrLongInteger;
            break;
        case string:
            interpretation = FsConstants.intrString;
            break;
        default:
            interpretation = FsConstants.intrNone;
            break;
    }
    fe.setOrderingKey(ord.key.get());
    fe.setOrderingAscending(ord.ascending.get());
    fe.setOrderingInterpretation(interpretation);
}
Also used : Ordering(dev.hawala.xns.level4.filing.FilingCommon.Ordering)

Example 2 with Interpretation

use of dev.hawala.xns.level4.filing.FilingCommon.Interpretation in project dodo by devhawala.

the class AttributeUtils method file2courier_ordering.

private static void file2courier_ordering(AttributeSequence s, long key, boolean ascending, int interpretation) {
    Ordering ord = Ordering.make();
    ord.key.set(key);
    ord.ascending.set(ascending);
    switch(interpretation) {
        case FsConstants.intrBoolean:
            ord.interpretation.set(Interpretation.bool);
            break;
        case FsConstants.intrCardinal:
            ord.interpretation.set(Interpretation.cardinal);
            break;
        case FsConstants.intrLongCardinal:
            ord.interpretation.set(Interpretation.longCardinal);
            break;
        case FsConstants.intrInteger:
            ord.interpretation.set(Interpretation.integer);
            break;
        case FsConstants.intrLongInteger:
            ord.interpretation.set(Interpretation.longInteger);
            break;
        case FsConstants.intrTime:
            ord.interpretation.set(Interpretation.time);
            break;
        case FsConstants.intrString:
            ord.interpretation.set(Interpretation.string);
            break;
        default:
            ord.interpretation.set(Interpretation.interpretationNone);
            break;
    }
    Attribute attr = s.value.add();
    try {
        attr.encodeData(ord);
    } catch (Exception e) {
        new UndefinedErrorRecord(FilingCommon.UNDEFINEDERROR_ENCODE_ERROR).raise();
    }
    attr.type.set(FilingCommon.atOrdering);
}
Also used : UndefinedErrorRecord(dev.hawala.xns.level4.filing.FilingCommon.UndefinedErrorRecord) FilterAttribute(dev.hawala.xns.level4.filing.FilingCommon.FilterAttribute) Attribute(dev.hawala.xns.level4.filing.FilingCommon.Attribute) UninterpretedAttribute(dev.hawala.xns.level4.filing.fs.UninterpretedAttribute) Ordering(dev.hawala.xns.level4.filing.FilingCommon.Ordering)

Aggregations

Ordering (dev.hawala.xns.level4.filing.FilingCommon.Ordering)2 Attribute (dev.hawala.xns.level4.filing.FilingCommon.Attribute)1 FilterAttribute (dev.hawala.xns.level4.filing.FilingCommon.FilterAttribute)1 UndefinedErrorRecord (dev.hawala.xns.level4.filing.FilingCommon.UndefinedErrorRecord)1 UninterpretedAttribute (dev.hawala.xns.level4.filing.fs.UninterpretedAttribute)1