[MGNLUI-2765] Enhance template availability call and usage in pages app Created: 21/Mar/14  Updated: 09/Mar/21  Resolved: 09/Mar/21

Status: Closed
Project: Magnolia UI
Component/s: pages app
Affects Version/s: 5.2.3
Fix Version/s: None

Type: Task Priority: Major
Reporter: Eric Hechinger Assignee: Unassigned
Resolution: Obsolete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MGNLUI-2737 Drag and drop from subfolder to upper... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty

 Description   

Currently TemplateSelectorFieldFactory and TemplateTypeRestrictionDropConstraint have to create a tmp child node in order to check the template availability.

   // creates a temporary node underneath the parent to overcome a restriction in template availability,
   // see MGNLSTK-1185
   try {
      Node tempNode = associatedNode.addNode("temp", NodeTypes.Page.NAME);
      templates = templateAssignment.getAvailableTemplates(tempNode);
      associatedNode.getSession().removeItem(tempNode.getPath());
   } catch (RepositoryException e) {
      log.error("Could not create temporary node to get available templates.", e);
   }

This behavior may easily changed by:

  • expose in TemplateDefinitionAssignment a new method isTemplateAssignableFor(Node targetNode, TemplateDefinition template)
  • Add implementation in MetaDataBasedTemplateDefinitionAssignment
  • Review the implementation of TemplateAvailability in order to add utility methods
  • Use this in TemplateTypeRestrictionDropConstraint and TemplateSelectorFieldFactory.

Generated at Mon Feb 12 08:59:55 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.