/**
  * @param groupName
  * @return
  * @throws DynamicExtensionsApplicationException
  * @throws DynamicExtensionsSystemException
  */
 private List<NameValueBean> getFormNamesForGroup(String groupId)
     throws DynamicExtensionsSystemException, DynamicExtensionsApplicationException {
   ArrayList<NameValueBean> formNames = new ArrayList<NameValueBean>();
   if (groupId != null) {
     EntityManagerInterface entityManager = EntityManager.getInstance();
     Long iGroupId = null;
     try {
       iGroupId = Long.parseLong(groupId);
       Collection<ContainerInterface> containerInterfaceList =
           entityManager.getAllContainersByEntityGroupId(iGroupId);
       if (containerInterfaceList != null) {
         // EntityInterface entity = null;
         NameValueBean formName = null;
         for (ContainerInterface entityContainer : containerInterfaceList) {
           if (entityContainer != null) {
             formName = new NameValueBean(entityContainer.getCaption(), entityContainer.getId());
             formNames.add(formName);
           }
         }
       }
     } catch (NumberFormatException e) {
       Logger.out.error("Group Id is null..Please check");
     }
   }
   return formNames;
 }
  /**
   * @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;
  }
 /**
  * @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;
 }