resp = mapper.map(savedProduct, DisplayProduct.class);
}catch (DataIntegrityViolationException dive){
dive.printStackTrace();
SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-4);
try{
String contraintMsg = dive.getCause().getCause().getMessage();
if(StringUtils.indexOf(contraintMsg, "key 'sku'") > 0){
resp1.addError("sku", "SKU Found");
}else if(StringUtils.indexOf(contraintMsg, "key 'barcode'") > 0){
resp1.addError("barcode", "Barcode Found");
}
return resp1;
}catch (Exception e) {
e.printStackTrace();
SgwtRestErrorResponse resp2 = new SgwtRestErrorResponse(-1);
resp2.addError("exeption", e.getMessage());
return resp2;
}
} catch (Exception e) {
e.printStackTrace();
SgwtRestErrorResponse resp3 = new SgwtRestErrorResponse(-1);
resp3.addError("exeption", e.getMessage());
return resp3;
}
SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
return ret;