protected final Action newUpdateAction() {
return new Action("update") {
@Override
protected Object doAction(Object... params) {
Auth auth = (Auth) params[0];
String id = (String) params[1];
if(LOG.isDebugEnabled())
LOG.debug("Updating Auth ID: {}", id);
com.alu.e3.prov.restapi.model.Error error = validate(auth);
if(auth.getId() == null || auth.getId().equals(""))
auth.setId(id);
else if(auth.getId().equals(id) == false)
throw new InvalidParameterException("Auth ID mismatch");
AuthResponse response = new AuthResponse(AuthResponse.SUCCESS);
if(error == null){
com.alu.e3.data.model.Auth authDataModel = BeanConverterUtil.toDataModel(auth);
dataManager.updateAuth(authDataModel);
response.setId(auth.getId());
}
else{
error.setErrorCode("400");
response.setStatus(AuthResponse.FAILURE);
response.setError(error);