Class EditorUtils
- java.lang.Object
-
- de.hybris.platform.integrationbackoffice.widgets.modeling.utility.EditorUtils
-
public final class EditorUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Map<ComposedTypeModel,java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>>>compileDuplicationMap(ComposedTypeModel currentType, java.util.List<AbstractListItemDTO> currentAttributes, java.util.Map<ComposedTypeModel,java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>>> duplicationMap)Constructs a map with entries of duplicate attribute names associated to list items.static java.util.Map<ComposedTypeModel,java.util.List<AbstractListItemDTO>>convertIntegrationObjectToDTOMap(ReadService readService, IntegrationObjectModel integrationObject)Converts an integration object's contents to a map of lists of DTOsstatic org.zkoss.zul.ComboitemcreateComboItem(java.lang.String label, java.lang.Object value)Creates a combobox itemstatic org.zkoss.zul.ListitemcreateListItem(AbstractListItemDTO dto, boolean isComplex, boolean hasSubtypes, java.util.List<java.lang.String> labels, boolean inEditMode, ReadService readService)Creates a list itemstatic org.zkoss.zul.MenupopupcreateMenuPopup(java.util.List<java.lang.String> labels)Create menu popupstatic org.zkoss.zul.TreeitemcreateTreeItem(TreeNodeData value, boolean expanded)Creates a tree itemstatic ListItemAttributeStatusdetermineAttributeStatus(ListItemAttributeDTO dto, ReadService readService)Determines the attribute statusstatic org.zkoss.zul.TreeitemfindInTreechildren(java.lang.String qualifier, org.zkoss.zul.Treechildren treechildren)Find a matching Treeitem in a given parent Treeitem's Treechildren by qualifier.static ListItemStructureTypegetListItemStructureType(ReadService readService, AttributeDescriptorModel attribute)Determines the structure type of the given AttributeDescriptorModelstatic java.util.Set<TreeNodeData>getReferenceClassificationAttributes(java.util.List<AbstractListItemDTO> dtoList)Builds tree node data for reference type classification attributesstatic java.util.Set<AttributeDescriptorModel>getStructuredAttributes(java.util.List<AbstractListItemDTO> dtoList)Gets the attribute descriptors of collection and map attributes from a list of DTOsstatic booleanisClassificationAttributePresent(ClassAttributeAssignmentModel classAttributeAssignmentModel, java.util.List<AbstractListItemDTO> dtos)Determines whether or not a classification exists in the list of DTOs to avoid creating a duplicate of the exact same entry.static booleanmarkRowsWithDuplicateNames(java.util.Collection<org.zkoss.zul.Listitem> items, java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>> duplicateEntries)Modifies the sClass of the list items to show highlights on duplicate items.static org.zkoss.zul.TreeitemrenameTreeitem(org.zkoss.zul.Treeitem treeitem, AbstractListItemDTO dto)Renames a tree itemstatic java.util.List<AbstractListItemDTO>updateDTOs(java.util.List<AbstractListItemDTO> oldDTOs, java.util.List<AbstractListItemDTO> newDTOs)Updates attributes of a list of DTOs by getting the attributes of another list of DTOs
-
-
-
Method Detail
-
createComboItem
public static org.zkoss.zul.Comboitem createComboItem(java.lang.String label, java.lang.Object value)Creates a combobox item- Parameters:
label- Label of itemvalue- Value of item- Returns:
- Combobox item
-
createTreeItem
public static org.zkoss.zul.Treeitem createTreeItem(TreeNodeData value, boolean expanded)
Creates a tree item- Parameters:
value- Value of tree itemexpanded- Whether node is expanded by default- Returns:
- Tree item
-
createListItem
public static org.zkoss.zul.Listitem createListItem(AbstractListItemDTO dto, boolean isComplex, boolean hasSubtypes, java.util.List<java.lang.String> labels, boolean inEditMode, ReadService readService)
Creates a list item- Parameters:
dto- DTO containing properties to populate list itemisComplex- If attribute it a complex typehasSubtypes- If attribute has subtypeslabels- Menuitem labelsinEditMode- If in edit mode- Returns:
- A list item
-
createMenuPopup
public static org.zkoss.zul.Menupopup createMenuPopup(java.util.List<java.lang.String> labels)
Create menu popup- Parameters:
labels- Labels for menu items- Returns:
- Menu popup
-
renameTreeitem
public static org.zkoss.zul.Treeitem renameTreeitem(org.zkoss.zul.Treeitem treeitem, AbstractListItemDTO dto)Renames a tree item- Parameters:
treeitem- Item to be renameddto- DTO containing relevant rename information- Returns:
- Newly renamed tree item
-
findInTreechildren
public static org.zkoss.zul.Treeitem findInTreechildren(java.lang.String qualifier, org.zkoss.zul.Treechildren treechildren)Find a matching Treeitem in a given parent Treeitem's Treechildren by qualifier.- Parameters:
qualifier- the qualifier to matchtreechildren- the Treechildren to search- Returns:
- a matching Treeitem, null if not found
-
updateDTOs
public static java.util.List<AbstractListItemDTO> updateDTOs(java.util.List<AbstractListItemDTO> oldDTOs, java.util.List<AbstractListItemDTO> 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 updatenewDTOs- 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<AbstractListItemDTO>> 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 systemintegrationObject- an integration object to convert- Returns:
- a map of lists of DTOs
-
getListItemStructureType
public static ListItemStructureType getListItemStructureType(ReadService readService, AttributeDescriptorModel attribute)
Determines the structure type of the given AttributeDescriptorModel- Parameters:
readService- the ReadService to read from the type systemattribute- the AttributeDescriptorModel to evaluate- Returns:
- ListItemStructureType enum representing the structure type of the AttributeDescriptorModel
-
getStructuredAttributes
public static java.util.Set<AttributeDescriptorModel> getStructuredAttributes(java.util.List<AbstractListItemDTO> dtoList)
Gets the attribute descriptors of collection and map attributes from a list of DTOs- Parameters:
dtoList- a list of AbstractListItemDTO- Returns:
- a set of AttributeDescriptorModel of CollectionType or MapType attributes
-
getReferenceClassificationAttributes
public static java.util.Set<TreeNodeData> getReferenceClassificationAttributes(java.util.List<AbstractListItemDTO> dtoList)
Builds tree node data for reference type classification attributes- Parameters:
dtoList- a list of AbstractListItemDTO- Returns:
- a set of TreeNodeData for ListItemClassificationAttributeDTO with reference type
-
compileDuplicationMap
public static java.util.Map<ComposedTypeModel,java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>>> compileDuplicationMap(ComposedTypeModel currentType, java.util.List<AbstractListItemDTO> currentAttributes, java.util.Map<ComposedTypeModel,java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>>> duplicationMap)
Constructs a map with entries of duplicate attribute names associated to list items. These entries are tied to any ComposedTypeModel where a duplicate entry occurs.- Parameters:
currentType- Current ComposedType that items were added to.currentAttributes- The current list of attributes that have had items added to them- Returns:
- A map containing any duplicate entries that must be resolved before persisting the IntegrationObject
-
markRowsWithDuplicateNames
public static boolean markRowsWithDuplicateNames(java.util.Collection<org.zkoss.zul.Listitem> items, java.util.Map<java.lang.String,java.util.List<AbstractListItemDTO>> duplicateEntries)Modifies the sClass of the list items to show highlights on duplicate items.- Parameters:
items- List of items to iterate overduplicateEntries- Map containing duplicate entries to match with item.
-
isClassificationAttributePresent
public static boolean isClassificationAttributePresent(ClassAttributeAssignmentModel classAttributeAssignmentModel, java.util.List<AbstractListItemDTO> dtos)
Determines whether or not a classification exists in the list of DTOs to avoid creating a duplicate of the exact same entry.- Parameters:
classAttributeAssignmentModel- Classification being checkeddtos- List of existing DTOs to search for a potential match of type- Returns:
- Whether or not a match is present
-
determineAttributeStatus
public static ListItemAttributeStatus determineAttributeStatus(ListItemAttributeDTO dto, ReadService readService)
Determines the attribute status- Parameters:
dto- Attribute DTO to be evaluatedreadService- ReadService instance- Returns:
- Status of attribute
-
-