New task record controller
As a caseworker uses the system, he or she is able to expand and collapse the task record associated with the case record. The user can create, edit, and amend tasks, and can also change the state of the case.
The AngularJS module newtask
is defined thus:
var newtask = angular.module('newtask', ['ui.bootstrap.modal', 'sharedService']) newtask.config(function($httpProvider) { $httpProvider.defaults.headers["delete"] = { 'Content-Type': 'application/json;charset=utf-8' }; })
We add a configuration change to AngularJS around the HTTP remoting. There is a subtle bug with the HTTP DELETE request. The JAX-RS reference implementation, Jersey, which is present in the GlassFish and Payara application server, raises an HTTP error with a response code 415: Unsupported Media Type
. This forces AngularJS to send the MIME type, as JSON on the DELETE requests solves the issue.
Since the code for the task controller is so similar, only the create part of CRUD will be revealed...