@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Description("Creates an alert.") public AlertDto createAlert(@Context HttpServletRequest req,AlertDto alertDto){
  if (alertDto == null) {
    throw new WebApplicationException("Null alert object cannot be created.",Status.BAD_REQUEST);
  }
  PrincipalUser owner=validateAndGetOwner(req,alertDto.getOwnerName());
  Alert alert=new Alert(getRemoteUser(req),owner,alertDto.getName(),alertDto.getExpression(),alertDto.getCronEntry());
  copyProperties(alert,alertDto);
  return AlertDto.transformToDto(alertService.updateAlert(alert));
}

@ POST @ Produces ( MediaType . APPLICATION_JSON ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Description ( "Creates an alert." ) public AlertDto createAlert ( @ Context HttpServletRequest req , AlertDto alertDto ) { if ( alertDto == null ) { throw new WebApplicationException ( "Null alert object cannot be created." , Status . BAD_REQUEST ) ; } PrincipalUser owner = validateAndGetOwner ( req , alertDto . getOwnerName ( ) ) ; Alert alert = new Alert ( getRemoteUser ( req ) , owner , alertDto . getName ( ) , alertDto . getExpression ( ) , alertDto . getCronEntry ( ) ) ; copyProperties ( alert , alertDto ) ; return AlertDto . transformToDto ( alertService . updateAlert ( alert ) ) ; }
creates a new alert .
