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