Search in sources :

Example 1 with M2ModelDiff

use of org.alfresco.repo.dictionary.M2ModelDiff in project SearchServices by Alfresco.

the class AlfrescoSolrDataModel method validateModel.

private Set<String> validateModel(M2Model model) {
    HashSet<String> errors = new HashSet<String>();
    try {
        dictionaryDAO.getCompiledModel(QName.createQName(model.getName(), namespaceDAO));
    } catch (DictionaryException e) {
        // No model to diff
        return errors;
    } catch (NamespaceException e) {
        // namespace unknown - no model
        return errors;
    }
    List<M2ModelDiff> modelDiffs = dictionaryDAO.diffModelIgnoringConstraints(model);
    for (M2ModelDiff modelDiff : modelDiffs) {
        if (modelDiff.getDiffType().equals(M2ModelDiff.DIFF_UPDATED)) {
            errors.add("Model not updated: " + model.getName() + "   Failed to validate model update - found non-incrementally updated " + modelDiff.getElementType() + " '" + modelDiff.getElementName() + "'");
        }
    }
    return errors;
}
Also used : NamespaceException(org.alfresco.service.namespace.NamespaceException) M2ModelDiff(org.alfresco.repo.dictionary.M2ModelDiff) HashSet(java.util.HashSet) DictionaryException(org.alfresco.service.cmr.dictionary.DictionaryException)

Aggregations

HashSet (java.util.HashSet)1 M2ModelDiff (org.alfresco.repo.dictionary.M2ModelDiff)1 DictionaryException (org.alfresco.service.cmr.dictionary.DictionaryException)1 NamespaceException (org.alfresco.service.namespace.NamespaceException)1