Search in sources :

Example 1 with RepositoryInfo

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;
}
Also used : RepositoryInfoImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo)

Example 2 with RepositoryInfo

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;
}
Also used : CmisRuntimeException(org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException) JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) IRepository(com.pogeyan.cmis.api.repo.IRepository)

Example 3 with RepositoryInfo

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;
}
Also used : JSONObject(org.apache.chemistry.opencmis.commons.impl.json.JSONObject) RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) ArrayList(java.util.ArrayList) IRepository(com.pogeyan.cmis.api.repo.IRepository)

Example 4 with RepositoryInfo

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"));
}
Also used : RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) CmisTestResult(org.apache.chemistry.opencmis.tck.CmisTestResult) Folder(org.apache.chemistry.opencmis.client.api.Folder)

Example 5 with RepositoryInfo

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;
}
Also used : RepositoryInfo(org.apache.chemistry.opencmis.commons.data.RepositoryInfo) Network(org.alfresco.repo.tenant.Network) ArrayList(java.util.ArrayList) PagingRequest(org.alfresco.query.PagingRequest)

Aggregations

RepositoryInfo (org.apache.chemistry.opencmis.commons.data.RepositoryInfo)11 ArrayList (java.util.ArrayList)3 CmisTestResult (org.apache.chemistry.opencmis.tck.CmisTestResult)3 IRepository (com.pogeyan.cmis.api.repo.IRepository)2 XmlBuilder (nl.nn.adapterframework.util.XmlBuilder)2 JSONObject (org.apache.chemistry.opencmis.commons.impl.json.JSONObject)2 Element (org.w3c.dom.Element)2 IOException (java.io.IOException)1 BigInteger (java.math.BigInteger)1 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 HashMap (java.util.HashMap)1 SenderException (nl.nn.adapterframework.core.SenderException)1 CmisEvent (nl.nn.adapterframework.extensions.cmis.server.CmisEvent)1 Message (nl.nn.adapterframework.stream.Message)1 DomBuilderException (nl.nn.adapterframework.util.DomBuilderException)1 PagingRequest (org.alfresco.query.PagingRequest)1 Network (org.alfresco.repo.tenant.Network)1 CmisObject (org.apache.chemistry.opencmis.client.api.CmisObject)1 Folder (org.apache.chemistry.opencmis.client.api.Folder)1