// initialize the memory store
DataStore store = DataStore.getInstance();
// obtain data object from memory store
DefectBean defect = store.getDefect(defectId);
if (defect == null) {
logger.error("Defect {} was not found", defectId);
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
// remove defect legacy bean from memory store
store.removeDefect(defect.getId());
// create new asset and set defect bean that is being deleted as its
// data object
DefectAsset asset = new DefectAsset(defect);
return asset;