Search in sources :

Example 1 with SpaceSubscribersList

use of i5.las2peer.services.noracleService.model.SpaceSubscribersList in project Distributed-Noracle-Backend by Distributed-Noracle.

the class NoracleSpaceService method getSubscribers.

@Override
public SpaceSubscribersList getSubscribers(String spaceId) throws ServiceInvocationException {
    if (spaceId == null || spaceId.isEmpty()) {
        throw new InvocationBadArgumentException("No space id given");
    }
    try {
        UserAgentImpl inviteAgent = this.getInviteAgent(spaceId);
        GroupAgent memberAgent = this.getMemberAgent(spaceId);
        memberAgent.unlock(Context.get().getMainAgent());
        String[] memberIds = memberAgent.getMemberList();
        SpaceSubscribersList subscribers = new SpaceSubscribersList();
        for (int i = 0; i < memberIds.length; i++) {
            if (!memberIds[i].equals(inviteAgent.getIdentifier())) {
                UserAgentImpl agent = (UserAgentImpl) Context.get().fetchAgent(memberIds[i]);
                NoracleAgentProfile profile = new NoracleAgentProfile();
                profile.setName(agent.getLoginName());
                subscribers.add(profile);
            }
        }
        return subscribers;
    } catch (Exception e) {
        throw new ServiceInvocationException("Could not fetch list", e);
    }
}
Also used : NoracleAgentProfile(i5.las2peer.services.noracleService.model.NoracleAgentProfile) UserAgentImpl(i5.las2peer.security.UserAgentImpl) SpaceSubscribersList(i5.las2peer.services.noracleService.model.SpaceSubscribersList) EnvelopeAccessDeniedException(i5.las2peer.api.persistency.EnvelopeAccessDeniedException) CryptoException(i5.las2peer.tools.CryptoException) EnvelopeOperationFailedException(i5.las2peer.api.persistency.EnvelopeOperationFailedException) SerializationException(i5.las2peer.serialization.SerializationException) EnvelopeNotFoundException(i5.las2peer.api.persistency.EnvelopeNotFoundException)

Aggregations

EnvelopeAccessDeniedException (i5.las2peer.api.persistency.EnvelopeAccessDeniedException)1 EnvelopeNotFoundException (i5.las2peer.api.persistency.EnvelopeNotFoundException)1 EnvelopeOperationFailedException (i5.las2peer.api.persistency.EnvelopeOperationFailedException)1 UserAgentImpl (i5.las2peer.security.UserAgentImpl)1 SerializationException (i5.las2peer.serialization.SerializationException)1 NoracleAgentProfile (i5.las2peer.services.noracleService.model.NoracleAgentProfile)1 SpaceSubscribersList (i5.las2peer.services.noracleService.model.SpaceSubscribersList)1 CryptoException (i5.las2peer.tools.CryptoException)1