Search in sources :

Example 6 with SW360Utils.printName

use of org.eclipse.sw360.datahandler.common.SW360Utils.printName 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;
}
Also used : Project(org.eclipse.sw360.datahandler.thrift.projects.Project) ModerationRequest(org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest) SW360Exception(org.eclipse.sw360.datahandler.thrift.SW360Exception)

Aggregations

ModerationRequest (org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)5 SW360Exception (org.eclipse.sw360.datahandler.thrift.SW360Exception)4 Component (org.eclipse.sw360.datahandler.thrift.components.Component)2 IOException (java.io.IOException)1 TException (org.apache.thrift.TException)1 Release (org.eclipse.sw360.datahandler.thrift.components.Release)1 License (org.eclipse.sw360.datahandler.thrift.licenses.License)1 Project (org.eclipse.sw360.datahandler.thrift.projects.Project)1 User (org.eclipse.sw360.datahandler.thrift.users.User)1