Package org.eclipse.persistence.internal.jpa.rs.metadata.model

Examples of org.eclipse.persistence.internal.jpa.rs.metadata.model.LinkV2


        if (result instanceof PersistenceWeavedRest) {
            ItemLinks itemLinks = new ItemLinks();
            ClassDescriptor descriptor = context.getJAXBDescriptorForClass(result.getClass());
            PersistenceWeavedRest entity = (PersistenceWeavedRest) result;
            String href = HrefHelper.buildEntityHref(context, descriptor.getAlias(), IdHelper.stringifyId(result, descriptor.getAlias(), context));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_CANONICAL, href));
            entity._persistence_setLinks(itemLinks);
        }
        return result;
    }
View Full Code Here


            // We don't have a way of determining self links for the report query responses
            // so, no links array will be inserted into individual items in the response
            queryResultListItem.setFields(jaxbFields);
            response.addItem(queryResultListItem);
        }
        response.addLink(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));
        return response;
    }
View Full Code Here

        ReadAllQueryResultCollection response = new ReadAllQueryResultCollection();
        for (Object item : items) {
            response.addItem(populateReadAllQueryResultListItemLinks(context, item));
        }

        response.addLink(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));
        return response;
    }
View Full Code Here

        ItemLinks itemLinks = new ItemLinks();
        ClassDescriptor descriptor = context.getJAXBDescriptorForClass(result.getClass());
        if ((result instanceof PersistenceWeavedRest) && (descriptor != null) && (context != null)) {
            PersistenceWeavedRest entity = (PersistenceWeavedRest) result;
            String href = HrefHelper.buildEntityHref(context, descriptor.getAlias(), IdHelper.stringifyId(result, descriptor.getAlias(), context));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_CANONICAL, href));
            entity._persistence_setLinks(itemLinks);
            return entity;
        }
        return result;
    }
View Full Code Here

        ClassDescriptor descriptor = context.getJAXBDescriptorForClass(result.getClass());
        if ((result instanceof PersistenceWeavedRest) && (descriptor != null) && (context != null)) {
            ItemLinks itemLinks = new ItemLinks();
            PersistenceWeavedRest entity = (PersistenceWeavedRest) result;
            String href = HrefHelper.buildEntityHref(context, descriptor.getAlias(), IdHelper.stringifyId(result, descriptor.getAlias(), context));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_CANONICAL, href));
            entity._persistence_setLinks(itemLinks);
            return entity;
        }
        return result;
    }
View Full Code Here

                // next link
                // The uri might have other query/matrix parameters, just replace the limit and offset
                // for next and prev links and leave the rest untouched
                uriBuilder = UriBuilder.fromUri(uriInfo.getRequestUri());
                uriBuilder.replaceQueryParam(QueryParameters.JPARS_PAGING_OFFSET, nextOffset);
                links.add(new LinkV2(ReservedWords.JPARS_REL_NEXT, uriBuilder.build().toString()));
                resultCollection.setHasMore(true);
            } else {
                resultCollection.setHasMore(false);
            }
        }

        if (!NO_PREVIOUS_CHUNK.equals(prevOffset)) {
            // prev link
            uriBuilder = UriBuilder.fromUri(uriInfo.getRequestUri());
            uriBuilder.replaceQueryParam(QueryParameters.JPARS_PAGING_OFFSET, prevOffset);
            links.add(new LinkV2(ReservedWords.JPARS_REL_PREV, uriBuilder.build().toString()));
        }

        links.add(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));

        resultCollection.setLinks(links);
        resultCollection.setOffset(offset);
        resultCollection.setLimit(limit);
View Full Code Here

        if (result instanceof PersistenceWeavedRest) {
            ItemLinks itemLinks = new ItemLinks();
            ClassDescriptor descriptor = context.getJAXBDescriptorForClass(result.getClass());
            PersistenceWeavedRest entity = (PersistenceWeavedRest) result;
            String href = context.getBaseURI() + context.getVersion() + "/" + context.getName() + "/entity/" + descriptor.getAlias() + "/" + IdHelper.stringifyId(result, descriptor.getAlias(), context);
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
            entity._persistence_setLinks(itemLinks);
        }
        return result;
    }
View Full Code Here

            // We don't have a way of determining self links for the report query responses
            // so, no links array will be inserted into individual items in the response
            queryResultListItem.setFields(jaxbFields);
            response.addItem(queryResultListItem);
        }
        response.addLink(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));
        return response;
    }
View Full Code Here

        ReadAllQueryResultCollection response = new ReadAllQueryResultCollection();
        for (Object item : items) {
            response.addItem(populateReadAllQueryResultListItemLinks(context, item));
        }

        response.addLink(new LinkV2(ReservedWords.JPARS_REL_SELF, uriInfo.getRequestUri().toString()));
        return response;
    }
View Full Code Here

        ClassDescriptor descriptor = context.getJAXBDescriptorForClass(result.getClass());
        if ((result instanceof PersistenceWeavedRest) && (descriptor != null) && (context != null)) {
            PersistenceWeavedRest entity = (PersistenceWeavedRest) result;
            String entityId = IdHelper.stringifyId(result, descriptor.getAlias(), context);
            String href = context.getBaseURI() + context.getVersion() + "/" + context.getName() + "/entity/" + descriptor.getAlias() + "/" + entityId;
            itemLinks.addItem(new LinkV2(ReservedWords.JPARS_REL_SELF, href));
            entity._persistence_setLinks(itemLinks);
            return entity;
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.internal.jpa.rs.metadata.model.LinkV2

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.