use of org.eclipse.sw360.datahandler.thrift.vendors.Vendor in project sw360portal by sw360.
the class Sw360VendorService method deleteVendor.
public void deleteVendor(Vendor vendor, User sw360User) {
try {
VendorService.Iface sw360VendorClient = getThriftVendorClient();
RequestStatus requestStatus = sw360VendorClient.deleteVendor(vendor.getId(), sw360User);
if (requestStatus == RequestStatus.SUCCESS) {
return;
}
throw new RuntimeException("sw360 vendor with name '" + vendor.getFullname() + " cannot be deleted.");
} catch (TException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.sw360.datahandler.thrift.vendors.Vendor in project sw360portal by sw360.
the class Sw360VendorService method deleteAllVendors.
public void deleteAllVendors(User sw360User) {
try {
VendorService.Iface sw360VendorClient = getThriftVendorClient();
List<Vendor> vendors = sw360VendorClient.getAllVendors();
for (Vendor vendor : vendors) {
sw360VendorClient.deleteVendor(vendor.getId(), sw360User);
}
} catch (TException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.sw360.datahandler.thrift.vendors.Vendor in project sw360portal by sw360.
the class Sw360VendorService method updateVendor.
public void updateVendor(Vendor vendor, User sw360User) {
try {
VendorService.Iface sw360VendorClient = getThriftVendorClient();
RequestStatus requestStatus = sw360VendorClient.updateVendor(vendor, sw360User);
if (requestStatus == RequestStatus.SUCCESS) {
return;
}
throw new RuntimeException("sw360 vendor with full name '" + vendor.getFullname() + " cannot be updated.");
} catch (TException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.sw360.datahandler.thrift.vendors.Vendor in project sw360portal by sw360.
the class VendorResourceProcessor method process.
@Override
public Resource<Vendor> process(Resource<Vendor> resource) {
Vendor project = resource.getContent();
Link selfLink = linkTo(VendorController.class).slash("api" + VendorController.VENDORS_URL + "/" + project.getId()).withSelfRel();
resource.add(selfLink);
return resource;
}
use of org.eclipse.sw360.datahandler.thrift.vendors.Vendor in project sw360portal by sw360.
the class BulkReleaseEdit method serveAddVendor.
private void serveAddVendor(ResourceRequest request, ResourceResponse response) throws IOException, PortletException {
final Vendor vendor = new Vendor();
ComponentPortletUtils.updateVendorFromRequest(request, vendor);
try {
VendorService.Iface client = thriftClients.makeVendorClient();
String vendorId = client.addVendor(vendor);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("id", vendorId);
try {
writeJSON(request, response, jsonObject);
} catch (IOException e) {
log.error("Problem rendering VendorId", e);
}
} catch (TException e) {
log.error("Error adding vendor", e);
}
}
Aggregations