use of org.alfresco.rest.api.search.model.Template in project alfresco-remote-api by Alfresco.
the class SearchMapper method fromTemplate.
/**
* SearchParameters from List<Template>
* @param sp SearchParameters
* @param templates List<Template>
*/
public void fromTemplate(SearchParameters sp, List<Template> templates) {
if (templates != null && !templates.isEmpty()) {
for (Template aTemplate : templates) {
ParameterCheck.mandatoryString("template name", aTemplate.getName());
ParameterCheck.mandatoryString("template template", aTemplate.getTemplate());
sp.addQueryTemplate(aTemplate.getName(), aTemplate.getTemplate());
}
}
}
use of org.alfresco.rest.api.search.model.Template in project alfresco-remote-api by Alfresco.
the class SearchMapperTests method fromTemplate.
@Test
public void fromTemplate() throws Exception {
SearchParameters searchParameters = new SearchParameters();
// Doesn't error
searchMapper.fromTemplate(searchParameters, null);
searchMapper.fromTemplate(searchParameters, Arrays.asList(new Template("hedge", "hog"), new Template("king", "kong"), new Template("bish", "bash")));
assertEquals(3, searchParameters.getQueryTemplates().size());
assertEquals("hog", searchParameters.getQueryTemplates().get("hedge"));
assertEquals("kong", searchParameters.getQueryTemplates().get("king"));
assertEquals("bash", searchParameters.getQueryTemplates().get("bish"));
}
Aggregations