test_class.declarator: context = new SlingContext()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public SlingContext context = new SlingContext();
test_class.type: SlingContext
test_class.var_name: context
test_class.declarator: includeFilter
test_class.modifier: private
test_class.original_string: private EditIncludeFilter includeFilter;
test_class.type: EditIncludeFilter
test_class.var_name: includeFilter
test_class.file: core/src/test/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilterTest.java
test_class.identifier: EditIncludeFilterTest
test_case.body: @Test
      public void testContainer() throws IOException, ServletException {
  
          context.currentResource("/content/apache/sling-apache-org/index/jcr:content/container");
          context.requestPathInfo().setExtension("html");
  
          context.request().setAttribute(EditIncludeFilter.ENABLED_ATTR_NAME, "true");
          context.request().setAttribute(EditIncludeFilter.WRITE_DROP_TARGET_ATTR_NAME, Boolean.TRUE);
  
          includeFilter.doFilter(context.request(), context.response(), Mockito.mock(FilterChain.class));
  
          assertEquals(
                  "<div class=\"sling-cms-droptarget\" data-path=\"/content/apache/sling-apache-org/index/jcr:content\" data-order=\"before container\"></div><div class=\"sling-cms-component\" data-reload=\"false\" data-component=\"/libs/sling-cms/components/general/container\" data-sling-cms-title=\"Container\" data-sling-cms-resource-path=\"/content/apache/sling-apache-org/index/jcr:content/container\" data-sling-cms-resource-type=\"sling-cms/components/general/container\" data-sling-cms-edit=\"\"></div>",
                  context.response().getOutputAsString());
      }
