Search in sources :

Example 1 with Network

use of org.alfresco.rest.api.model.Network in project alfresco-remote-api by Alfresco.

the class NetworksImpl method getNetwork.

public PersonNetwork getNetwork(String personId, String networkId) {
    // check that personId is the current user
    personId = people.validatePerson(personId, true);
    Network network = validateNetwork(networkId);
    org.alfresco.repo.tenant.Network tenantNetwork = networksService.getNetwork(network.getId());
    PersonNetwork personNetwork = getPersonNetwork(tenantNetwork);
    return personNetwork;
}
Also used : Network(org.alfresco.rest.api.model.Network) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork)

Example 2 with Network

use of org.alfresco.rest.api.model.Network in project alfresco-remote-api by Alfresco.

the class NetworksImpl method validateNetwork.

public Network validateNetwork(String networkId) {
    org.alfresco.repo.tenant.Network network = networksService.getNetwork(networkId);
    if (network == null) {
        throw new EntityNotFoundException(networkId);
    }
    Network restNetwork = new NetworkImpl(network);
    return restNetwork;
}
Also used : Network(org.alfresco.rest.api.model.Network) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork) NetworkImpl(org.alfresco.rest.api.model.NetworkImpl) EntityNotFoundException(org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)

Example 3 with Network

use of org.alfresco.rest.api.model.Network in project alfresco-remote-api by Alfresco.

the class NetworksImpl method getNetworks.

public CollectionWithPagingInfo<PersonNetwork> getNetworks(String personId, Paging paging) {
    // check that personId is the current user
    personId = people.validatePerson(personId, true);
    PagingResults<org.alfresco.repo.tenant.Network> networks = networksService.getNetworks(Util.getPagingRequest(paging));
    List<PersonNetwork> ret = new ArrayList<PersonNetwork>(networks.getPage().size());
    for (org.alfresco.repo.tenant.Network network : networks.getPage()) {
        PersonNetwork personNetwork = getPersonNetwork(network);
        ret.add(personNetwork);
    }
    return CollectionWithPagingInfo.asPaged(paging, ret, networks.hasMoreItems(), networks.getTotalResultCount().getFirst());
}
Also used : Network(org.alfresco.rest.api.model.Network) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork) ArrayList(java.util.ArrayList) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork)

Example 4 with Network

use of org.alfresco.rest.api.model.Network in project alfresco-remote-api by Alfresco.

the class NetworksImpl method getPersonNetwork.

private PersonNetwork getPersonNetwork(org.alfresco.repo.tenant.Network network) {
    Network restNetwork = new NetworkImpl(network);
    PersonNetwork personNetwork = new PersonNetwork(network.getIsHomeNetwork(), restNetwork);
    return personNetwork;
}
Also used : Network(org.alfresco.rest.api.model.Network) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork) NetworkImpl(org.alfresco.rest.api.model.NetworkImpl) PersonNetwork(org.alfresco.rest.api.model.PersonNetwork)

Aggregations

Network (org.alfresco.rest.api.model.Network)4 PersonNetwork (org.alfresco.rest.api.model.PersonNetwork)4 NetworkImpl (org.alfresco.rest.api.model.NetworkImpl)2 ArrayList (java.util.ArrayList)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1