ALF-8990: RSOLR 032: Model track and build from SOLR

- SOLR tracking now reflects all models loaded and changed on the repo to which it points 
- model tracking and related fixes
- model XML now round trips for Boolean properties :-)
- upgraded to latest version of jibx - 1.2.3
- added API to load models and not class load constraint extensions (does not affect the generated model XML only constraint enforcement)
- removed solr specific m2 model binding
- fixed SOLR tracking test

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28714 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-06-30 09:18:46 +00:00
parent c0e2c1a136
commit a46339b44e
3 changed files with 7 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
<webscript>
<shortname>Get Model</shortname>
<description>Get the model for given model name.</description>
<url>/api/solr/model/{modelShortQName}</url>
<url>/api/solr/model</url>
<format default="json">argument</format>
<authentication>admin</authentication>
<transaction allow="readonly">required</transaction>

View File

@@ -4,7 +4,7 @@
[
<#list diffs as diff>
{
"name": <@solrLib.qNameJSON qName=diff.modelName/>,
"name": "${diff.modelName}",
"type" : "${diff.type}",
"oldChecksum": <#if diff.oldChecksum??>${diff.oldChecksum?c}<#else>null</#if>,
"newChecksum": <#if diff.newChecksum??>${diff.newChecksum?c}<#else>null</#if>

View File

@@ -58,17 +58,16 @@ public class AlfrescoModelGet extends AbstractWebScript
private void handle(WebScriptRequest req, WebScriptResponse res) throws JSONException, IOException
{
// create map of template vars
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String modelName = templateVars.get("modelShortQName");
if(modelName == null)
String modelQName = req.getParameter("modelQName");
if(modelQName == null)
{
throw new WebScriptException(
Status.STATUS_BAD_REQUEST,
"URL parameter 'modelShortQName' not provided.");
"URL parameter 'modelQName' not provided.");
}
ModelDefinition.XMLBindingType bindingType = ModelDefinition.XMLBindingType.SOLR;
AlfrescoModel model = solrTrackingComponent.getModel(QName.createQName(modelName, namespaceService));
ModelDefinition.XMLBindingType bindingType = ModelDefinition.XMLBindingType.DEFAULT;
AlfrescoModel model = solrTrackingComponent.getModel(QName.createQName(modelQName));
res.setHeader("XAlfresco-modelChecksum", String.valueOf(model.getModelDef().getChecksum(bindingType)));
model.getModelDef().toXML(bindingType, res.getOutputStream());
}