psdi.mbo

Class MAXTableDomain

    • Field Detail

      • ISNULL

        public static final java.lang.String ISNULL
        The condition used for conditional list where. The condition is true when value of the attribute is null.
        See Also:
        Constant Field Values
      • ISNOTNULL

        public static final java.lang.String ISNOTNULL
        The condition used for conditional list where. The condition is true when value of the attribute is not null.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MAXTableDomain

        public MAXTableDomain(MboValue mbv)
        Construct passing the field to which you are listening
    • Method Detail

      • validate

        public void validate()
                      throws MXException,
                             java.rmi.RemoteException
        Validate that the MboSet returned used using either the relationship, or the where clause is not empty. If it is empty, throw an MXAPPLICATIONEXception. If there are attributes as part of the foreign key that don't allow null when this attribute is set, exception will be thrown if the value is empty.
        Specified by:
        validate in interface MboValueListener
        Overrides:
        validate in class MboValueAdapter
        Throws:
        MXException
        java.rmi.RemoteException
      • chooseActualDomainValues

        public void chooseActualDomainValues()
                                      throws MXException,
                                             java.rmi.RemoteException
        Set the relationship, the listcriteria and error message bundle and key based on the current records' site org level, whether it is in search mode and if site or org specific domain values are specified for this domain. It will choose the relationship, list where and error message bundle and key from the maxtabledomain record specific for this site or org, or further up if no specific value is set. If it is in search mode, and the site or org is not specified, the very first list where will be used for the list.
        Overrides:
        chooseActualDomainValues in class BasicDomain
        Throws:
        MXException
        java.rmi.RemoteException
      • getMboSet

        public MboSetRemote getMboSet(java.lang.String where)
                               throws MXException,
                                      java.rmi.RemoteException
        Get a mboset, using the specified where clause
        Parameters:
        where -
        Returns:
        MboSetRemote Object
        Throws:
        MXException
        java.rmi.RemoteException
      • getMboSet

        public MboSetRemote getMboSet(java.lang.String where,
                                      java.lang.String identifier)
                               throws MXException,
                                      java.rmi.RemoteException
        This method allows the caller to specify an identifier to make the relationship build on the fly bear its unique name.
        Parameters:
        where -
        identifier -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • getMboSet

        public MboSetRemote getMboSet()
                               throws MXException,
                                      java.rmi.RemoteException
        Get the MboSet
        Returns:
        MboSetRemote Object
        Throws:
        MXException
        java.rmi.RemoteException
      • setRelationship

        public void setRelationship(java.lang.String objectName,
                                    java.lang.String whereClause)
        Set how this MboValue gets to the object to which it wants to vaildate against
        Parameters:
        objectName -
        whereClause -
      • setListCriteria

        public void setListCriteria(java.lang.String listWhere)
        Set what the criteria for the list of valid values are. Usually this is left blank to allow anything in the foreign MboSet to be selected.
        Parameters:
        listWhere -
      • setListOrderBy

        public void setListOrderBy(java.lang.String orderBy)
        Set the list order by clauses used by the look up.
        Parameters:
        orderBy -
      • setErrorMessage

        public void setErrorMessage(java.lang.String eg,
                                    java.lang.String ek)
        Set the error group and key of message that is produced if validation fails. If not set, a system default message is used.
        Parameters:
        eg -
        ek -
      • getListCriteria

        public java.lang.String getListCriteria()
        Get the current listwhere clause as it is set by setListCriteria
        Returns:
        Throws:
        MXException
      • setValueFromLookup

        public void setValueFromLookup(MboRemote sourceMbo,
                                       long accessModifier)
                                throws MXException,
                                       java.rmi.RemoteException
        Set the value of the field and other fields which are part of the forein key from the sourceMbo to the Mbo that this mbo value belongs to. Which attribute to set from the lookup mbo to the target mbo is defined by setLookupKeyMapInOrder() method or the algorithm implmented in getMatchingAttrs().
        Parameters:
        sourceMbo -
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        #getMatchingAttrs(), #setLookupKeyMapInOrder()
      • getMatchingAttrs

        protected java.lang.String[][] getMatchingAttrs(java.lang.String sourceName)
                                                 throws MXException,
                                                        java.rmi.RemoteException
        This method retieves the lookup attribute mapping from the lookup source table to the target table by looking at the MAXLOOKUPMAP table if the mapping is specified there. If the mapping is not in the database, it will use the primary key columns of the target table to figure out the mapping. If the mapping cannot be obtained, an exception will be thrown. This method is only called if setLookupKeyMapInOrder() is not invoked before the mapping is used. In the derived class, you can call setLookupKeyMapInOrder() and setNotNullAttrs() in the constructor or setDomain() method to provide the attribut mapping. You would only need to overwrite this class if the default behavior to lookup the mapping is different in the derived class. This method first checks if there are entries for this attribute registered in maxlookupmap table. If it is, the mapping defined by the table will be fetched. If the mapping doesn't exist in maxlookupmap table. The following algorithm is used to determine the mapping. The framework first gets all the primary column names of the source mbo and then checks whether fields with the same names exist in the target mbo. If they do exist and the lookup attribute is one of them, a match is considered found. But if all the attributes with the same name exist in the target mbo, but none of them is the lookup attribute, it means that there is another field, not the lookup attribute is wrongly matched. The framework then checks if there is only one field among the keys of the source table has the same same as column and object as the lookup attribute or it is the same as column of the lookup attribute. Only if there is, the match will be corrected to the lookup attribute. If there is only one unmatched attribute left and the lookup attribute is not among the matched ones, it will check if the unmatched and the lookup attribute has the same same as object and column or if the source key is the same as column of the lookup attribute. If so, a match is considered done. All other cases will throw exception.
        Parameters:
        sourceMbo - the Mbo which is selected by the lookup.
        Returns:
        The key mapping is returned as tring[][2] Each element is a pair of target key and source key. Target key is at index 0, and source key is at index 1.
        Throws:
        MXException
        java.rmi.RemoteException
      • setLookupKeyMapInOrder

        public void setLookupKeyMapInOrder(java.lang.String[] targetKeys,
                                           java.lang.String[] sourceKeys)
        This method should be called to identify which attribute on the lookup MBO should be set to which attribute on the target MBO when the lookup returns. The order should be in the same sequence when the values will actually be set. This order is especially important if there are any attribute that cannot be null when the other attribute is set. In this case, the cannot be null attribute should be ahead in the order. The values in both array for the same index are the matching attributes. If there is only one key attribute of the lookup table, the attribute should also be specified here. This method should be called in the constructor or when domain id is set.
        Parameters:
        targetKeys - the attribute names of the target
        sourceKeys - the attribute names of the lookup table.
      • setKeyMap

        public void setKeyMap(java.lang.String sourceMboName,
                              java.lang.String[] targetKeys,
                              java.lang.String[] sourceKeys)
        Set the key maps from the source mbo to the target mbo. Use this method is the source mbo is not the lookup mbo. For instance if the app which "go to app" links to is not the same mbo that the lookup is pointing to. If your applink points to different objects, you can call this method more than once, one for each different object.
        Parameters:
        sourceMboName -
        targetKeys -
        sourceKeys -
      • setLookupKeyMapInOrder

        public void setLookupKeyMapInOrder(java.lang.String[][] map)
        This method should be called to identify which attribute on the lookup MBO should be set to which attribute on the target MBO when the lookup returns. The order should be in the same sequence when the values will actually be set. This order is especially important if there are any attribute that cannot be null when the other attribute is set. In this case, the cannot be null attribute should be ahead in the order. If there is only one key attribute of the lookup table, the attribute should also be specified here. This method should be called in the constructor or when domain id is set. * @param map The array of String[2]. First one is the attribute of the target MBO and the second one is the attribute of the lookup table.
      • addToLookupMapCache

        public void addToLookupMapCache(java.lang.String source,
                                        java.lang.String[][] map)
                                 throws MXException,
                                        java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • setAllAttrsNullable

        public final void setAllAttrsNullable()
        Method to tell the validation routine that it doesn't need to check if there are any attributes composing the foreign key other than this attribute can not be empty when this attribute is set.
        See Also:
        MAXTableDomain.setNotAllowNullAttrs(java.lang.String[])
      • setNotAllowNullAttrs

        public final void setNotAllowNullAttrs(java.lang.String[] attrs)
        Give a list of attributes which cannot be null before this attribute can be set. It is usually called during construction of the field validation class.
        Parameters:
        attrs -
      • setMultiKeyWhereForLookup

        public void setMultiKeyWhereForLookup(java.lang.String w)
        Sets the where clause for multi-key lookup. This whereclause will be used if listwhere is not specified. Call this method if you want to provide a different default multi-key lookup where clause for the derived field validation listner. This whereclause only takes effect if listwhere is not set. If listwhere is set explicitly, the list where will be used solely to get the lookup mbo set.
      • smartFill

        public MboSetRemote smartFill(java.lang.String value,
                                      boolean exact)
                               throws MXException,
                                      java.rmi.RemoteException
        Get the list based on the qbe value of the attribute, and set the values if there is only one MBO in the returned set.
        Specified by:
        smartFill in interface MboValueListener
        Overrides:
        smartFill in class MboValueAdapter
        Parameters:
        value - the value the ther has entered in this field.
        exact - whether the list is retrieved use exact qbe.
        Throws:
        MXException
        java.rmi.RemoteException
      • smartFillWithoutReset

        public MboSetRemote smartFillWithoutReset(java.lang.String value,
                                                  boolean exact)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Get the list based on the value user entered for this attribute, and set the values if there is only one MBO in the returned set. Different from smartFill(), this method doesn't reset the MBO set returned by getList(). If in your derived field validation class, the result of your getList() shouldn't be reset and you still want to support smartfill, Overwrite smartFill() in your field validation by calling this method. This method is not equivalent to smartFill. It is more expensive, and doesn't support full QBE syntax when the user puts the value into the field. It only allows plain text representing the value without any operator or wild character. It doesn't support any other QBE expression.
        Parameters:
        value - the value the ther has entered in this field.
        Returns:
        the attribute map if found.
        Throws:
        MXException
        java.rmi.RemoteException
      • smartFindWithoutReset

        public MboSetRemote smartFindWithoutReset(java.lang.String value,
                                                  boolean exact)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Get the list based on the qbe value of the attribute.
        Throws:
        MXException
        java.rmi.RemoteException
      • smartFind

        public MboSetRemote smartFind(java.lang.String sourceObj,
                                      java.lang.String value,
                                      boolean exact)
                               throws MXException,
                                      java.rmi.RemoteException
        Get the list based on the qbe value of the attribute. This normally is used by applink. The list criteria of the field is ignored.
        Specified by:
        smartFind in interface MboValueListener
        Overrides:
        smartFind in class MboValueAdapter
        Throws:
        MXException
        java.rmi.RemoteException
      • addConditionalListWhere

        public void addConditionalListWhere(java.lang.String attribute,
                                            java.lang.String condition,
                                            java.lang.String where)
        Add conditional list where. The list where will only be part of the list where clause when the condition met for the attribute.
        Parameters:
        attribute - The attribute name of the current mbo which is evaluated to the condition.
        condition - ISNULL or ISNOTNULL,
        where - The where clause which is part of the list where if the condition met.
      • clearConditionalListWhere

        public void clearConditionalListWhere()
        Clear all the conditional list where. If you are overwriting the list criteria that now it doesn't contain a conditional list where or you are setting a different conditional listwhere, you must call this method first.
      • evalConditionalWhere

        public java.lang.String evalConditionalWhere(java.util.ArrayList conditionalWhereList)
                                              throws MXException,
                                                     java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException