/*
* Create the model
*/
AdaptrexSession session = new AdaptrexSession(persistence);
Model model = new Model(session, config);
/*
* Set the model name
*/
String modelName = namespace + ".model."
+ (name != null ? name : className);
config.setModelName(name);
if (include != null) {
config.include(include);
}
if (exclude != null) {
config.exclude(exclude);
}
/*
* Add associations
*/
if (associations != null) {
config.associations(associations);
}
/*
* The proxy needs additinoal information from the model. We shouldn't
* create the proxy until the store has been fully configured
*/
if (rest != null) {
String restPath = getRequest().getContextPath()
+ "/rest/"
+ (rest.equals("true") ? clazz.getSimpleName()
.toLowerCase() : rest);
config.setProxy(new RestProxy(restPath, config));
}
/*
* TODO: Make sure we're outputting our model definition in the same way
* as in the store
*/
ModelDefinition modelDef = model.getModelDefinition();
String output = "Ext.define(\"" + modelName + "\","
+ StringUtilities.json(modelDef) + ");\n";
for (Association assoc : getAllAssociations(modelDef)) {
ModelDefinition associatedModel = assoc