The ModelTool exposes a model definition to the view.
TODO
- fetching: #set($book = $bookstore.fetch(1))
- properties and joins: $book.publisher.address.zip
- loops: #foreach($author.books) ...
- attributes: $book.most_recent_edition.year
Fix libraries versions (TODO add link towards dependencies).
tools.xmlcom.republicate.tools.model.velosurf.VelosurfTool class for the model.credentials = "…path to credentials.xml…" to the <tool> tag.Using the com.republicate.tools.model.velosurf.VelosurfTool instead of the regular com.republicate.tools.model.ModelTool provides the following backward compatibility helpers:
obfuscate() and deobfuscate() methods<database> instead of <model> and of the deprecated tags <entity> and <attribute>, along with some deprecated attributes (caching, read-only, obfuscate and localize for entities, caching replaced by cached for attributes)getRows(), getScalars(), getSet(), getMap() and getInstanceMap()model.xml<credentials> tag or the <xi:include> of the credentials, if any.<model>’s attribute read-only="true|false" by write="none|java|vtl".<model>’s attributes loglevel and seed, if any.modality.properties, see below.velocity.propertiesUpdate uberspectors:
runtime.introspector.uberspect = com.republicate.modality.tools.model.ModelUberspector,org.apache.velocity.util.introspection.UberspectImpl,org.apache.velocity.tools.view.WebappUberspector
com.republicate.modality.webapp.ModalityFilter or com.republicate.modality.webapp.ModalityServlet, and call getModel().evaluate() to get a scalar, retrieve() to get a row, query() to get a rowset and perform() to perform an action. The same methods can be called on the model for root attributes.fetch(), getCount() and iterate() methods.getWithParams().modality.propertiesYou’ll potentially need a new /WEB-INF/modality.properties.
For obfuscated columns, set:
model.filters.read.*.foo_id = obfuscate
model.filters.write.*.foo_id = deobfuscate_strings
This will obfuscate all foo_id columns.
#set($db.param = ...). You’ll get java.sql.SQLFeatureNotSupportedException: ModelTool is read-only messages in the log..order and .refine features have been dropped.Instance.setColumnValues() method has been dropped.Since Velocity Engine 2.2 (unreleased at the time of writing), you can locate log messages in templates. For instance when using the webapp-slf4j-logger:
<context-param>
<param-name>webapp-slf4j-logger.format</param-name>
<param-value>%logger [%level] [%ip] %message @%file:%line:%column</param-value>
</context-param>
Set Velocity to strict mode to be sure your templates are ok.