Class EditorUtils


  • public final class EditorUtils
    extends java.lang.Object
    • Method Detail

      • createComboItem

        public static org.zkoss.zul.Comboitem createComboItem​(java.lang.String label,
                                                              java.lang.Object value)
      • createTreeItem

        public static org.zkoss.zul.Treeitem createTreeItem​(TreeNodeData value,
                                                            boolean expanded)
      • createListItem

        public static org.zkoss.zul.Listitem createListItem​(ListItemDTO dto,
                                                            boolean isComplex,
                                                            java.util.List<java.lang.String> labels,
                                                            boolean inEditMode)
      • createMenuPopup

        public static org.zkoss.zul.Menupopup createMenuPopup​(java.util.List<java.lang.String> labels)
      • getNameFromLabel

        public static java.lang.String getNameFromLabel​(java.lang.String label)
      • getTypeFromLabel

        public static java.lang.String getTypeFromLabel​(java.lang.String label)
      • isInTreeChildren

        public static boolean isInTreeChildren​(java.lang.String label,
                                               org.zkoss.zul.Treechildren treechildren)
      • getRootIntegrationObjectItem

        public static IntegrationObjectItemModel getRootIntegrationObjectItem​(IntegrationObjectModel integrationObject)
        Determine the root ComposedType from a IntegrationObject's IntegrationObjectItems. The root is the IntegrationObjectItem which has no parent IntegrationObjectItem. Algorithm: every IntegrationObjectItem is also an IntegrationObjectItemAttribute with ReturnIntegrationObjectItem != null, except for the root.
      • filterAttributesForTree

        public static java.util.Set<AttributeDescriptorModel> filterAttributesForTree​(ReadService readService,
                                                                                      ComposedTypeModel parentType)
        Filters a set of attribute descriptors for Composed and Enumeration types that are not on the blacklist
        Parameters:
        readService - the IntegrationBackofficeReadService to read from the type system
        parentType - the parent ComposedTypeModel to get the attribute descriptors to filter
        Returns:
        a filtered set of AttributeDescriptorModel
      • filterAttributesForAttributesMap

        public static java.util.Set<AttributeDescriptorModel> filterAttributesForAttributesMap​(ReadService readService,
                                                                                               ComposedTypeModel parentType)
        Filters a set of attribute descriptors for types that are not on the blacklist
        Parameters:
        readService - the IntegrationBackofficeReadService to read from the type system
        parentType - the parent ComposedTypeModel to get the attribute descriptors to filter
        Returns:
        a filtered and sorted set of AttributeDescriptorModel
      • updateDTOs

        public static java.util.List<ListItemDTO> updateDTOs​(java.util.List<ListItemDTO> oldDTOs,
                                                             java.util.List<ListItemDTO> newDTOs)
        Updates attributes of a list of DTOs by getting the attributes of another list of DTOs
        Parameters:
        oldDTOs - a list of DTOs with attributes to update
        newDTOs - a list of DTOs containing updated attributes
        Returns:
        a list of DTOs with updated attributes
      • convertIntegrationObjectToDTOMap

        public static java.util.Map<ComposedTypeModel,​java.util.List<ListItemDTO>> convertIntegrationObjectToDTOMap​(ReadService readService,
                                                                                                                          IntegrationObjectModel integrationObject)
        Converts an integration object's contents to a map of lists of DTOs
        Parameters:
        readService - the ReadService to read from the type system
        integrationObject - an integration object to convert
        Returns:
        a map of lists of DTOs
      • getListItemStructureType

        public static ListItemStructureType getListItemStructureType​(ReadService readService,
                                                                     AttributeDescriptorModel attributeDescriptor)
        Determines the structure type of the given AttributeDescriptorModel
        Parameters:
        readService - the ReadService to read from the type system
        attributeDescriptor - the AttributeDescriptor tp evaluate
        Returns:
        The structure type of the currently evaluated AttributeDescriptor
      • getStructuredAttributes

        public static java.util.Set<AttributeDescriptorModel> getStructuredAttributes​(java.util.List<ListItemDTO> dtoList)
        Gets the attribute descriptors of collection and map attributes from a list of DTOs
        Parameters:
        dtoList - a list of ListItemDTO
        Returns:
        a set of AttributeDescriptorModel of CollectionType or MapType attributes
      • correctRoot

        public static IntegrationObjectModel correctRoot​(IntegrationObjectModel selectedIO,
                                                         java.lang.String rootCode)
        Corrects an IntegrationObject's root property which is located at the IntegrationObjectItemModel level. This method will set all other item's root boolean to false, except for the actual root.
        Parameters:
        selectedIO - Currently selected IO in the UI
        rootCode - Code of the root item
        Returns:
        The same IO, but with root type property corrected to contain a single valid root