/*
* Get the model definition
*/
log.debug("Creating model definition for " + fullModelName);
ModelDefinition modelDefinition = new ModelDefinition(this.extConfig);
/*
* Add the rest API to the model
*/
modelDefinition.setProxy(this.restProxy);
modelDefinitionStrings.add("Ext.define('" + fullModelName + "', " +
(isTouch ? "{extend:'Ext.data.Model', config:" : "") +
StringUtilities.json(modelDefinition, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
/*
* Get the model's association definitions
*/
getAllAssociations(modelDefinition);
for (Association association : associations) {
ModelDefinition assocModelDef = association.getModelDefinition();
if (assocModelDef != null) {
/*
* If we have a rest proxy for the parent model, add one for associated models
*/
if (this.restProxy != null) {
String restPath = getRestPath(association.getEntityClassName().toLowerCase());
if (!restPath.equals("false")) {
RestProxy associatedProxy = new RestProxy(restPath, extConfig, this.configComponent.isTouch());
assocModelDef.setProxy(associatedProxy);
}
}
modelDefinitionStrings.add("Ext.define('" + assocModelDef.getModelName() + "', " +
(isTouch ? "{extend:'Ext.data.Model', config:" : "") +
StringUtilities.json(assocModelDef, this.request.getServletContext()) + (isTouch ? "}" : "") + ");\n");
}
}