use of org.alfresco.service.cmr.repository.NodeRef in project alfresco-remote-api by Alfresco.
the class QueriesSitesApiTest method getNodeRef.
private NodeRef getNodeRef(String createdSiteId) {
AuthenticationUtil.setFullyAuthenticatedUser(user1);
// The following call to siteService.getSite(createdSiteId).getNodeRef() returns a NodeRef like:
// workspace://SpacesStore/9db76769-96de-4de4-bdb4-a127130af362
// We call tenantService.getName(nodeRef) to get a fully qualified NodeRef as Solr returns this.
// They look like:
// workspace://@org.alfresco.rest.api.tests.queriespeopleapitest@SpacesStore/9db76769-96de-4de4-bdb4-a127130af362
NodeRef nodeRef = siteService.getSite(createdSiteId).getNodeRef();
nodeRef = tenantService.getName(nodeRef);
return nodeRef;
}
use of org.alfresco.service.cmr.repository.NodeRef in project alfresco-remote-api by Alfresco.
the class QueriesSitesApiTest method checkApiCall.
// Note expectedIds defaults to ids
private void checkApiCall(String term, String orderBy, Paging paging, int expectedStatus, String[] expectedIds, String... ids) throws Exception {
Map<String, String> params = new HashMap<>(1);
params.put(Queries.PARAM_TERM, "\"" + term + "\"");
if (orderBy != null) {
params.put(Queries.PARAM_ORDERBY, orderBy);
}
dummySearchServiceQueryNodeRefs.clear();
for (String id : ids) {
NodeRef nodeRef = getNodeRef(id);
dummySearchServiceQueryNodeRefs.add(nodeRef);
}
expectedIds = expectedIds != null ? expectedIds : ids;
HttpResponse response = getAll(URL_QUERIES_LSS, paging, params, 200);
if (expectedStatus == 200) {
String termWithEscapedAsterisks = term.replaceAll("\\*", "\\\\*");
String expectedQuery = "TYPE:\"{http://www.alfresco.org/model/site/1.0}site\" AND (\"*" + termWithEscapedAsterisks + "*\")";
ArgumentCaptor<SearchParameters> searchParametersCaptor = ArgumentCaptor.forClass(SearchParameters.class);
verify(mockSearchService, times(++callCountToMockSearchService)).query(searchParametersCaptor.capture());
SearchParameters parameters = searchParametersCaptor.getValue();
assertEquals("Query", expectedQuery, parameters.getQuery());
List<Site> sites = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Site.class);
assertEquals(expectedIds.length, sites.size());
if (orderBy != null) {
for (int i = 0; i < expectedIds.length; i++) {
String id = expectedIds[i];
String actualId = sites.get(i).getId();
assertEquals("Order " + i + ":", id, actualId);
}
}
}
}
use of org.alfresco.service.cmr.repository.NodeRef in project alfresco-remote-api by Alfresco.
the class RepoService method getActivitySummary.
@SuppressWarnings("unchecked")
public Map<String, Object> getActivitySummary(ActivityFeedEntity entity) throws JSONException {
Map<String, Object> activitySummary = activities.getActivitySummary(entity);
JSONObject json = new JSONObject();
for (String key : activitySummary.keySet()) {
Object value = activitySummary.get(key);
if (value instanceof NodeRef) {
value = ((NodeRef) value).getId();
}
json.put(key, value);
}
return json;
}
use of org.alfresco.service.cmr.repository.NodeRef in project alfresco-remote-api by Alfresco.
the class RepoService method createFolder.
public NodeRef createFolder(final NodeRef parentNodeRef, final String name, final String title, final String description) {
NodeRef nodeRef = fileFolderService.create(parentNodeRef, name, ContentModel.TYPE_FOLDER).getNodeRef();
nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, title);
nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, description);
return nodeRef;
}
use of org.alfresco.service.cmr.repository.NodeRef in project alfresco-remote-api by Alfresco.
the class RepoService method createCmObject.
public NodeRef createCmObject(final NodeRef parentNodeRef, final String name) {
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(name));
NodeRef nodeRef = nodeService.createNode(parentNodeRef, ContentModel.ASSOC_CONTAINS, assocQName, ContentModel.TYPE_CMOBJECT).getChildRef();
return nodeRef;
}
Aggregations