use of org.apache.chemistry.opencmis.commons.data.RepositoryInfo in project iaf by ibissource.
the class HttpSessionCmisService method getRepositoryInfo.
@Override
public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
RepositoryInfo repInfo = getCmisBinding().getRepositoryService().getRepositoryInfo(repositoryId, extension);
RepositoryInfoImpl newRepInfo = new RepositoryInfoImpl(repInfo);
String description = repInfo.getDescription();
if (!description.isEmpty())
description += " ";
newRepInfo.setDescription(description + "(forwarded by " + AppConstants.getInstance().get("instance.name") + ")");
return newRepInfo;
}
use of org.apache.chemistry.opencmis.commons.data.RepositoryInfo in project copper-cms by PogeyanOSS.
the class RepositoryActor method getRepositoryInfo.
private JSONObject getRepositoryInfo(QueryGetRequest t) throws CmisRuntimeException {
String permission = t.getUserObject().getPermission();
if (!Helpers.checkingUserPremission(permission, "get")) {
throw new CmisRuntimeException(t.getUserName() + " is not authorized to applyAcl.");
}
// call DB and get the repositoryInfo
String rootId = CmisObjectService.Impl.addRootFolder(t.getRepositoryId(), t.getUserName());
IRepository repository = RepositoryManagerFactory.getInstance().getRepositoryStore().getRepository(t.getRepositoryId());
RepositoryInfo repo = createRepositoryInfo(t.getRepositoryId(), repository.getRepositoryName() == null ? "" : repository.getRepositoryName(), CmisVersion.CMIS_1_1, rootId, repository.getDescription() == null ? "" : repository.getDescription());
String repositoryUrl = HttpUtils.compileRepositoryUrl(t.getBaseUrl(), t.getScheme(), t.getServerName(), t.getServerPort(), t.getContextPath(), t.getServletPath(), repo.getId()).toString();
String rootUrl = HttpUtils.compileRootUrl(t.getBaseUrl(), t.getScheme(), t.getServerName(), t.getServerPort(), t.getContextPath(), t.getServletPath(), repo.getId()).toString();
JSONObject result = new JSONObject();
result.put(repo.getId(), JSONConverter.convert(repo, repositoryUrl, rootUrl, true));
return result;
}
use of org.apache.chemistry.opencmis.commons.data.RepositoryInfo in project copper-cms by PogeyanOSS.
the class RepositoryActor method getRepositories.
private JSONObject getRepositories(QueryGetRequest request) throws MongoException, CmisRuntimeException {
List<RepositoryInfo> infoDataList = new ArrayList<RepositoryInfo>() {
private static final long serialVersionUID = 1L;
{
List<IRepository> respositoryList = RepositoryManagerFactory.getInstance().getRepositoryStore().getRepositories(request.getRepositoryId());
if (respositoryList != null && !respositoryList.isEmpty()) {
for (IRepository repository : respositoryList) {
CmisTypeServices.Impl.addBaseType(repository.getRepositoryId(), request.getUserName());
String rootId = CmisObjectService.Impl.addRootFolder(repository.getRepositoryId(), request.getUserName());
add(createRepositoryInfo(repository.getRepositoryId(), repository.getRepositoryName(), CmisVersion.CMIS_1_1, rootId, repository.getDescription() == null ? "" : repository.getDescription()));
}
}
}
};
JSONObject result = new JSONObject();
for (RepositoryInfo ri : infoDataList) {
String repositoryUrl = HttpUtils.compileRepositoryUrl(request.getBaseUrl(), request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath(), request.getServletPath(), ri.getId()).toString();
String rootUrl = HttpUtils.compileRootUrl(request.getBaseUrl(), request.getScheme(), request.getServerName(), request.getServerPort(), request.getContextPath(), request.getServletPath(), ri.getId()).toString();
result.put(ri.getId(), JSONConverter.convert(ri, repositoryUrl, rootUrl, true));
}
return result;
}
use of org.apache.chemistry.opencmis.commons.data.RepositoryInfo in project copper-cms by PogeyanOSS.
the class RootFolderTest method run.
@Override
public void run(Session session) throws Exception {
CmisTestResult success;
CmisTestResult failure;
// check root folder id
RepositoryInfo ri = getRepositoryInfo(session);
success = createResult(OK, "Root folder id: " + ri.getRootFolderId());
failure = createResult(FAILURE, "Root folder id is not set!");
addResult(assertStringNotEmpty(ri.getRootFolderId(), success, failure));
// get the root folder
Folder rootFolder = session.getRootFolder(SELECT_ALL_NO_CACHE_OC);
if (rootFolder == null) {
addResult(createResult(FAILURE, "Root folder is not available!"));
return;
}
// check existence
failure = createResult(FAILURE, "Root folder doesn't exist?!");
addResult(assertIsTrue(session.exists(ri.getRootFolderId()), null, failure));
// check folder object
addResult(checkObject(session, rootFolder, getAllProperties(rootFolder), "Root folder object spec compliance"));
// folder and path
failure = createResult(FAILURE, "Root folder id in the repository info doesn't match the root folder object id!");
addResult(assertEquals(ri.getRootFolderId(), rootFolder.getId(), null, failure));
failure = createResult(FAILURE, "Root folder is not a cmis:folder!");
addResult(assertEquals(BaseTypeId.CMIS_FOLDER, rootFolder.getBaseTypeId(), null, failure));
failure = createResult(FAILURE, "Root folder path is not '/'!");
addResult(assertEquals("/", rootFolder.getPath(), null, failure));
failure = createResult(FAILURE, "Root folder has parents!");
addResult(assertEquals(0, rootFolder.getParents().size(), null, failure));
// allowable actions
failure = createResult(FAILURE, "Root folder has CAN_GET_FOLDER_PARENT allowable action!");
addResult(assertNotAllowableAction(rootFolder, Action.CAN_GET_FOLDER_PARENT, null, failure));
failure = createResult(WARNING, "Root folder has no CAN_GET_CHILDREN allowable action!");
addResult(assertAllowableAction(rootFolder, Action.CAN_GET_CHILDREN, null, failure));
// simple children test
addResult(checkChildren(session, rootFolder, "Root folder children check"));
}
use of org.apache.chemistry.opencmis.commons.data.RepositoryInfo in project alfresco-remote-api by Alfresco.
the class PublicApiAlfrescoCmisService method getRepositoryInfos.
@Override
public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
// for currently authenticated user
PagingResults<Network> networks = networksService.getNetworks(new PagingRequest(0, Integer.MAX_VALUE));
List<Network> page = networks.getPage();
final List<RepositoryInfo> repoInfos = new ArrayList<RepositoryInfo>(page.size() + 1);
for (Network network : page) {
repoInfos.add(getRepositoryInfo(network));
}
return repoInfos;
}
Aggregations