use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class FossologyAwarePortlet method serveSendToFossology.
protected void serveSendToFossology(ResourceRequest request, ResourceResponse response) throws PortletException {
final RequestStatus requestStatus = sendToFossology(request);
renderRequestStatus(request, response, requestStatus);
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class FossologyAdminPortlet method serveDeployScripts.
public void serveDeployScripts(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
RequestStatus deploy = RequestStatus.FAILURE;
try {
deploy = thriftClients.makeFossologyClient().deployScripts();
} catch (TException e) {
log.error("Error connecting to backend", e);
}
renderRequestStatus(request, response, deploy);
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class FossologyAdminPortlet method serveCheckConnection.
public void serveCheckConnection(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
RequestStatus checkConnection = RequestStatus.FAILURE;
try {
checkConnection = thriftClients.makeFossologyClient().checkConnection();
} catch (TException e) {
log.error("Error connecting to backend", e);
}
renderRequestStatus(request, response, checkConnection);
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ModerationDatabaseHandler method createRequest.
public RequestStatus createRequest(Component component, User user, Boolean isDeleteRequest) {
Component dbcomponent;
try {
dbcomponent = componentDatabaseHandler.getComponent(component.getId(), user);
} catch (SW360Exception e) {
log.error("Could not get original component from database. Could not generate moderation request.", e);
return RequestStatus.FAILURE;
}
// Define moderators
Set<String> moderators = new HashSet<>();
CommonUtils.add(moderators, dbcomponent.getCreatedBy());
try {
String department = getDepartmentByUserEmail(component.getCreatedBy());
CommonUtils.addAll(moderators, getUsersAtLeast(UserGroup.CLEARING_ADMIN, department));
} catch (TException e) {
log.error("Could not get user from database. Clearing admins not added as moderators, since department is missing.");
}
CommonUtils.addAll(moderators, getUsersAtLeast(UserGroup.ADMIN));
ModerationRequest request = createStubRequest(user, isDeleteRequest, component.getId(), moderators);
// Set meta-data
request.setDocumentType(DocumentType.COMPONENT);
request.setDocumentName(SW360Utils.printName(dbcomponent));
// Fill the request
ModerationRequestGenerator generator = new ComponentModerationRequestGenerator();
request = generator.setAdditionsAndDeletions(request, component, dbcomponent);
if (component.isSetComponentType()) {
request.setComponentType(component.getComponentType());
}
addOrUpdate(request, user);
return RequestStatus.SENT_TO_MODERATOR;
}
use of org.eclipse.sw360.datahandler.thrift.RequestStatus in project sw360portal by sw360.
the class ModerationDatabaseHandler method createRequest.
public RequestStatus createRequest(Release release, User user, Boolean isDeleteRequest, Function<Release, Set<String>> moderatorsProvider) {
Release dbrelease;
try {
dbrelease = componentDatabaseHandler.getRelease(release.getId(), user);
} catch (SW360Exception e) {
log.error("Could not get original release from database. Could not generate moderation request.", e);
return RequestStatus.FAILURE;
}
Set<String> moderators = moderatorsProvider.apply(dbrelease);
ModerationRequest request = createStubRequest(user, isDeleteRequest, release.getId(), moderators);
// Set meta-data
request.setDocumentType(DocumentType.RELEASE);
request.setDocumentName(SW360Utils.printName(dbrelease));
// Fill the rest
SW360Utils.setVendorId(release);
SW360Utils.setVendorId(dbrelease);
ModerationRequestGenerator generator = new ReleaseModerationRequestGenerator();
request = generator.setAdditionsAndDeletions(request, release, dbrelease);
try {
Component parentComponent = componentDatabaseHandler.getComponent(release.getComponentId(), user);
request.setComponentType(parentComponent.getComponentType());
} catch (SW360Exception e) {
log.error("Could not retrieve parent component type of release with ID=" + release.getId());
}
addOrUpdate(request, user);
return RequestStatus.SENT_TO_MODERATOR;
}
Aggregations