Search in sources :

Example 1 with AlfrescoModel

use of org.alfresco.repo.solr.AlfrescoModel in project alfresco-remote-api by Alfresco.

the class AlfrescoModelGet method handle.

private void handle(WebScriptRequest req, WebScriptResponse res) throws JSONException, IOException {
    // create map of template vars
    String modelQName = req.getParameter("modelQName");
    if (modelQName == null) {
        throw new WebScriptException(Status.STATUS_BAD_REQUEST, "URL parameter 'modelQName' not provided.");
    }
    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());
}
Also used : WebScriptException(org.springframework.extensions.webscripts.WebScriptException) ModelDefinition(org.alfresco.service.cmr.dictionary.ModelDefinition) AlfrescoModel(org.alfresco.repo.solr.AlfrescoModel)

Aggregations

AlfrescoModel (org.alfresco.repo.solr.AlfrescoModel)1 ModelDefinition (org.alfresco.service.cmr.dictionary.ModelDefinition)1 WebScriptException (org.springframework.extensions.webscripts.WebScriptException)1