use of i5.las2peer.services.noracleService.model.Question in project Distributed-Noracle-Backend by Distributed-Noracle.
the class NoracleQuestionRelationService method linkQuestionRelationToSpace.
public boolean linkQuestionRelationToSpace(String spaceId, String relationId) {
int relationNumber;
for (relationNumber = 1; relationNumber < MAX_RELATIONS_PER_SPACE; relationNumber++) {
try {
Context.get().requestEnvelope(buildSpaceQuestionRelationNumberId(spaceId, relationNumber));
} catch (EnvelopeNotFoundException e) {
// found free question number
break;
} catch (Exception e) {
// XXX logging
}
}
try {
Envelope spaceQuestionRelationEnv = Context.get().createEnvelope(buildSpaceQuestionRelationNumberId(spaceId, relationNumber));
spaceQuestionRelationEnv.setPublic();
spaceQuestionRelationEnv.setContent(relationId);
Context.get().storeEnvelope(spaceQuestionRelationEnv);
return true;
} catch (EnvelopeOperationFailedException | EnvelopeAccessDeniedException e) {
// TODO exception handling
e.printStackTrace();
}
return false;
}
Aggregations