Class FormVersionAPI


public class FormVersionAPI extends AEntityAPI<FormVersion>
API class for manipulation of FormVersion entities.
Author:
XIMA MEDIA GmbH
  • Constructor Details

    • FormVersionAPI

      public FormVersionAPI()
  • Method Details

    • create

      public FormVersion create(UserContext uc, FormVersion formVersion, boolean isFirstFormVersion)
      Method for creating a FormVersion entity.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      formVersion - FormVersion which should be created.
      isFirstFormVersion - Boolean if this is the first FormVersion or just a derivation of an existing one.
      Returns:
      FormVersion which was created.
      Since:
      2.4.3
    • getBy

      public FormVersion getBy(UserContext uc, Projekt projekt, int formVersionNumber)
      Method for determining a FormVersion based of a Projekt and a version number.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      projekt - Projekt in which the FormVersion is searched.
      formVersionNumber - Integer the version number.
      Returns:
      FormVersion which was searched.
      Since:
      2.4.3
    • getByProjekt

      public List<FormVersion> getByProjekt(UserContext uc, Projekt projekt)
      Method for loading of FormVersions of a Projekt. Methode zum Laden von FormVersionen eines Projekts. This must be used in the frontend server to pick up the lazy-initialized list of FormVersions.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      projekt - Projekt for which the FormVersions to be picked up.
      Returns:
      List with FormVersions.
      Since:
      2.4.3
    • getByVersionNumber

      public FormVersion getByVersionNumber(UserContext uc, Integer formVersionNumber, Long projectId)
      Gets a form version by its version number. Defaults to the project's current version if the version number is null or no form version with the given version number exists.
      Parameters:
      uc - The user context of the user who requests the form version.
      formVersionNumber - The version number of the form version to get.
      projectId - ID of the project to get the form version for.
      Returns:
      The form version with the given version number or the project's current version if the version number is null or no form version with the given version number exists.
      Since:
      8.3.0
    • getFormVersionCount

      public int getFormVersionCount(UserContext uc, Projekt projekt)
      Method for determining the number of FormVersions of a Projekt.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      projekt - Projekt whose number of FormVersions should be determined.
      Returns:
      Integer the number of FormVersions.
      Since:
      2.4.3
    • getFormElemente

      public List<FormElement> getFormElemente(UserContext uc, FormVersion formVersion)
      Method to submit all FormElements of a FormVersion. This must be used in the frontend server to pick up the lazy-initialized list of FormElements.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      formVersion - for which the list of FormElement should be loaded.
      Returns:
      List of type FormElement.
      Since:
      2.4.3
    • getFormAsJSON

      public com.alibaba.fastjson.JSONObject getFormAsJSON(UserContext uc, FormVersion fv) throws IOException, com.alibaba.fastjson.JSONException
      This method deliver the JSON for creating a XForm without any styles. This functionality is used for internal processing and ensures that the FD2 project remains independent.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      fv - the FormVersion which indicates which JSON should be loaded.
      Returns:
      The form as JSON.
      Throws:
      IOException - Error reading the form file.
      com.alibaba.fastjson.JSONException - Error converting form file content to a JSON.
    • getFormAsString

      public String getFormAsString(UserContext uc, FormVersion fv) throws IOException, com.alibaba.fastjson.JSONException
      Throws:
      IOException
      com.alibaba.fastjson.JSONException
    • mergeFormElemente

      @Deprecated public com.alibaba.fastjson.JSONObject mergeFormElemente(UserContext uc, FormVersion fv) throws com.alibaba.fastjson.JSONException, IOException
      Deprecated.
      Throws:
      com.alibaba.fastjson.JSONException
      IOException