public MessageProcessInfoModel getMessageProcessInfo(String strMessageInfoType, String strContactType, String strRequestType, String strMessageProcessType, String strProcessType)
    {
        int iOldKeyArea = this.getDefaultOrder();
        try {
            Record recMessageInfo = ((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReferenceRecord();
            int iMessageTypeID = ((ReferenceField)recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID)).getIDFromCode(strMessageInfoType);
            if (iMessageTypeID <= 0)
                return null;
            recMessageInfo.getField(MessageInfo.MESSAGE_INFO_TYPE_ID).setValue(iMessageTypeID);
            int iContactTypeID = ((ReferenceField)recMessageInfo.getField(MessageInfo.CONTACT_TYPE_ID)).getIDFromCode(strContactType);
            if (iContactTypeID <= 0)
                return null;
            recMessageInfo.getField(MessageInfo.CONTACT_TYPE_ID).setValue(iContactTypeID);
            int iRequestTypeID = ((ReferenceField)recMessageInfo.getField(MessageInfo.REQUEST_TYPE_ID)).getIDFromCode(strRequestType);
            if (iRequestTypeID <= 0)
                return null;
            recMessageInfo.getField(MessageInfo.REQUEST_TYPE_ID).setValue(iRequestTypeID);
            recMessageInfo.setKeyArea(MessageInfo.MESSAGE_INFO_TYPE_ID_KEY);
            if (recMessageInfo.seek(DBConstants.EQUALS))
            {
                this.setKeyArea(MessageProcessInfo.MESSAGE_INFO_ID_KEY);
                this.getField(MessageProcessInfo.MESSAGE_INFO_ID).moveFieldToThis((BaseField)recMessageInfo.getCounterField());
                int iMessageProcessTypeID = ((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getIDFromCode(strMessageProcessType);
                if (iMessageProcessTypeID <= 0)
                    return null;
                this.getField(MessageProcessInfo.MESSAGE_TYPE_ID).setValue(iMessageProcessTypeID);
                int iProcessTypeID = ((ReferenceField)this.getField(MessageProcessInfo.PROCESS_TYPE_ID)).getIDFromCode(strProcessType);
                if (iProcessTypeID <= 0)
                    return null;
                this.getField(MessageProcessInfo.PROCESS_TYPE_ID).setValue(iProcessTypeID);
                
                if (this.seek(null))
                    return this;
            }
            // Try the parent contact type
            Record recContactType = ((ReferenceField)recMessageInfo.getField(MessageInfo.CONTACT_TYPE_ID)).getReferenceRecord();
            if (recContactType != null)
            {
                recContactType = ((ReferenceField)recContactType.getField(ContactType.PARENT_CONTACT_TYPE_ID)).getReference();
                if (recContactType != null)
                    if ((recContactType.getEditMode() == DBConstants.EDIT_CURRENT) || (recContactType.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
                {
                    strContactType = recContactType.getField(ContactType.CODE).toString();
                    if (strContactType != null)
                        return this.getMessageProcessInfo(strMessageInfoType, strContactType, strRequestType, strMessageProcessType, strProcessType);
                }
            }
        } catch (DBException ex)    {
            ex.printStackTrace();
        } finally {
            this.setKeyArea(iOldKeyArea);   // Set this back
        }
        return null;
    }
public MessageProcessInfoModel getMessageProcessInfo ( String strMessageInfoType , String strContactType , String strRequestType , String strMessageProcessType , String strProcessType ) { int iOldKeyArea = this . getDefaultOrder ( ) ; try { Record recMessageInfo = ( ( ReferenceField ) this . getField ( MessageProcessInfo . MESSAGE_INFO_ID ) ) . getReferenceRecord ( ) ; int iMessageTypeID = ( ( ReferenceField ) recMessageInfo . getField ( MessageInfo . MESSAGE_INFO_TYPE_ID ) ) . getIDFromCode ( strMessageInfoType ) ; if ( iMessageTypeID <= 0 ) return null ; recMessageInfo . getField ( MessageInfo . MESSAGE_INFO_TYPE_ID ) . setValue ( iMessageTypeID ) ; int iContactTypeID = ( ( ReferenceField ) recMessageInfo . getField ( MessageInfo . CONTACT_TYPE_ID ) ) . getIDFromCode ( strContactType ) ; if ( iContactTypeID <= 0 ) return null ; recMessageInfo . getField ( MessageInfo . CONTACT_TYPE_ID ) . setValue ( iContactTypeID ) ; int iRequestTypeID = ( ( ReferenceField ) recMessageInfo . getField ( MessageInfo . REQUEST_TYPE_ID ) ) . getIDFromCode ( strRequestType ) ; if ( iRequestTypeID <= 0 ) return null ; recMessageInfo . getField ( MessageInfo . REQUEST_TYPE_ID ) . setValue ( iRequestTypeID ) ; recMessageInfo . setKeyArea ( MessageInfo . MESSAGE_INFO_TYPE_ID_KEY ) ; if ( recMessageInfo . seek ( DBConstants . EQUALS ) ) { this . setKeyArea ( MessageProcessInfo . MESSAGE_INFO_ID_KEY ) ; this . getField ( MessageProcessInfo . MESSAGE_INFO_ID ) . moveFieldToThis ( ( BaseField ) recMessageInfo . getCounterField ( ) ) ; int iMessageProcessTypeID = ( ( ReferenceField ) this . getField ( MessageProcessInfo . MESSAGE_TYPE_ID ) ) . getIDFromCode ( strMessageProcessType ) ; if ( iMessageProcessTypeID <= 0 ) return null ; this . getField ( MessageProcessInfo . MESSAGE_TYPE_ID ) . setValue ( iMessageProcessTypeID ) ; int iProcessTypeID = ( ( ReferenceField ) this . getField ( MessageProcessInfo . PROCESS_TYPE_ID ) ) . getIDFromCode ( strProcessType ) ; if ( iProcessTypeID <= 0 ) return null ; this . getField ( MessageProcessInfo . PROCESS_TYPE_ID ) . setValue ( iProcessTypeID ) ; if ( this . seek ( null ) ) return this ; } Record recContactType = ( ( ReferenceField ) recMessageInfo . getField ( MessageInfo . CONTACT_TYPE_ID ) ) . getReferenceRecord ( ) ; if ( recContactType != null ) { recContactType = ( ( ReferenceField ) recContactType . getField ( ContactType . PARENT_CONTACT_TYPE_ID ) ) . getReference ( ) ; if ( recContactType != null ) if ( ( recContactType . getEditMode ( ) == DBConstants . EDIT_CURRENT ) || ( recContactType . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) ) { strContactType = recContactType . getField ( ContactType . CODE ) . toString ( ) ; if ( strContactType != null ) return this . getMessageProcessInfo ( strMessageInfoType , strContactType , strRequestType , strMessageProcessType , strProcessType ) ; } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } finally { this . setKeyArea ( iOldKeyArea ) ; } return null ; }
GetMessageProcessInfo Method.