/** * @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; }
/** * @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 ""; }