psdi.app.doclink

Class Doclinks

  • All Implemented Interfaces:
    java.rmi.Remote, DoclinksRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class Doclinks
    extends Mbo
    implements DoclinksRemote
    Mbo object to represent Doclinks.

    This mbo contains non-persistent attributes.

    Also see Doclink Package description.

    This is a site level object.

    The key attributes for this object are SiteID, Document, DocType, KeyTable, KeyColumn, and KeyValue.

    The attributes in this object are as follows:

    Attribute NameDescription
    AddInfoNon-persistent attribute. If addinfo is True, then when adding a new Doclinks, a Docinfo mbo will be automatically created. Otherwise, doclinks document must exist on docinfo table, as usual. For additional business rules, see appValidateAddInfo.
    AppNon-persistent attribute for application name. The UI can provide a value for App, and the value of "app" will be used by the object for validating doctype. Also, the field validation class FldDoclinksApp will set values for KeyTable and KeyColumn using the MaxApps values of MainTbName and KeyColumn. See MaxApps.
    CopyLinkToWoIndicates whether this link should be copied to a workorder. This means that this doclinks row will be duplicated, with the keytable, keycolumn, and keyvalue on the new doclinks pointing to the workorder. See copyDoclinksToWo.
    CreateBy, CreateDate, ChangeBy, ChangeDateself-explanatory
    DescriptionNon-persistent attribute. Same as Docinfo.
    DMSNameNon-persistent attribute. Same as Docinfo.
    DocTypeDefaults from Docinfo, can be overridden. Foreign key to Doctypes.
    DocumentForeign key to Docinfo.

    Technical note: The metadata indicates that Doclinks Document is not required, but this is really a workaround. Doclinks Document should always be non-null on the database. When creating a new doclinks where "addinfo" is true, the user should be able to allow the Mbo to autokey itself. This autokeying is done in appValidateAddInfo. If the metadata indicated that document was required, the framework would generate an error before appValidate could supply the autokey value.

    DocVersionUsed for DMS urltype only.
    GetLatestVersionUsed for DMS urltype only.
    KeyTable, KeyColumn, KeyValueThe combination of these three attributes points to a specific row on the specified table, to which this document is linked.

    It is important to note that the value stored in KeyValue must not include locale-specific formatting. Generally, this is handled by the Doclinks add method and need not be a concern to anyone else. However, when creating a new Doclinks, if the mbo is not owned by one of the mbos listed in defineValidOwners, then the KeyValue is probably being set by the UI and it is important to remember to remove any formatting. This value would be retrieved from the owner by something like the following:
    (owner.getMboValueData(attributeName)).getDataAsObject()).toString()

    NewUrlNameNon-persistent attribute. Same as Docinfo. This value is set by the UI when adding a mbo and "upload" is True. When saving the mbo, the docinfo.urlname is set equal to the newurlname.
    OrgIDThe organization for this site, stored on this table for ease of access. This equals the value for OrgID specified on the Site table.
    PrintThruLinkDefaults from Docinfo PrintThruLinkDflt, can be overridden. Facilitates printing a group of documents that are linked to the same key object.
    ReferenceFreeform user-defined information.
    ShowNon-persistent attribute. Same as Docinfo.
    SiteIDThe site to which this record pertains. Foreign key to Site.
    UploadNon-persistent attribute. Same as Docinfo.
    UrlNameNon-persistent attribute. Same as Docinfo.
    UrlParam1-5Non-persistent attributes. Same as Docinfo.
    UrlTypeNon-persistent attribute. Same as Docinfo.
    WebUrlNon-persistent attribute. Same as Docinfo. See calcWebUrl.
    See Also:
    Doctypes, Docinfo, psdi.app.doclink.DoclinkService#calcWebUrl
    • Constructor Detail

      • Doclinks

        public Doclinks(MboSet ms)
                 throws MXException,
                        java.rmi.RemoteException
        Construct the Doclinks object
        Parameters:
        ms -
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a mbo, defaulting the attributes shown below. If the owner is Docinfo, this also copies additional values from docinfo via copyFromDocinfo.
        Attribute NameAttribute Value
        Appvalue of MboSet getApp
        DescriptionIf owner is Docinfo, equals value from Docinfo.
        DMSNameIf owner is Docinfo, equals value from Docinfo.
        DocTypeIf owner is Docinfo, equals value from Docinfo.
        DocumentIf owner is Docinfo, equals value from Docinfo.
        KeyTable, KeyColumn, KeyValueIf owner is NOT Docinfo, then set values depending on who is the owner.
        PrintThruLinkTrue. However, if owner is Docinfo, equals value from Docinfo printthrulinkdflt.
        ShowIf owner is Docinfo, equals value from Docinfo. If owner is not Docinfo, set to True.
        UploadIf owner is Docinfo, equals value from Docinfo. If owner is not Docinfo, set to False.
        UrlNameIf owner is Docinfo, equals value from Docinfo.
        UrlParam1-5If owner is Docinfo, equals value from Docinfo.
        UrlTypeIf owner is Docinfo, equals value from Docinfo.

        Also, attach field validation class FldDoclinksApp to the "app" attribute.

        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        DoclinksSet.getOwnerInfo(java.lang.String), Doclinks.copyFromDocinfo(psdi.mbo.MboRemote)
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        Prepare to modify a mbo, defaulting the attributes shown below.
        Attribute NameAttribute Value
        ChangeByCurrent user
        ChangeDateCurrent date
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • getValidateOrder

        public java.lang.String[] getValidateOrder()
        Validate Order for Doclinks attributes. Addinfo and Document are first.
        Overrides:
        getValidateOrder in class Mbo
      • copyFromDocinfo

        public void copyFromDocinfo(MboRemote docinfo)
                             throws MXException,
                                    java.rmi.RemoteException
        Copy attribute values from docinfo to this doclinks. This method copies the following values.
        Attribute NameAttribute Value
        AppValue from Docinfo (if not null on Docinfo and is null on Doclinks).
        DescriptionValue from Docinfo.
        DMSNameValue from Docinfo.
        ShowValue from Docinfo.
        UploadValue from Docinfo.
        UrlNameValue from Docinfo.
        UrlParam1-5Value from Docinfo.
        UrlTypeValue from Docinfo.
        WebUrlValue from Docinfo.
        Specified by:
        copyFromDocinfo in interface DoclinksRemote
        Parameters:
        docinfo - The docinfo mbo whose values are to be copied.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Doclinks.copyFromDocinfo(psdi.mbo.MboRemote)
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        Do the following.
        1. Set "getlatestversion" true/false depending on value of "docversion".
        2. Validate "doctype" via field validation class.
        3. If adding a mbo where "addinfo" is True, then call appValidateAddInfo. Otherwise, just ensure that Document is not null.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Doclinks.appValidateAddInfo()
      • appValidateAddInfo

        public void appValidateAddInfo()
                                throws MXException,
                                       java.rmi.RemoteException
        Application validation when "addinfo" attribute is True. Called from appValidate. Can also be called separately.

        1. Urlname cannot be null.
        2. Newurlname: If urltype is FILE and "upload" is True, then newurlname cannot be null. Otherwise, copy urlname to newurlname.
        3. If document is null, then autokey it.
        4. Create the docinfo Mbo and set values on it.
        5. Call appValidate for the docinfo mbo.
        6. Copy the following values from docinfo to this doclinks: description, urlname, weburl.
        Specified by:
        appValidateAddInfo in interface DoclinksRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Doclinks.getInternalUrltype(), Doclinks.setAddInfoMboValues(), Docinfo.appValidate()
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        When executing the copy method for the Mbo, do not copy values for the following attribute(s):
        • KEYVALUE
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        The - MboValueInfo object of the MboValue to be evaluated
        Returns:
        True if the field does not need to be copied. In all other cases return false.
        Throws:
        java.rmi.RemoteException
        MXException
        See Also:
        Mbo.copy(MboSetRemote)
      • copy

        public MboRemote copy(MboSetRemote mboset,
                              long mboAddFlags)
                       throws MXException,
                              java.rmi.RemoteException
        Description copied from class: Mbo
        Adds a new mbo to the set passed in and copies the information for each of the fields into the new mbo from this. The new mbo will be added to the next of the current index.
        Specified by:
        copy in interface MboRemote
        Overrides:
        copy in class Mbo
        Parameters:
        mboset - The set into which the new mbo will be added.
        mboAddFlags - Flags to use when adding the new Mbo. Values on the attribute are always set with NOACCESSCHECK|NOVALIDATION_AND_NOACTION.
        Returns:
        The new mbo, with values copied from this mbo.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.copy(psdi.mbo.MboSetRemote, long)
      • isDoclinkOwner

        protected boolean isDoclinkOwner()
                                  throws MXException,
                                         java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • copyFake

        public MboRemote copyFake(MboSetRemote mboset)
                           throws MXException,
                                  java.rmi.RemoteException
        Description copied from class: Mbo
        Adds a fake mbo to the set passed in and copies theinformation for each of the fields into the new mbo from this.
        Specified by:
        copyFake in interface MboRemote
        Overrides:
        copyFake in class Mbo
        Parameters:
        mboset - The set into which the new mbo will be added.
        Returns:
        The new mbo, with values copied from this mbo.
        Throws:
        MXException
        java.rmi.RemoteException
      • getList

        public MboSetRemote getList(java.lang.String attribute)
                             throws MXException,
                                    java.rmi.RemoteException
        Description copied from class: Mbo
        Get the list of valid values for the attribute. In order to handle the condition where the passed attributeName contains a . notation(for example, ASSET.DESCRIPTION when the current object is WorkOrder ), this method first gets the correct object and then gets a list of valid values associated with the attribute. If the attributeName does not contain a ".", the current object is assumed to be the one to retrieve information from.
        Specified by:
        getList in interface MboRemote
        Overrides:
        getList in class Mbo
        Returns:
        the set of valid objects for the attribute; null if no elements found for the attribute.
        Throws:
        MXException - "Attribute {0} does not exist" exception will be thrown if the attribute does not exist in the object.
        java.rmi.RemoteException
        See Also:
        Mbo.getList(String)
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        This method will also mark all associated Docinfo records that are not shown in the library and not referenced by other doclinks.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)