test_case.class_method_signature: EditIncludeFilterTest.testContainer()
test_case.full_signature: @Test public void testContainer()
test_case.identifier: testContainer
test_case.invocations: currentResource setExtension requestPathInfo setAttribute request setAttribute request doFilter request response mock assertEquals getOutputAsString response
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testContainer()
focal_class.declarator: log = LoggerFactory.getLogger(EditIncludeFilter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(EditIncludeFilter.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: ENABLED_ATTR_NAME = "cmsEditEnabled"
focal_class.modifier: public static final
focal_class.original_string: public static final String ENABLED_ATTR_NAME = "cmsEditEnabled";
focal_class.type: String
focal_class.var_name: ENABLED_ATTR_NAME
focal_class.declarator: WRITE_DROP_TARGET_ATTR_NAME = "writeDropTarget"
focal_class.modifier: public static final
focal_class.original_string: public static final String WRITE_DROP_TARGET_ATTR_NAME = "writeDropTarget";
focal_class.type: String
focal_class.var_name: WRITE_DROP_TARGET_ATTR_NAME
focal_class.declarator: ENTRY_BASE = "res/editinclude/"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String ENTRY_BASE = "res/editinclude/";
focal_class.type: String
focal_class.var_name: ENTRY_BASE
focal_class.declarator: templates = new HashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<String, String> templates = new HashMap<>();
focal_class.type: Map<String, String>
focal_class.var_name: templates
focal_class.file: core/src/main/java/org/apache/sling/cms/core/internal/filters/EditIncludeFilter.java
focal_class.identifier: EditIncludeFilter
focal_class.interfaces: implements Filter
focal_class.class_method_signature: EditIncludeFilter.activate(ComponentContext context)
focal_class.full_signature: @Activate public void activate(ComponentContext context)
focal_class.identifier: activate
focal_class.modifiers: @Activate public
focal_class.parameters: (ComponentContext context)
focal_class.return: void
focal_class.signature: void activate(ComponentContext context)
focal_class.class_method_signature: EditIncludeFilter.destroy()
focal_class.full_signature: @Override public void destroy()
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroy()
focal_class.class_method_signature: EditIncludeFilter.doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
focal_class.full_signature: @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
focal_class.identifier: doFilter
focal_class.modifiers: @Override public
focal_class.parameters: (ServletRequest request, ServletResponse response, FilterChain chain)
focal_class.return: void
focal_class.signature: void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
focal_class.class_method_signature: EditIncludeFilter.getSiblings(Resource resource)
focal_class.full_signature: private Iterator<Resource> getSiblings(Resource resource)
focal_class.identifier: getSiblings
focal_class.modifiers: private
focal_class.parameters: (Resource resource)
focal_class.return: Iterator<Resource>
focal_class.signature: Iterator<Resource> getSiblings(Resource resource)
focal_class.class_method_signature: EditIncludeFilter.init(FilterConfig filterConfig)
focal_class.full_signature: @Override public void init(FilterConfig filterConfig)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (FilterConfig filterConfig)
focal_class.return: void
focal_class.signature: void init(FilterConfig filterConfig)
focal_class.class_method_signature: EditIncludeFilter.isContainer(Resource resource)
focal_class.full_signature: private boolean isContainer(Resource resource)
focal_class.identifier: isContainer
focal_class.modifiers: private
focal_class.parameters: (Resource resource)
focal_class.return: boolean
focal_class.signature: boolean isContainer(Resource resource)
focal_class.class_method_signature: EditIncludeFilter.isFirst(Resource resource)
focal_class.full_signature: private boolean isFirst(Resource resource)
focal_class.identifier: isFirst
focal_class.modifiers: private
focal_class.parameters: (Resource resource)
focal_class.return: boolean
focal_class.signature: boolean isFirst(Resource resource)
focal_class.class_method_signature: EditIncludeFilter.isLast(Resource resource)
focal_class.full_signature: private boolean isLast(Resource resource)
focal_class.identifier: isLast
focal_class.modifiers: private
focal_class.parameters: (Resource resource)
focal_class.return: boolean
focal_class.signature: boolean isLast(Resource resource)
focal_class.class_method_signature: EditIncludeFilter.shouldWriteDropTarget(SlingHttpServletRequest request)
focal_class.full_signature: private boolean shouldWriteDropTarget(SlingHttpServletRequest request)
focal_class.identifier: shouldWriteDropTarget
focal_class.modifiers: private
focal_class.parameters: (SlingHttpServletRequest request)
focal_class.return: boolean
focal_class.signature: boolean shouldWriteDropTarget(SlingHttpServletRequest request)
focal_class.class_method_signature: EditIncludeFilter.writeDropTarget(Resource resource, PrintWriter writer, String order)
focal_class.full_signature: private void writeDropTarget(Resource resource, PrintWriter writer, String order)
focal_class.identifier: writeDropTarget
focal_class.modifiers: private
focal_class.parameters: (Resource resource, PrintWriter writer, String order)
focal_class.return: void
focal_class.signature: void writeDropTarget(Resource resource, PrintWriter writer, String order)
focal_class.class_method_signature: EditIncludeFilter.writeEditorMarkup(Resource resource, PrintWriter writer, boolean draggable)
focal_class.full_signature: private void writeEditorMarkup(Resource resource, PrintWriter writer, boolean draggable)
focal_class.identifier: writeEditorMarkup
focal_class.modifiers: private
focal_class.parameters: (Resource resource, PrintWriter writer, boolean draggable)
focal_class.return: void
focal_class.signature: void writeEditorMarkup(Resource resource, PrintWriter writer, boolean draggable)
focal_class.class_method_signature: EditIncludeFilter.writeTemplate(PrintWriter writer, Map<String, Object> replacements, String templateName)
focal_class.full_signature: private void writeTemplate(PrintWriter writer, Map<String, Object> replacements, String templateName)
focal_class.identifier: writeTemplate
focal_class.modifiers: private
focal_class.parameters: (PrintWriter writer, Map<String, Object> replacements, String templateName)
focal_class.return: void
focal_class.signature: void writeTemplate(PrintWriter writer, Map<String, Object> replacements, String templateName)
focal_class.class_method_signature: EditIncludeFilter.writeHeader(SlingHttpServletRequest request, PrintWriter writer, boolean includeEnd)
focal_class.full_signature: private boolean writeHeader(SlingHttpServletRequest request, PrintWriter writer, boolean includeEnd)
focal_class.identifier: writeHeader
focal_class.modifiers: private
focal_class.parameters: (SlingHttpServletRequest request, PrintWriter writer, boolean includeEnd)
focal_class.return: boolean
focal_class.signature: boolean writeHeader(SlingHttpServletRequest request, PrintWriter writer, boolean includeEnd)
focal_method.body: @Override
      public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
              throws IOException, ServletException {
          boolean enabled = "true".equals(request.getAttribute(ENABLED_ATTR_NAME));
          PrintWriter writer = null;
          if (enabled) {
              boolean includeEnd = false;
              SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request;
              Resource resource = slingRequest.getResource();
              Boolean container = isContainer(resource);
              boolean writeDropTarget = shouldWriteDropTarget(slingRequest);
              writer = response.getWriter();
              if (writeDropTarget) {
                  this.writeDropTarget(resource, writer, "before " + resource.getName());
              }
              includeEnd = writeHeader(slingRequest, writer, includeEnd);
              request.setAttribute(WRITE_DROP_TARGET_ATTR_NAME, container);
              chain.doFilter(request, response);
              request.setAttribute(WRITE_DROP_TARGET_ATTR_NAME, writeDropTarget);
              if (includeEnd) {
                  writer.write("</div>");
              }
          } else {
              chain.doFilter(request, response);
          }
      }
focal_method.class_method_signature: EditIncludeFilter.doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
focal_method.full_signature: @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
focal_method.identifier: doFilter
focal_method.invocations: equals getAttribute getResource isContainer shouldWriteDropTarget getWriter writeDropTarget getName writeHeader setAttribute doFilter setAttribute write doFilter
focal_method.modifiers: @Override public
focal_method.parameters: (ServletRequest request, ServletResponse response, FilterChain chain)
focal_method.return: void
focal_method.signature: void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)