[MGNLADVCACHE-72] model class runs twice Created: 18/May/16  Updated: 19/May/16  Resolved: 18/May/16

Status: Closed
Project: Advanced Cache
Component/s: DCP
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Roman Kovařík
Resolution: Not an issue Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File scripts.info.xml     XML File website.travel.test.xml    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Here is my model class:

package info.magnolia.groovy.test;

import info.magnolia.rendering.model.*;
import info.magnolia.rendering.template.configured.ConfiguredTemplateDefinition;
import javax.jcr.Node;

public class GroovyModelExample extends RenderingModelImpl {
 
    public GroovyModelExample(Node content, ConfiguredTemplateDefinition definition, RenderingModel<?> parent) {
        super(content, definition, parent)
        
        System.out.println("****GroovyModelExample ran******");
    }
 
    public String getJavaVersion() {
        return System.getProperty("java.version");
    }
}

Here is my configured template from the travel demo /travel-demo/templates/components/textImage.yaml:

templateScript: /travel-demo/templates/components/textImage.ftl
dialog: travel-demo:components/textImage

renderType: freemarker
modelClass: info.magnolia.groovy.test.GroovyModelExample
fragmentDefinition: 
  class: info.magnolia.module.advancedcache.rendering.DynamicFragmentDefinition
  dynamic: true
  mechanism: sitemesh
  ttl: 0

I activate the model (attached), the edited textImage template from resources, and the test page (attached) to public. I observe in my log every time I request the page the following:
***GroovyModelExample ran*****
***GroovyModelExample ran*****


Generated at Sun Feb 11 23:10:44 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.