use of org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest in project sw360portal by sw360.
the class ModerationDatabaseHandler method deleteModerationRequest.
public RequestStatus deleteModerationRequest(String id, User user) {
ModerationRequest moderationRequest = repository.get(id);
if (moderationRequest != null) {
if (hasPermissionToDeleteModerationRequest(user, moderationRequest)) {
boolean succeeded = repository.remove(id);
return succeeded ? RequestStatus.SUCCESS : RequestStatus.FAILURE;
} else {
log.error("Problems deleting moderation request: User " + user.getEmail() + " tried to delete " + "moderation request of user " + moderationRequest.getRequestingUser());
return RequestStatus.FAILURE;
}
}
log.error("Moderation request to delete was null.");
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest in project sw360portal by sw360.
the class ModerationDatabaseHandler method refuseRequest.
public void refuseRequest(String requestId, String moderationDecisionComment, String reviewer) {
ModerationRequest request = repository.get(requestId);
request.setModerationState(ModerationState.REJECTED);
request.setTimestampOfDecision(System.currentTimeMillis());
request.setCommentDecisionModerator(moderationDecisionComment);
request.setReviewer(reviewer);
repository.update(request);
sendMailToUserForDeclinedRequest(request);
}
use of org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest in project sw360portal by sw360.
the class ModerationDatabaseHandler method createRequest.
public RequestStatus createRequest(Project project, User user, Boolean isDeleteRequest) {
Project dbproject;
try {
dbproject = projectDatabaseHandler.getProjectById(project.getId(), user);
} catch (SW360Exception e) {
log.error("Could not get original project from database. Could not generate moderation request.", e);
return RequestStatus.FAILURE;
}
// Define moderators
Set<String> moderators = getProjectModerators(dbproject);
ModerationRequest request = createStubRequest(user, isDeleteRequest, project.getId(), moderators);
// Set meta-data
request.setDocumentType(DocumentType.PROJECT);
request.setDocumentName(SW360Utils.printName(dbproject));
// Fill the request
ModerationRequestGenerator generator = new ProjectModerationRequestGenerator();
request = generator.setAdditionsAndDeletions(request, project, dbproject);
addOrUpdate(request, user);
return RequestStatus.SENT_TO_MODERATOR;
}
use of org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest in project sw360portal by sw360.
the class ModerationHandler method cancelInProgress.
@Override
public void cancelInProgress(String requestId) throws TException {
ModerationRequest request = handler.getRequest(requestId);
request.setModerationState(ModerationState.PENDING);
request.unsetReviewer();
handler.updateModerationRequest(request);
}
Aggregations