Creating Internal Media Object Value Objects

Like other internal value object classes, Media Object value objects and their components extend the ValueObject foundation class. The business service foundation provides the Media Object Value Object Class Wizard, which helps you create internal Media Object value object classes that follow methodology rules. The value object wizards also assist you by pulling useful information from the JD Edwards EnterpriseOne data dictionary into the Javadoc for value objects. You must create accessor methods (getter and setter methods) because the value object wizards do not generate these methods. Also, you must provide the description name of the field for the Javadoc. The wizard uses the field name that comes from the Media Object data structure to generate member variables for the internal Media Object value object class.

The Media Object Value Object Class Wizard generates two java classes: one is the actual internal value object, and the other is the value object that is named MOItem_Internal.java by default. The internal value object contains the properties from the Media Object data structure and the reference to the array of default value objects (MOItem_Internal.java) in order to hold multiple media objects.

The default value object, MOItem_Internal.java, contains the Media Object properties such as media object name, type, and attachment data. Do not change the name of the default value object.

Apart from the variables created from the Media Object data structure, the wizard creates the following two default methods and one member variable:

  • getSzMoKey

    This method prepares the Media Object Key for the media object. If desired, you can customize the logic to override this method to meet your business need.

  • getSzMoName

    This method is used to retrieve the name of the Media Object data structure.

  • downloadMediaObject

    This is the member variable. If set to true, then the Media Object Select operation will return a list of all media objects along with file attachments. If set to false, the Media Object Select operation will return a list of all media objects but will not download the file attachments. By default, this variable is set to true.

The following code is an example of an internal value object created through the Media Object Value Object Class Wizard for the Media Object data structure ABGT:

public class ABGT_Internal extends ValueObject implements Serializable {
    /**
     * Media Object Array <br>
     */
    private MOItem_Internal[] moItems = null;
 
    /**
     * Download Attachments <br>
     */
    private boolean downloadMediaObject = true;
 
    /**
     * Address Number
     * <p>
     * TODO: Description using Glossary Text from EnterpriseOne if appropriate.
     * </p>
     * EnterpriseOne Key Field: false <br>
     * EnterpriseOne Alias: AN8 <br>
     * EnterpriseOne field length:  8 <br>
     * EnterpriseOne decimal places: 0 <br>
     * EnterpriseOne Next Number: 01/1 <br>
     */
    private MathNumeric mnAddressNumber = null;
 
    /**
     * Builds and returns the Media Object Key with the media object attributes
     */
    public String getSzMoKey() {
        String key = String.valueOf(mnAddressNumber);
        if (key.startsWith("null|"))
        {
            key = key.substring(4, key.length());
        }
        if (key.endsWith("|null"))
        {
            key = key.substring(0, key.length() - 4);
        }
        while(key.indexOf("|null|") != -1)
        {
            key = key.replace("|null|", "||");
        }
        return key;
    }
 
    /**
     * Returns the Media Object name
     */
    public String getSzMoName() {
        return "ABGT";
    }
}

The following is an example of the default value object (MOItem_Internal) created through the Media Object Value Object Wizard:

public class MOItem_Internal extends ValueObject implements Serializable {
    /**
     * Media Object Attachment Type <br>
     */
    private String szMoType = null;
 
    /**
     * Media Object Attachment File Name <br>
     */
    private String szItemName = null;
 
    /**
     * Media Object Sequence Number <br>
     */
    private int moSeqNo = 0;
 
    /**
     * Media Object Data <br>
     */
    private DataHandler szData = null;
 
    /**
     * TODO: Default public constructor for instantiating: MOItem_Internal
     */
    public MOItem_Internal() {
    }
 
    /**
     * TODO: Default public constructor for instantiating: MOItem_Internal
     */
    public MOItem_Internal(String szMoType) {
        this.szMoType = szMoType;
    }
 
    /**
     * TODO: Default public constructor for instantiating: MOItem_Internal
     */
    public MOItem_Internal(int moSeqNo) {
        this.moSeqNo = moSeqNo;
    }
 
    /**
     * TODO: Default public constructor for instantiating: MOItem_Internal
     */
    public MOItem_Internal(String szMoType, String szItemName, DataHandler szData) {
        this.szMoType = szMoType;
        this.szItemName = szItemName;
        this.szData = szData;
    }
}