-
Improvement
-
Resolution: Obsolete
-
Neutral
-
None
-
5.3.8
-
xUbuntu 14.04
-
-
Yes
-
Empty show more show less
SaveDialogAction and SaveDialogAction has protected method setNodeName which workin incorrectly
Actual: when dialog has field with name 'name' method save node as number instead of name in case if 'name' doesn't contains special characters.
Expected: method should save node with name as 'name' property in both cases - w/ and w/o special characters in it
1) Method should be changed from
protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException { String propertyName = "name"; if (node.hasProperty(propertyName) && !node.hasProperty(ModelConstants.JCR_NAME)) { Property property = node.getProperty(propertyName); String newNodeName = property.getString(); if (!node.getName().equals(Path.getValidatedLabel(newNodeName))) { newNodeName = Path.getUniqueLabel(node.getSession(), node.getParent().getPath(), Path.getValidatedLabel(newNodeName)); item.setNodeName(newNodeName); NodeUtil.renameNode(node, newNodeName); } } }
to this
private final static String PROPERTY_NAME = "name"; protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException { if (node.hasProperty(PROPERTY_NAME) && !node.hasProperty(ModelConstants.JCR_NAME)) { item.setNodeName( Path.getUniqueLabel(node.getSession(), node.getParent().getPath(), Path.getValidatedLabel(newNodeName))); NodeUtil.renameNode(node, newNodeName); } }
2) could you please using DRY principle to avoid code duplicated
Acceptance criteria
- is superseded by
-
MGNLUI-6334 Behaviour of node name in new framework
- Closed