ComponentUtils { public static <T extends Component> T copy(T component) { return copy(component, null); } private  ComponentUtils(); static T copy(T component); static T copy(T component, String idSuffix); static List<T> copy(List<T> components); static void bindAndIdFieldList(List<T> fields, String addBindingPrefix, String idSuffix); static T copyComponent(T component, String addBindingPrefix, String idSuffix); static List<T> copyComponentList(List<T> components, String idSuffix); static List<T> getComponentsOfType(List<? extends Component> items,
            Class<T> componentType); static List<T> getNestedContainerComponents(Container container,
            Class<T> componentType); static List<T> getNestedNonCollectionComponents(List<Component> items,
            Class<T> componentType); static List<T> getNestedNonCollectionComponents(Container container,
            Class<T> componentType); static List<Component> getAllNestedComponents(Component component); static Component findComponentInList(List<Component> components, String componentId); static void prefixBindingPath(List<? extends Component> components, String addBindingPrefix); static void prefixBindingPath(Component component, String addBindingPrefix); static void prefixBindingPath(DataBinding field, String addBindingPrefix); static void prefixBindingPathNested(Component component, String addBindingPrefix); static void updateIdsWithSuffixNested(List<? extends Component> components, String idSuffix); static void updateIdsWithSuffixNested(Component component, String idSuffix); static void updateIdWithSuffix(LifecycleElement element, String idSuffix); static void updateChildIdsWithSuffixNested(Component component, String idSuffix); static int generateId(LifecycleElement element, int seed); static void clearAndAssignIds(List<? extends Component> components); static void setComponentsPropertyDeep(List<T> components, String propertyPath,
            Object propertyValue); static void setComponentPropertyDeep(Component component, String propertyPath, Object propertyValue); static void setComponentPropertyFinal(Component component, String propertyName, Object propertyValue); static boolean canBeRefreshed(Component component); static void pushObjectToContext(Collection<? extends LifecycleElement> elements, String contextName,
            Object contextValue); static void pushObjectToContext(Component component, String contextName, Object contextValue); static void pushAllToContext(List<? extends Component> components, Map<String, Object> sourceContext); static void pushAllToContext(Component component, Map<String, Object> sourceContext); static void updateContextsForLine(List<? extends Component> components, CollectionGroup collectionGroup,
            Object collectionLine, int lineIndex, String lineSuffix); static void updateContextForLine(Component component, CollectionGroup collectionGroup, Object collectionLine,
            int lineIndex, String lineSuffix); static void cleanContextDeap(LifecycleElement lifecycleElement); static List<T> sort(List<T> items, int defaultOrderSequence); static List<InputField> getAllInputFieldsWithinContainer(Container container); static boolean containsPropertyExpression(Component component, String propertyName,
            boolean collectionMatch); static void adjustNestedLevelsForTableCollections(Container container, int currentLevel);  }
@Test public void testCopyUsingCloningWithFieldBaseSucceeds() { FieldBase fieldBaseOriginal = initializeFieldBase(); FieldBase fieldBaseCopy = CopyUtils.copy(fieldBaseOriginal); assertTrue(ComponentCopyPropertiesMatch(fieldBaseOriginal, fieldBaseCopy)); assertTrue(fieldBaseOriginal.getShortLabel().equals(fieldBaseCopy.getShortLabel())); }
@Test public void testCopyUsingCloningWithDataFieldSucceeds() { DataField dataFieldOriginal = initializeDataField(); DataField dataFieldCopy = CopyUtils.copy(dataFieldOriginal); assertTrue(ComponentCopyPropertiesMatch(dataFieldOriginal, dataFieldCopy)); }
@Test public void testCopyUsingCloningWithSimpleCollectionGroupSucceeds() { CollectionGroup collectionGroupOriginal = initializeCollectionGroup(); CollectionGroup collectionGroupCopy = CopyUtils.copy(collectionGroupOriginal); assertTrue(ComponentCopyPropertiesMatch(collectionGroupOriginal, collectionGroupCopy)); for (int i = 0; i < collectionGroupOriginal.getAddLineItems().size(); i++) { assertTrue(ComponentCopyPropertiesMatch( CopyUtils.unwrap((ComponentBase) collectionGroupOriginal.getAddLineItems().get(i)), CopyUtils.unwrap((ComponentBase) collectionGroupCopy.getAddLineItems().get(i)))); } for (int i = 0; i < collectionGroupOriginal.getAddLineActions().size(); i++) { assertTrue(ComponentCopyPropertiesMatch( CopyUtils.unwrap((Component) collectionGroupOriginal.getAddLineActions().get(i)), CopyUtils.unwrap((Component) collectionGroupCopy.getAddLineActions().get(i)))); } }
@Ignore @Test public void testCopyUsingCloningWithDataTableSucceeds() { CheckboxControl dataTableOriginal = new CheckboxControl(); initializeClass(dataTableOriginal); CheckboxControl dataTableCopy = CopyUtils.copy(dataTableOriginal); assertTrue(propertiesMatch(dataTableOriginal, dataTableCopy)); }