private void tryInitializeTemplate( String calledName, Object[] args, Environment env, Map<String, String> attrs, utils.LocalTemplateArguments ltas) { // always set ThreadLocalTemplate ThreadLocalTemplate.set(this); // always store arguments, value might change between phases storeArguments(args); if (!initialized || ThreadLocalPage.get().hibernateCacheCleared) { // System.out.println("template init "+"~x_Page"+"init: "+initialized+ " hibcache: // "+ThreadLocalPage.get().hibernateCacheCleared); initialized = true; this.calledName = calledName; this.env = env; putLocalDefinesInEnv(); this.request = ThreadLocalPage.get().getRequest(); this.response = ThreadLocalPage.get().getResponse(); if (request != null) { // calling rendertemplate within background task this.session = request.getSession(true); } this.hibSession = ThreadLocalPage.get().getHibSession(); this.attrs = attrs; this.ltas = ltas; try { this.uniqueid = Encoders.encodeTemplateId( getTemplateClassName() /*, getStateEncodingOfArgument()*/, getTemplateContext()); initialize(); initializeLocalVars(); initSubmitActions(); initActions(); } catch (utils.ValidationException ve) { ThreadLocalPage.get() .getValidationExceptions() .add(ve.setName(ThreadLocalPage.get().getValidationContext())); ThreadLocalPage.get().setValidated(false); utils.Warning.warn( "Validation failed in initialization of " + getTemplateSignature() + ": " + ve.getErrorMessage()); skipThisTemplate = true; } catch (utils.MultipleValidationExceptions ve) { for (utils.ValidationException vex : ve.getValidationExceptions()) { ThreadLocalPage.get() .getValidationExceptions() .add(vex.setName(ThreadLocalPage.get().getValidationContext())); utils.Warning.warn( "Validation failed in initialization of " + getTemplateSignature() + ": " + vex.getErrorMessage()); } ThreadLocalPage.get().setValidated(false); skipThisTemplate = true; } } }
public void validateInputs( Object[] args, Environment env, utils.TemplateCall templateArg, Map<String, utils.TemplateCall> withcallsmap, Map<String, String> attrs) { if (!skipThisTemplate) { if (!initialized || ThreadLocalPage.get().hibernateCacheCleared) { initialized = true; this.env = env; env.putTemplate("body", editColor_body_Template.class); this.request = ThreadLocalPage.get().getRequest(); this.response = ThreadLocalPage.get().getResponse(); this.session = request.getSession(true); this.hibSession = ThreadLocalPage.get().getHibSession(); this.templateArg = templateArg; this.withcallsmap = withcallsmap; this.attrs = attrs; try { storeArguments(args); this.uniqueid = Encoders.encodeTemplateId( "editColor_Template", "" + (arg10 != null ? arg10.getVersion() == 0 ? "_" : arg10.getId().toString() : "null"), ThreadLocalPage.get().getTemplateContextString()); initialize(); initializeLocalVars(); initializePassOn(); initActions(); } catch (utils.ValidationException ve) { ThreadLocalPage.get() .getValidationExceptions() .add(ve.setName(ThreadLocalPage.get().getValidationContext())); ThreadLocalPage.get().setValidated(false); utils.Warning.warn( "Validation failed in initialization of " + "editColor(arg : Color)" + ": " + ve.getErrorMessage()); skipThisTemplate = true; } catch (utils.MultipleValidationExceptions ve) { for (utils.ValidationException vex : ve.getValidationExceptions()) { ThreadLocalPage.get() .getValidationExceptions() .add(vex.setName(ThreadLocalPage.get().getValidationContext())); utils.Warning.warn( "Validation failed in initialization of " + "editColor(arg : Color)" + ": " + vex.getErrorMessage()); } ThreadLocalPage.get().setValidated(false); skipThisTemplate = true; } } validateInputsInternal(); } }