@Consumes(MediaType.APPLICATION_JSON)
public void createItem(@PathParam("entity") String entity,
@QueryParam("fields") String fields,
@QueryParam("version") Integer version )
{
RequestContext requestContext = null;
try
{
EntityPlugin<C,?,ID> plugin = getEntityPlugin(entity);
checkMethodAllowed(plugin,HttpMethod.POST);
ApiVersionPlugin<C,?> apiVersionPlugin = plugin.getApiVersionRegistry().getPluginForVersion(version);
requestContext = buildRequestContext(entity,fields,HttpMethod.POST, plugin, apiVersionPlugin);
endpointAuthorizationChecker.checkAuthorization(requestContext);
C clientObject = endpointMarshaller.unmarshall(httpServletRequest,apiVersionPlugin.getApiClass());
Set<String> fieldSet = requestContext.getRequestedFields();
if(fieldSet != null)
fieldSet.add("id");
C saved = plugin.getPersistenceOperations().createOrUpdateItem(clientObject, requestContext);
if(saved != null)
{
addVersionHeader(apiVersionPlugin.getVersion());
if(requestContext.getWriteContext() == WriteContext.create)
{
httpServletResponse.setStatus(201);
httpServletResponse.setHeader("Location",URI.create(saved.getId().toString()).toString());
}
else