@@ -0,0 +1,2987 @@
+/*%0A * The MIT License (MIT)%0A *%0A * Copyright (c) 2015 Lachlan Dowding%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in all%0A * copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE%0A * SOFTWARE.%0A */%0A%0Apackage permafrost.tundra.tn.document;%0A%0Aimport com.wm.app.tn.db.BizDocTypeStore;%0Aimport com.wm.app.tn.doc.BizDocType;%0Aimport com.wm.data.IData;%0Aimport com.wm.data.IDataCursor;%0Aimport com.wm.data.IDataUtil;%0A%0A/**%0A * A collection of convenience methods for working with Trading Networks BizDocType objects.%0A */%0Apublic class BizDocTypeHelper %7B%0A%0A    /**%0A     * Returns the BizDocType object associated with the given the ID.%0A     *%0A     * @param id The ID that identifies the BizDocType to be returned.%0A     * @return   The BizDocType object identified by the given ID.%0A     */%0A    public static BizDocType get(String id) %7B%0A        return BizDocTypeStore.get(id, true, true);%0A    %7D%0A%0A    /**%0A     * Returns the BizDocType object associated with the given name.%0A     *%0A     * @param name The name of the BizDocType to be returned.%0A     * @return     The BizDocType object with the given name.%0A     */%0A    public static BizDocType getByName(String name) %7B%0A        return BizDocTypeStore.getByName(name, true, true);%0A    %7D%0A%0A    /**%0A     * Returns the given IData if its already a BizDocType, otherwise converts it to a BizDocType object.%0A     *%0A     * @param input The IData object to be converted to a BizDocType object.%0A     * @return      The BizDocType object that represents the given IData object.%0A     */%0A    public static BizDocType normalize(IData input) %7B%0A        if (input == null) return null;%0A%0A        BizDocType output = null;%0A%0A        if (input instanceof BizDocType) %7B%0A            output = (BizDocType)input;%0A        %7D else %7B%0A            IDataCursor cursor = input.getCursor();%0A            String id = IDataUtil.getString(cursor, %22TypeID%22);%0A            cursor.destroy();%0A%0A            if (id == null) throw new IllegalArgumentException(%22TypeID is required%22);%0A%0A            output = get(id);%0A        %7D%0A%0A        return output;%0A    %7D%0A%7D%0A

Add BizDocTypeHelper class