Class FormDao


public class FormDao extends AbstractDao
Provides a DAO for the Form entity.
See Also:
  • Constructor Details

    • FormDao

      public FormDao()
  • Method Details

    • getFormFromPK

      public Form getFormFromPK(Object id)
      Return the form with the specified OID
      Parameters:
      id - the OID
      Returns:
      the matching form, or null if not found
    • getFormByFormCode

      public Form getFormByFormCode(String formCode)
      Return the form with the specified form code.
      Parameters:
      formCode - the form code
      Returns:
      the form, or null if none was found
    • getFormByFormCode

      public Form getFormByFormCode(String formCode, boolean refresh)
      Return the form with the specified form code.
      Parameters:
      formCode - the form code
      refresh - refresh the local cache
      Returns:
      the form, or null if none was found
    • getFormByFormCodeIgnoreCase

      public Form getFormByFormCodeIgnoreCase(String formCode)
      Return the form with the specified form code performing an ignore-case query to support Oracle database.
      Parameters:
      formCode - the form code
      Returns:
      the form, or null if none was found
      Since:
      17.10.0
    • getActiveProductionFormByFormCode

      public Form getActiveProductionFormByFormCode(String formCode)
      Return the form with the specified form, prefetching the client. Only active forms that are not in test mode are considered.
      Parameters:
      formCode - the form code
      Returns:
      the active non-test form, or null if none was found
    • getFormBySubmitKey

      public Form getFormBySubmitKey(String submitKey)
      Return the form associated with the specified submission, prefetching the client and current template version
      Parameters:
      submitKey - the surrogate key of the submission
      Returns:
      the form, or null if none was found
    • getActiveAndProductionFormList

      public List<Form> getActiveAndProductionFormList()
      Return the list of forms that are active and not in test mode and whose client is also active, sorted by form name.
      Returns:
      the list of matching forms
    • getActiveForms

      public List<Form> getActiveForms(boolean includeTestForms)
      Return the list of forms that are active and whose client is also active, sorted by form name.
      Parameters:
      includeTestForms - whether to include forms in test mode
      Returns:
      the list of matching forms
    • getFormsByDeliveryDetails

      public List<Form> getFormsByDeliveryDetails(DeliveryDetails deliveryDetails, boolean isTestDelivery)
      Gets the forms by delivery details.
      Parameters:
      deliveryDetails - the delivery details
      isTestDelivery - the is test delivery
      Returns:
      the forms by delivery details
      Since:
      4.0.0
    • getFormListIds

      public List<Form> getFormListIds(List<Long> formIds, UserAccount userAccount)
      Return the list of forms for the given form IDs filtered for the users access.
      Parameters:
      formIds - the list of form IDs (required)
      userAccount - the logged in user account (required)
      Returns:
      the list of forms for the given form IDs
      Since:
      4.3.2
    • getFormListForIds

      public List<Form> getFormListForIds(List<Long> formIds)
      Return the list of forms for the given form IDs.
      Parameters:
      formIds - the list of form IDs
      Returns:
      the list of forms for the given form IDs
    • getFormListForClient

      public List<Form> getFormListForClient(String clientId)
      Return the list of forms filtered by client when specified, sorted by form name. This query uses a fetch limit of 10000.
      Parameters:
      clientId - the client id
      Returns:
      the list of matching forms
    • getActiveFormListForClient

      public List<Form> getActiveFormListForClient(String clientId)
      The list of active forms for a specific client This query uses a fetch limit of 10000.
      Parameters:
      clientId - the OID of the client (optional)
      Returns:
      the list of forms
    • getActiveFormListForPortal

      public List<Form> getActiveFormListForPortal(Portal portal, boolean includeTestForms)
      Return the list of active form for a specific portal
      Parameters:
      portal - the portal object
      includeTestForms - if set to false, the search will include only non-test forms; otherwise, forms will be included regardless of their test mode
      Returns:
      the list of matching forms, or an empty list if no portal was specified
    • getFormList

      public List<Form> getFormList(String clientId, boolean activeForms)
      Return the form list for the given client and active form flag.
      Parameters:
      clientId - the client id
      activeForms - the active form flag
      Returns:
      the form list for the given client and active form flag
    • getFormList

      public List getFormList(String clientId, String portalId, String keyword, List<String> status, Boolean test, String sortBy)
      Return information about forms that match the specified search criteria
      Parameters:
      clientId - the OID of the client (optional)
      portalId - the OID of the portal associated with the form (optional)
      keyword - a search keyword
      status - a set of form status to include in the search
      test - if set to false, only non-test forms are considered; otherwise, forms are not filtered by test mode
      sortBy - the sort form list by [ Form Name | Modified Date | Modified By | Created Date ]
      Returns:
      a list of matching DataRow objects containing form-related information
    • getFormList

      public List getFormList(String clientId, String portalId, String keyword, String formType, List<String> status, Boolean test, String sortBy)
      Return information about forms that match the specified search criteria
      Parameters:
      clientId - the OID of the client (optional)
      portalId - the OID of the portal associated with the form (optional)
      keyword - a search keyword
      formType - the template version form type
      status - a set of form status to include in the search
      test - if set to false, only non-test forms are considered; otherwise, forms are not filtered by test mode
      sortBy - the sort form list by [ Form Name | Modified Date | Modified By | Created Date ]
      Returns:
      a list of matching DataRow objects containing form-related information
      Since:
      5.0.0
    • getFormList

      public List getFormList(String clientId, String portalId, String keyword, Boolean active, Boolean test, String sortBy, int fetchLimit)
      Return information about forms that match the specified search criteria.
      Parameters:
      clientId - the OID of the client (optional)
      portalId - the OID of the portal associated with the form (optional)
      keyword - a search keyword
      active - if set, only active forms are considered; otherwise, only inactive forms are returned
      test - if set to false, only non-test forms are considered; otherwise, forms are not filtered by test mode
      sortBy - the sort form list by [ Form Name | Modified Date | Modified By | Created Date ]
      fetchLimit - the fetch limit
      Returns:
      a list of matching DataRow objects containing form-related information
    • getFormList

      public List getFormList(String clientId, String portalId, String keyword, String formType, List<String> status, Boolean test, String sortBy, int fetchLimit)
      Return information about forms that match the specified search criteria.
      Parameters:
      clientId - the OID of the client (optional)
      portalId - the OID of the portal associated with the form (optional)
      keyword - a search keyword
      formType - the template version form type
      status - a set of form status to include in the search
      test - if set to false, only non-test forms are considered; otherwise, forms are not filtered by test mode
      sortBy - the sort form list by [ Form Name | Modified Date | Modified By | Created Date ]
      fetchLimit - the fetch limit
      Returns:
      a list of matching DataRow objects containing form-related information
      Since:
      5.0.0
    • getFormsByName

      public List<Form> getFormsByName(String clientId, String name)
      Return a list of forms whose name contains a certain substring and belonging to a specific client, ordered by form name
      Parameters:
      clientId - the OID of the client
      name - a substring of the form name
      Returns:
      the list of matching forms
    • getFormByName

      public Form getFormByName(Client client, String name)
      Return a form with the specified name belonging to a specific client
      Parameters:
      client - the client object (optional)
      name - the form name (optional)
      Returns:
      the form matching the criteria (if multiple forms match, one of them is returned arbitrarily)
    • getFormByNameIgnoreCase

      public Form getFormByNameIgnoreCase(String clientCode, String formName)
      Return a form with a certain name and belonging to a specific client.
      Parameters:
      clientCode - the client code (not case sensitive)
      formName - the form name (not case sensitive)
      Returns:
      the matching form (if multiple forms match, one of them is returned arbitrarily)
    • getFormByNormalizedName

      public Form getFormByNormalizedName(Client client, String formNameNormalized)
      Return a form with the given normalized name belonging to a specific client
      Parameters:
      client - the client object (optional)
      formNameNormalized - the normalized form name
      Returns:
      the matching form (if multiple forms match, one of them is returned arbitrarily)
    • getFormsSearch

      public List<Form> getFormsSearch(String clientId, String value)
      Return a list of forms whose name or code contain the search string, or whose OID matches the search string if it is numeric
      Parameters:
      clientId - the OID of the client associated with the form
      value - the non-empty search string
      Returns:
      the list of matching forms
    • getFormListForKeywordLike

      public List<Form> getFormListForKeywordLike(String keyword, List<String> categoryNames, Portal portal)
      Return a list of forms matching the specified search criteria
      Parameters:
      keyword - a keyword to match against various form-related attributes
      categoryNames - the category name(s) to filter on (optional). If multiple categories are specified, at least one category has to match.
      portal - the non-null portal object which the forms must belong to
      Returns:
      the list of matching active non-test forms belonging to active clients
    • getFormCodesForKeywordLike

      public Set<String> getFormCodesForKeywordLike(String keyword, Portal portal, String clientName, String formNameLike, boolean includeAllForms)
      Return a set of form codes matching the specified search criteria
      Parameters:
      keyword - a keyword to match against various form-related attributes
      portal - the non-null portal object which the forms must belong to
      clientName - the name of the client associated with the form (optional)
      formNameLike - a substring of the form name (optional)
      includeAllForms - whether to include all forms (true) or only active non-test forms belonging to active clients (false)
      Returns:
      the set of form codes of matching forms
    • getActiveFormsWithFarKey

      public List<Form> getActiveFormsWithFarKey(String clientId, String farFormKey)
      Return the set of active forms for a given client matching a specified FAR form key
      Parameters:
      clientId - the OID of the client (required)
      farFormKey - the FAR form key (required)
      Returns:
      the list of matching forms
    • getActiveFilteredFormsForClient

      public List<Form> getActiveFilteredFormsForClient(String clientId, Collection<String> formIdsToExclude)
      Return the list of active forms for a client while excluding a set of forms
      Parameters:
      clientId - the OID of the client (required)
      formIdsToExclude - the collection of form IDs to exclude
      Returns:
      the list of matching forms
    • getFormByPortal

      public List<Form> getFormByPortal(Portal portal, String name)
      Gets the list of active forms by portal.
      Parameters:
      portal - the portal (required)
      name - a substring of the form name (optional)
      Returns:
      the list of forms
    • getNextVersionNumber

      public String getNextVersionNumber(Form form)
      Return the next template version number for the given form. If versions already exist, this will return the highest version number of incremented patch by 1; otherwise it will return "0.1.0".
      Parameters:
      form - the non-null form
      Returns:
      the next version number string
    • getFormForFormDesign

      public Form getFormForFormDesign(Long formDesignId)
      Return the form with the specified form design OID.
      Parameters:
      formDesignId - the form design ID (required)
      Returns:
      the form, or null if none was found
      Since:
      4.0.0
    • getFormGroupNames

      public List<String> getFormGroupNames(Form form)
      Return the list of form group names for the given form.
      Parameters:
      form - the form (required)
      Returns:
      the list of form group names for the given form
      Since:
      17.10.0