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);
}
}
Aggregations