Beispiel #1
0
 /**
  * @param parameter
  * @return
  * @throws DynamicExtensionsApplicationException
  * @throws DynamicExtensionsSystemException
  */
 private List<NameValueBean> getAttributesForForm(String formId)
     throws DynamicExtensionsSystemException, DynamicExtensionsApplicationException {
   ArrayList<NameValueBean> formAttributesList = new ArrayList<NameValueBean>();
   if (formId != null) {
     Logger.out.debug("Fetching attributes for [" + formId + "]");
     ContainerInterface container = DynamicExtensionsUtility.getContainerByIdentifier(formId);
     if (container != null) {
       // Collection<ControlInterface> controlCollection = container.getControlCollection();
       Collection<ControlInterface> controlCollection = container.getAllControls();
       if (controlCollection != null) {
         NameValueBean controlName = null;
         AbstractAttributeInterface abstractAttribute = null;
         AttributeInterface attribute = null;
         for (ControlInterface control : controlCollection) {
           if (control != null) {
             // if control contains Attribute interface object then only show on UI.
             // If control contains association objects do not show in attribute list
             abstractAttribute = control.getAbstractAttribute();
             if (abstractAttribute != null && (abstractAttribute instanceof AttributeInterface)) {
               attribute = (AttributeInterface) abstractAttribute;
               if (!(attribute.getAttributeTypeInformation()
                   instanceof FileAttributeTypeInformation)) {
                 controlName = new NameValueBean(control.getCaption(), control.getId());
                 formAttributesList.add(controlName);
               }
             }
           }
         }
       }
     }
   }
   return formAttributesList;
 }
Beispiel #2
0
 /**
  * @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;
 }
Beispiel #3
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;
  }
Beispiel #4
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;
 }
Beispiel #5
0
  /**
   * @param request
   * @param gridControlsIds
   * @return
   */
  private String updateControlsSequence(HttpServletRequest request, String controlsSeqNumbers) {
    System.out.println("ControlsId " + controlsSeqNumbers);
    ContainerInterface containerInterface = WebUIManager.getCurrentContainer(request);
    if (containerInterface != null) {
      Collection<ControlInterface> oldControlsCollection =
          containerInterface.getControlCollection();
      if (oldControlsCollection != null) {
        Integer[] sequenceNumbers =
            DynamicExtensionsUtility.convertToIntegerArray(
                controlsSeqNumbers, ProcessorConstants.CONTROLS_SEQUENCE_NUMBER_SEPARATOR);
        ControlInterface[] oldControlsArray =
            oldControlsCollection.toArray(new ControlInterface[oldControlsCollection.size()]);

        // adding id attribute to attributecollection
        AttributeInterface idAttribute = null;
        Collection<AttributeInterface> attributeCollection =
            containerInterface.getEntity().getAttributeCollection();
        for (AttributeInterface attributeIterator : attributeCollection) {
          // Added null check for bug 6013
          if (attributeIterator.getColumnProperties() != null
              && attributeIterator.getColumnProperties().getName() != null
              && attributeIterator
                  .getColumnProperties()
                  .getName()
                  .equals(DynamicExtensionsQueryBuilderConstantsInterface.IDENTIFIER)) {
            idAttribute = attributeIterator;
            break;
          }
        }

        // remove old controls from collection
        containerInterface.removeAllControls();
        containerInterface.getEntity().removeAllAbstractAttributes();
        ControlInterface control = null;
        if (sequenceNumbers != null) {
          for (int i = 0; i < sequenceNumbers.length; i++) {
            control =
                DynamicExtensionsUtility.getControlBySequenceNumber(
                    oldControlsArray, sequenceNumbers[i].intValue());
            System.out.println(control);
            if (control != null) {
              containerInterface.addControl(control);
              containerInterface.getEntity().addAbstractAttribute(control.getAbstractAttribute());
            }
          }
        }
        if (idAttribute != null) {
          containerInterface.getEntity().addAbstractAttribute(idAttribute);
        }
        // Added by Rajesh for removing deleted associations and it's path from path tables.
        List<Long> deletedIdList =
            (List<Long>)
                CacheManager.getObjectFromCache(
                    request, WebUIManagerConstants.DELETED_ASSOCIATION_IDS);
        List<Long> listOfIds =
            DynamicExtensionsUtility.getDeletedAssociationIds(oldControlsArray, sequenceNumbers);
        if (deletedIdList == null) {
          deletedIdList = listOfIds;
        } else {
          deletedIdList.addAll(listOfIds);
        }
        CacheManager.addObjectToCache(
            request, WebUIManagerConstants.DELETED_ASSOCIATION_IDS, deletedIdList);
        //				System.out.println("deletedIdList : " + deletedIdList.size());
      }
    }

    System.out.println("Coontrols Colln : ");
    Collection<ControlInterface> controlCollection = containerInterface.getControlCollection();
    for (ControlInterface control : controlCollection) {
      System.out.println("[" + control.getSequenceNumber() + "] = [" + control.getCaption() + "]");
    }
    return "";
  }