Search in sources :

Example 6 with AddDocumentRequestSummary

use of org.eclipse.sw360.datahandler.thrift.AddDocumentRequestSummary in project sw360portal by sw360.

the class Sw360ReleaseService method createRelease.

public Release createRelease(Release release, User sw360User) throws TException {
    ComponentService.Iface sw360ComponentClient = getThriftComponentClient();
    AddDocumentRequestSummary documentRequestSummary = sw360ComponentClient.addRelease(release, sw360User);
    if (documentRequestSummary.getRequestStatus() == AddDocumentRequestStatus.SUCCESS) {
        release.setId(documentRequestSummary.getId());
        return release;
    } else if (documentRequestSummary.getRequestStatus() == AddDocumentRequestStatus.DUPLICATE) {
        throw new DataIntegrityViolationException("sw360 release with name '" + release.getName() + "' already exists.");
    }
    return null;
}
Also used : AddDocumentRequestSummary(org.eclipse.sw360.datahandler.thrift.AddDocumentRequestSummary) ComponentService(org.eclipse.sw360.datahandler.thrift.components.ComponentService) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException)

Aggregations

TException (org.apache.thrift.TException)3 AddDocumentRequestSummary (org.eclipse.sw360.datahandler.thrift.AddDocumentRequestSummary)3 User (org.eclipse.sw360.datahandler.thrift.users.User)3 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)3 ComponentService (org.eclipse.sw360.datahandler.thrift.components.ComponentService)2 WrappedTException (org.eclipse.sw360.datahandler.common.WrappedException.WrappedTException)1 ProjectService (org.eclipse.sw360.datahandler.thrift.projects.ProjectService)1