示例#1
0
  /**
   * @param containerForSelectedForm
   * @return
   */
  private String getFormDetailsXML(
      HttpServletRequest request,
      String selectedFormName,
      ContainerInterface containerForSelectedForm) {
    String formName = selectedFormName;
    String formDescription = "";
    String formConceptCode = "";
    String operationMode = Constants.ADD_SUB_FORM_OPR;
    boolean isAbstract = false;
    String parentEntity = "";
    if (containerForSelectedForm != null) {
      formName = containerForSelectedForm.getCaption();
      EntityInterface entity = containerForSelectedForm.getEntity();
      if (entity != null) {
        formDescription = entity.getDescription();
        formConceptCode = SemanticPropertyBuilderUtil.getConceptCodeString(entity);
        isAbstract = entity.isAbstract();
        if (containerForSelectedForm.getBaseContainer() != null) {
          parentEntity = containerForSelectedForm.getBaseContainer().getId().toString();
        }
      }
      operationMode = Constants.EDIT_FORM;
    }
    // If selected form container is null and cache container interface is also null,
    // it means that there is no container in cache and a new form is to be created.

    if (containerForSelectedForm == null) {
      ContainerInterface mainContainerInterface =
          (ContainerInterface)
              CacheManager.getObjectFromCache(request, Constants.CONTAINER_INTERFACE);
      if (mainContainerInterface == null) {
        operationMode = Constants.ADD_NEW_FORM;
      }
    }
    String formDetailsXML =
        createFormDetailsXML(
            formName, formDescription, formConceptCode, operationMode, isAbstract, parentEntity);
    if (formDetailsXML == null) {
      formDetailsXML = "";
    }
    return formDetailsXML;
  }
示例#2
0
 /**
  * @param request
  * @param selectedFormId
  * @return
  * @throws DynamicExtensionsApplicationException
  * @throws DynamicExtensionsSystemException
  */
 private String getSelectedFormDetailsById(HttpServletRequest request, String selectedFormId)
     throws DynamicExtensionsSystemException, DynamicExtensionsApplicationException {
   ContainerInterface containerForSelectedForm = null;
   String formName = "", formDescription = "", formConceptCode = "", parentEntity = "";
   boolean isAbstract = false;
   if (selectedFormId != null) {
     containerForSelectedForm = DynamicExtensionsUtility.getContainerByIdentifier(selectedFormId);
     if (containerForSelectedForm != null) {
       formName = containerForSelectedForm.getCaption();
       EntityInterface entity = containerForSelectedForm.getEntity();
       if (entity != null) {
         formDescription = entity.getDescription();
         if (formDescription == null) {
           formDescription = "";
         }
         formConceptCode = SemanticPropertyBuilderUtil.getConceptCodeString(entity);
         if (formConceptCode == null) {
           formConceptCode = "";
         }
         isAbstract = entity.isAbstract();
         if (containerForSelectedForm.getBaseContainer() != null) {
           parentEntity = containerForSelectedForm.getBaseContainer().getId().toString();
         }
       }
     }
   }
   String formDetailsXML =
       createFormDetailsXML(
           formName,
           formDescription,
           formConceptCode,
           Constants.ADD_SUB_FORM_OPR,
           isAbstract,
           parentEntity);
   if (formDetailsXML == null) {
     formDetailsXML = "";
   }
   return formDetailsXML;
 }