Package com.dottydingo.hyperion.api

Examples of com.dottydingo.hyperion.api.ApiObject


        EndpointResponse response = phaseContext.getEndpointResponse();

        ApiVersionPlugin<ApiObject,PersistentObject> apiVersionPlugin = phaseContext.getVersionPlugin();
        EntityPlugin plugin = phaseContext.getEntityPlugin();

        ApiObject clientObject = marshaller.unmarshall(request.getInputStream(),apiVersionPlugin.getApiClass());
        clientObject.setId(null);

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);
        Set<String> fieldSet = persistenceContext.getRequestedFields();
        if(fieldSet != null)
            fieldSet.add("id");

        ApiObject saved = plugin.getPersistenceOperations().createOrUpdateItem(clientObject, persistenceContext);
        if(saved != null)
        {
            processChangeEvents(phaseContext,persistenceContext);
            if(persistenceContext.getWriteContext() == WriteContext.create)
            {
                response.setResponseCode(201);
                String location = String.format("%s%s/%s",request.getBaseUrl(),request.getRequestUri(),saved.getId());
                response.setHeader("Location", location);
            }
            else
            {
                response.setResponseCode(200);
View Full Code Here


        EntityPlugin plugin = phaseContext.getEntityPlugin();

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);

        RequestContext<ApiObject> requestContext = marshaller.unmarshallWithContext(request.getInputStream(), apiVersionPlugin.getApiClass());
        ApiObject clientObject = requestContext.getRequestObject();

        List ids = plugin.getKeyConverter().covertKeys(phaseContext.getId());
        if(ids.size() != 1)
            throw new BadRequestException("A single id must be provided for an update.");

        Set<String> setFields = requestContext.getSetFields();

        persistenceContext.setProvidedFields(setFields);

        Set<String> fieldSet = persistenceContext.getRequestedFields();
        if(fieldSet != null)
            fieldSet.add("id");

        ApiObject saved = plugin.getPersistenceOperations().updateItem(ids, clientObject, persistenceContext);

        processChangeEvents(phaseContext,persistenceContext);

        if(saved != null)
        {
View Full Code Here

        EndpointResponse response = phaseContext.getEndpointResponse();

        ApiVersionPlugin<ApiObject,PersistentObject> apiVersionPlugin = phaseContext.getVersionPlugin();
        EntityPlugin plugin = phaseContext.getEntityPlugin();

        ApiObject clientObject = marshaller.unmarshall(request.getInputStream(),apiVersionPlugin.getApiClass());
        clientObject.setId(null);

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);
        Set<String> fieldSet = persistenceContext.getRequestedFields();
        if(fieldSet != null)
            fieldSet.add("id");


        ApiObject saved = plugin.getPersistenceOperations().createOrUpdateItem(clientObject, persistenceContext);
        if(saved != null)
        {
            processChangeEvents(phaseContext,persistenceContext);
            if(persistenceContext.getWriteContext() == WriteContext.create)
            {
                response.setResponseCode(201);
                String location = String.format("%s%s/%s",request.getBaseUrl(),request.getRequestUri(),saved.getId());
                response.setHeader("Location", location);
            }
            else
            {
                response.setResponseCode(200);
View Full Code Here

        ApiVersionPlugin<ApiObject,PersistentObject> apiVersionPlugin = phaseContext.getVersionPlugin();
        EntityPlugin plugin = phaseContext.getEntityPlugin();

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);

        ApiObject clientObject = marshaller.unmarshall(request.getInputStream(), apiVersionPlugin.getApiClass());

        List ids = plugin.getKeyConverter().covertKeys(phaseContext.getId());
        if(ids.size() != 1)
            throw new BadRequestException("A single id must be provided for an update.");

        Set<String> fieldSet = persistenceContext.getRequestedFields();
        if(fieldSet != null)
            fieldSet.add("id");

        ApiObject saved = plugin.getPersistenceOperations().updateItem(ids, clientObject, persistenceContext);

        processChangeEvents(phaseContext,persistenceContext);

        if(saved != null)
        {
View Full Code Here

TOP

Related Classes of com.dottydingo.hyperion.api.ApiObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.