use of org.alfresco.repo.dictionary.NamespaceDAO in project SearchServices by Alfresco.
the class ModelTrackerTest method setUpTestTrackModels.
@SuppressWarnings("unchecked")
private String setUpTestTrackModels() throws AuthenticationException, IOException, JSONException {
QName modelName = QName.createQName("qname");
TYPE type = TYPE.CHANGED;
Long oldChecksum = new Long(0);
Long newChecksum = new Long(1);
AlfrescoModelDiff diff = new AlfrescoModelDiff(modelName, type, oldChecksum, newChecksum);
List<AlfrescoModelDiff> modelDiffs = new ArrayList<>();
modelDiffs.add(diff);
when(this.repositoryClient.getModelsDiff(any(String.class), any(List.class))).thenReturn(modelDiffs);
final String name = "a model name";
M2Model model = M2Model.createModel(name);
M2Model spiedModel = spy(model);
model.createNamespace("uri", "prefix");
AlfrescoModel alfrescoModel = new AlfrescoModel(spiedModel, newChecksum);
when(this.repositoryClient.getModel(any(String.class), eq(modelName))).thenReturn(alfrescoModel);
NamespaceDAO namespaceDao = mock(NamespaceDAO.class);
Collection<String> values = new ArrayList<>();
values.add("prefix");
when(namespaceDao.getPrefixes(anyString())).thenReturn(values);
when(this.srv.getNamespaceDAO()).thenReturn(namespaceDao);
when(this.srv.getM2Model(modelName)).thenReturn(spiedModel);
when(this.srv.putModel(spiedModel)).thenReturn(true);
return name;
}
use of org.alfresco.repo.dictionary.NamespaceDAO in project SearchServices by Alfresco.
the class MetadataTracker method getShardProperty.
public static QName getShardProperty(String field) {
AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();
NamespaceDAO namespaceDAO = dataModel.getNamespaceDAO();
DictionaryService dictionaryService = dataModel.getDictionaryService(CMISStrictDictionaryService.DEFAULT);
PropertyDefinition propertyDef = QueryParserUtils.matchPropertyDefinition("http://www.alfresco.org/model/content/1.0", namespaceDAO, dictionaryService, field);
return propertyDef.getName();
}
Aggregations