use of i5.las2peer.api.execution.InvocationBadArgumentException in project Distributed-Noracle-Backend by Distributed-Noracle.
the class NoracleSpaceService method joinSpace.
public void joinSpace(String spaceId, String spaceSecret) throws ServiceInvocationException {
if (spaceId == null || spaceId.isEmpty()) {
throw new InvocationBadArgumentException("No space id given");
} else if (spaceSecret == null || spaceSecret.isEmpty()) {
throw new ServiceAccessDeniedException("No space secret given");
}
try {
UserAgentImpl inviteAgent = this.getInviteAgent(spaceId);
inviteAgent.unlock(spaceSecret);
GroupAgent memberAgent = this.getMemberAgent(spaceId);
memberAgent.unlock(inviteAgent);
memberAgent.addMember(Context.get().getMainAgent());
Context.get().storeAgent(memberAgent);
} catch (AgentAccessDeniedException e) {
throw new ServiceAccessDeniedException("Could not unlock agent", e);
} catch (Exception e) {
throw new ServiceInvocationException("Could not join space", e);
}
}
use of i5.las2peer.api.execution.InvocationBadArgumentException in project Distributed-Noracle-Backend by Distributed-Noracle.
the class NoracleSpaceService method getSpace.
@Override
public Space getSpace(String spaceId) throws ServiceInvocationException {
if (spaceId == null || spaceId.isEmpty()) {
throw new InvocationBadArgumentException("No space id given");
}
Envelope env;
try {
env = Context.get().requestEnvelope(getSpaceEnvelopeIdentifier(spaceId));
} catch (EnvelopeAccessDeniedException e) {
throw new ServiceAccessDeniedException("Access Denied", e);
} catch (EnvelopeNotFoundException e) {
throw new ResourceNotFoundException("Space Not Found", e);
} catch (EnvelopeOperationFailedException e) {
throw new InternalServiceException("Could not deserialize space object", e);
}
Space space = (Space) env.getContent();
return space;
}
use of i5.las2peer.api.execution.InvocationBadArgumentException in project Distributed-Noracle-Backend by Distributed-Noracle.
the class NoracleQuestionRelationService method getQuestionRelation.
@Override
public QuestionRelation getQuestionRelation(String relationId) throws ServiceInvocationException {
if (relationId == null || relationId.isEmpty()) {
throw new InvocationBadArgumentException("No relation id given");
}
Envelope env;
try {
env = Context.get().requestEnvelope(getQuestionRelationEnvelopeIdentifier(relationId));
} catch (EnvelopeAccessDeniedException e) {
throw new ServiceAccessDeniedException("Envelope Access Denied");
} catch (EnvelopeOperationFailedException e) {
throw new InternalServiceException("Could not fetch relation envelope", e);
} catch (EnvelopeNotFoundException e) {
throw new ResourceNotFoundException("Relation Not Found");
}
QuestionRelation relation = (QuestionRelation) env.getContent();
return relation;
}
Aggregations