psdi.app.assetcatalog

Class ClassSpec

  • java.lang.Object
  • All Implemented Interfaces:
    java.rmi.Remote, ClassSpecRemote, MboConstants, MboRemote, MaxRemoteProxy


    public class ClassSpec
    extends Mbo
    implements ClassSpecRemote
    MBO to represent ClassSpec.

    See Assetcatalog Package description.

    This is a system level object.

    The key attributes for this object are: ClassStructureId,section and AssetAttrId

    The attributes in this object are as follows:

    Attribute NameDescription
    AssetAttrIdAsset attribute identifier. A class specification temolate is made up of one or more asset attributes as identified by AssetAttrId. Subsequently, a class specification can have one or more of these ClassSpec objects. A set of ClassSpec objects (and AssetAttrId attributes) belonging to the same class specification template will have the same ClassStructureId. AssetAttrId is one of three key attributes for this object.
    AttrDescPrefixDefault prefix for the attribute portion of generated asset descriptions. This value is initially copied from the asset attribute. It can also be added or modified on this object.
    ClassStructureId Class structure identifier. One or more of these ClassSpec objects with the same ClassStructureId comprise a class specification template. One of three key attributes for this object.
    DataType Non-persistent column to hold the data type for the value of this ClassSpec's asset attribute. This attribute is not used in releases up to and including Release 5.1. This value comes from the asset attribute and cannot be modified on this object.
    DefaultALNValueDefault alphanumeric value. This value can be added or modified on this object before it is saved. This value is copied to the AlnValue of ItemSpec, AssetSpec or LocationSpec where it can then be modified prior to saving it. DefaultALNValue is read-only and null if DataType is NUMERIC.
    DefaultNUMValueDefault numeric value. This value can be added or modified on this object before it is saved. This value is copied to the NumValue attribute of ItemSpec, AssetSpec or LocationSpec where it can then be modified prior to saving it. DefaultNUMValue is read-only and null if DataType is ALN.
    DomainIdDomain identifier. The default is initially copied from the Domain ID in asset attribute. It can also be added or modified on this object before it is saved. If the datatype of this attribute is ALN the domain has to be of type ALN. If the datatype is NUMERIC the domain has to be of type NUMERIC.
    MeasureUnitIdMeasure unit identifier. The default is initially copied from the Meauure unit in asset attribute. It can also be added or modified on this object before it is saved.
    OrgIdIdentifier of the organization for this ClassSpec. One of three key attributes for this object.
    SpecValue Non-persistent column to hold the user-entered value when searching for a class structure identifier and the set of items, asset and locations that have specifications based on the class structure identifier.
    See Also:
    psdi.app.assetcatalog.AssetClass, ClassStructure, MeasureUnit
    • Constructor Detail

    • Method Detail

      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Creates a ClassSpec object for a ClassStructure object. This cannot be called outside a ClassStructure object. Also sets default values to:

        Attribute NameAttribute Value
        classStructureIdclassStructureId of the owning object
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • init

        public void init()
                  throws MXException
        Description copied from class: Mbo
        Called by the framework when the Mbo has been constructed and the MboValues have been initialized. This can be overridden by the programmer to provide any custom initialization they would like to do.
        Overrides:
        init in class Mbo
        Throws:
        MXException
      • userSaidToDelete

        public boolean userSaidToDelete()
                                 throws MXException,
                                        java.rmi.RemoteException
        93218 Determines if the object be deleted. For now this throws an exception because it is a Y/N question. Deleting a ClassSpec will trigger deletions of ITEMSPEC/LOCATIONSPEC/ASSETSPEC.

        Throws:
        MXApplicationException - assetattributenodelete
        GROUPKEYREASON
        assetcatalogassetattributenodeletetemporary exception
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long access)
                    throws MXException,
                           java.rmi.RemoteException
        Deletes the ClassSpec object. If we delete the ClassSpec, then delete all related objects: ItemSpec, LocationSpec, and AssetSpec.

        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        access - the access
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        93218: now that we are allowing the delete per user interaction, need to handle unDelete
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Parameters:
        access -
        Throws:
        MXException
        java.rmi.RemoteException
      • save

        protected void save()
                     throws MXException,
                            java.rmi.RemoteException
        Saves the ClassSpec object. Actions which occur when a ClassSpec is saved:
        • An assetAttribute record must be created if it does not exist in the table
        • A measureunit record must be created if it does not exist in the table
        • An Itemspec, AssetSpec, LocationSpec must be created if this ClassSpec set has been associated with any items, asset, or locations

        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.assetcatalog.AssetAttribute.add(), psdi.app.assetcatalog.MeasureUnit.add()
      • getAssetAttributeMbo

        public MboRemote getAssetAttributeMbo()
                                       throws MXException,
                                              java.rmi.RemoteException
        The sql in maxrelationship ASSETATTRIBUTE works only for oracle not sqlserver. Gets the sql inside the object.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • addOtherSpecs

        public void addOtherSpecs(MboSetRemote mboSet)
                           throws MXException,
                                  java.rmi.RemoteException
        Adds records to ITEMSPEC,LOCATIONSPEC, or ASSETSPEC based on the mboSet passed. The passed mboSet can be only Item, Asset, or Location.

        Throws:
        MXException
        java.rmi.RemoteException
      • setColumnsReadOnly

        public void setColumnsReadOnly(boolean setReadOnly)
                                throws MXException,
                                       java.rmi.RemoteException
        Sets read only columns. This used in the Asset Catalog search. These values are all readonly when param setReadOnly is true.

        Parameters:
        setReadOnly - all fields are set to readonly when true
        Throws:
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        checks if we should add asset attribute id or measureunit if user has said not to add them on the fly, throw exception
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • setInvalidValue

        protected void setInvalidValue(MboValue mbv)
                                throws MXException,
                                       java.rmi.RemoteException
        User says not to add measureunit or assetattird
        Parameters:
        mbv -
        Throws:
        MXException
        java.rmi.RemoteException
      • clearInvalidValue

        protected void clearInvalidValue(MboValue mbv)
                                  throws MXException,
                                         java.rmi.RemoteException
        User says he wants this object to automatically create assetattrid or measureunitid
        Parameters:
        mbv -
        Throws:
        MXException
        java.rmi.RemoteException
      • populateClassSpecUseWith

        public void populateClassSpecUseWith(MboRemote parentClassStructure)
                                      throws MXException,
                                             java.rmi.RemoteException
        When a child Classspec is being entered, also copy the parent's classusewith settings.
        Parameters:
        parent -
        Throws:
        MXException
        java.rmi.RemoteException
      • populateClassSpecUseWith

        public void populateClassSpecUseWith(MboSetRemote newClassSpecUseWithSet)
                                      throws MXException,
                                             java.rmi.RemoteException
        When a child Classspec is being entered, also copy the parent's classusewith settings.
        Parameters:
        parent -
        Throws:
        MXException
        java.rmi.RemoteException
      • populateSequence

        public int populateSequence(MboRemote newClassSpecUseWith)
                             throws MXException,
                                    java.rmi.RemoteException
        returns the next sequence for the new classspecusewith, created when a new classspec record is created.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getTableDomainObject

        public MboRemote getTableDomainObject()
                                       throws MXException,
                                              java.rmi.RemoteException
        06-20672: if the datatype is TABLE, gets the maxtabledomain object
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getClassStructure

        public ClassStructure getClassStructure()
                                         throws MXException,
                                                java.rmi.RemoteException
        get the classstructure record for this classspec
        Returns:
        A ClassStructure Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • applyDownHierarchy

        public void applyDownHierarchy()
                                throws MXException,
                                       java.rmi.RemoteException
        06-19174: apply Down Hierarchy if applydownhier is true then call ClassStructure.applyDownHierarchy method which will insert this attribute into the classspec set of all the children down the hierarchy
        Throws:
        MXException
        java.rmi.RemoteException
      • UnApplyDownHierarchy

        public void UnApplyDownHierarchy()
                                  throws MXException,
                                         java.rmi.RemoteException
        06-19174: Unapply Down Hierarchy - when apply Down Hierarchy is unchecked delete all classspec created because of previous applydown
        Throws:
        MXException
        java.rmi.RemoteException
      • inClassificationApp

        public boolean inClassificationApp()
                                    throws MXException,
                                           java.rmi.RemoteException
        07-27114: Is this ClassSpec in Classification App? For Performance, some mbosets are only instantiated in Classification app but not the other app.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • checkRequiredFields

        public void checkRequiredFields()
                                 throws MXException,
                                        java.rmi.RemoteException
        08-14402: if this classspec is being added and user clicks the UseWith Object Detail Button, check requiredness
        Specified by:
        checkRequiredFields in interface ClassSpecRemote
        Throws:
        MXException
        java.rmi.RemoteException
      • setClassSpecForApplyDownHier

        public void setClassSpecForApplyDownHier(MboRemote classSpecApplyDownHier)
                                          throws MXException,
                                                 java.rmi.RemoteException
        08-18363: remembers that ClassSpec record that has the ApplyDownHier flag checked. This current ClassSpec is a new ClassSpec that is created due to the ApplyDownHierarchy process in the passed ClassSpec object.
        Parameters:
        classSpecApplyDownHier -
        Throws:
        MXException
        java.rmi.RemoteException
      • getClassSpecForApplyDownHier

        public MboRemote getClassSpecForApplyDownHier()
                                               throws MXException,
                                                      java.rmi.RemoteException
        08-18363: returns the instance variable classSpecForApplyDownHier
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • copy

        public MboRemote copy(MboSetRemote newClassSpecSet,
                              long mboAddFlags)
                       throws MXException,
                              java.rmi.RemoteException
        08-19273: override copy()
        Specified by:
        copy in interface MboRemote
        Overrides:
        copy in class Mbo
        Parameters:
        newClassSpecSet - 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
      • prepareInsertAssetSpec

        protected void prepareInsertAssetSpec(MboRemote classSpecUseWith)
                                       throws MXException,
                                              java.rmi.RemoteException
        08-21999
        Throws:
        MXException
        java.rmi.RemoteException
      • prepareInsertItemSpec

        protected void prepareInsertItemSpec(MboRemote classSpecUseWith)
                                      throws MXException,
                                             java.rmi.RemoteException
        08-21999
        Throws:
        MXException
        java.rmi.RemoteException
      • prepareInsertLocationSpec

        protected void prepareInsertLocationSpec(MboRemote classSpecUseWith)
                                          throws MXException,
                                                 java.rmi.RemoteException
        08-21999
        Throws:
        MXException
        java.rmi.RemoteException
      • getValueToCrossOver

        public java.lang.String getValueToCrossOver(java.lang.String srcAttrCSNN,
                                                    java.lang.String tgtSpecObj,
                                                    java.lang.String tgtSpecAttr)
                                             throws MXException,
                                                    java.rmi.RemoteException
        Handles the setting of crossover values from CLASSSPEC.CS01 through CS05 to ASSETSPEC.ES01 through ES05, LOCATIONSPEC.LS01 through LS05 and ITEMSPEC.IS01 through IS05 when propagating a newly added CLASSSPEC attribute to its USEWITH objects (ASSETSPEC, LOCATIONSPEC, and/or ITEMSPEC) when there are more than 3000 USEWITH objects.
        Specified by:
        getValueToCrossOver in interface ClassSpecRemote
        Parameters:
        srcAttrCSNN - source crossover value. Can be CLASSSPEC.CS01 through CLASSSPEC.CS05
        tgtSpecObj - ASSETSPEC, LOCATIONSPEC or ITEMSPEC.
        tgtSpecAttr - target to receive the crossover value. Can be ASSETSPEC.ES01 through ASSETSPEC.ES05, LOCATIONSPEC.LS01 through LOCATIONSPEC.LS05 or ITEMSPEC.IS01 through ITEMSPEC.IS05.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        ClassSpec.getValueToCrossOver(String, String, String)
      • canChangeOrgSite

        public void canChangeOrgSite(MboValue orgSiteMbv)
                              throws MXException,
                                     java.rmi.RemoteException
        08-25617: returns true if the orgid or siteid can be changed
        Parameters:
        relationship: - can be "CLASSSPEC" or "CHILDREN"
        orgOrSiteAttr -
        orgOrSiteValue -
        Throws:
        MXException
        java.rmi.RemoteException
      • prepareDeleteSpecStatements

        protected void prepareDeleteSpecStatements()
                                            throws MXException,
                                                   java.rmi.RemoteException
        Prepare Delete Statements - delete itemspec/assetspec/locationspec
        Parameters:
        classSpecUseWith -
        Throws:
        MXException
        java.rmi.RemoteException
      • storeExistingSpec

        public java.util.Hashtable storeExistingSpec(MboSetRemote existingSpecSet,
                                                     java.lang.String attrName,
                                                     java.lang.String siteidORitemsetid)
                                              throws MXException,
                                                     java.rmi.RemoteException
        IV43892/94403: converts the initial assetspec, itemspec, or locaionspec to hashtable to allow fast access in addOtherSpecs - if the attribute being added in classspec was added in itemspec, locationspec, or assetspec, then do not add.
        Parameters:
        existingSpecSet -
        attrName - - could be itemnum, assetnum, or location
        siteid - - could be null(Itemspec), or siteid(locationspec and assetspec)
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • prepareInsertAssetSpecHist

        protected void prepareInsertAssetSpecHist(MboRemote classSpecUseWith)
                                           throws MXException,
                                                  java.rmi.RemoteException
        IV43913/94410: also insert into AssetSpecHist for more than 3000 assetspec records - for oracle and db2
        Parameters:
        classSpecUseWith -
        Throws:
        MXException
        java.rmi.RemoteException
      • addOtherSpecsLargeForSqlServer

        public void addOtherSpecsLargeForSqlServer(java.lang.String tableName,
                                                   java.lang.String where,
                                                   int counter)
                                            throws MXException,
                                                   java.rmi.RemoteException
        IV43913/94410: for large number of records - over 3000 - SQLServer - potentially run into arithmitic overflow problems. cannot use the direct insert statements - save incrementally.
        Parameters:
        tableName - - ASSET, ITEM, or LOCATIONS
        where - - whereclause to get the asset/item/locations that have the current classsstructureid but no assetattrid
        counter -
        Throws:
        MXException
        java.rmi.RemoteException
      • copyValuesToChildClassSpec

        public void copyValuesToChildClassSpec(MboRemote childClassSpec)
                                        throws MXException,
                                               java.rmi.RemoteException
        IV63669: copy the current value to child classSpec
        Parameters:
        childClassSpec -
        Throws:
        MXException
        java.rmi.RemoteException
      • setValue

        public void setValue(java.lang.String attributeName,
                             java.lang.String val,
                             long accessModifier)
                      throws MXException,
                             java.rmi.RemoteException
        IV69405: when new value is set to the assetattrid field on an existing classspec. Assetattrid is part of the index of CLASSSPEC, it cannot be changed. Normally, it is readonly. In the case of changing attribute on a specification(ex workorderspec, it also triggers the change of the CLASSSPEC.ASSETATTRID. I believe this is because the relationship. For example, WORKORDERSPEC to CLASSSPEC is on workorder.classspecid=classspec.classspecid. The classspecid uniquely identifies a classspec record. Relationship classspec is used on wotrack.xml.
        Specified by:
        setValue in interface MboRemote
        Overrides:
        setValue in class Mbo
        Parameters:
        attributeName - The attribute name within the current object.
        val - The string value to set to the attribute.
        accessModifier - The bitwise flags such as NOACCESSCHECK, NOVALIDATION_AND_NOACTION, and DELAYVALIDATION.
        Throws:
        MXException - "Attribute {0} does not exist" exception will be thrown if the attribute does not exist in the object. "Field is read only" exception will be thrown if the attribute is READONLY and the accessModifier does not specify NOACCESSCHECK. "Invalid Data Type" exception will be thrown for datatype mismatch. For example, setting a string value of characters to an attribute which has datatype of YORN.
        java.rmi.RemoteException
        See Also:
        Mbo.setValue(String,String,long)
      • getMinMaxSeq

        public long getMinMaxSeq(java.lang.String select)
                          throws MXException,
                                 java.rmi.RemoteException
        IV80493
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getUserDefinedRequired

        public java.lang.String[] getUserDefinedRequired(java.lang.String specName,
                                                         int startingIndex)
                                                  throws MXException,
                                                         java.rmi.RemoteException
        IV80493
        Parameters:
        specName -
        startingIndex - - the last harded is 14 so the passed is 16
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException