Example usage for org.springframework.hateoas Link Link

List of usage examples for org.springframework.hateoas Link Link

Introduction

In this page you can find the example usage for org.springframework.hateoas Link Link.

Prototype

public Link(UriTemplate template, LinkRelation rel) 

Source Link

Document

Creates a new Link from the given UriTemplate and rel.

Usage

From source file:org.moserp.product.repository.ProductUtil.java

public Link getLink(Product product, String rel) {
    return new Link(getUri(product), rel);
}

From source file:edu.pitt.dbmi.ccd.anno.user.UserLinks.java

/**
 * Get link to groups to which user belongs
 *//*from   w w  w .ja v a 2 s. c om*/
public Link groups(UserAccount account) {

    String template = toTemplate(entityLinks
            .linkForSingleResource(UserResource.class,
                    base64Encoder.encodeToString(account.getAccountId().getBytes()))
            .slash(REL_GROUPS).toString(), MOD, REQUESTS, PAGEABLE);
    return new Link(template, REL_GROUPS);
}

From source file:edu.pitt.dbmi.ccd.anno.vocabulary.VocabularyLinks.java

/**
 * Get link to vocbulary attributes//from   w ww. j  av a2s.c  o  m
 *
 * @param vocab vocabulary
 */
public Link attributes(Vocabulary vocab) {
    String template = toTemplate(entityLinks.linkForSingleResource(VocabularyResource.class, vocab.getId())
            .slash(REL_ATTRIBUTES).toString(), LEVEL, NAME, REQUIREMENT, PAGEABLE);
    return new Link(template, REL_ATTRIBUTES);
}

From source file:edu.pitt.dbmi.ccd.anno.user.UserLinks.java

/**
 * Get link to user search page//w  w w  .  j  a v a 2s . co m
 *
 * @return link to search
 */
public Link search() {
    String template = toTemplate(entityLinks.linkFor(UserResource.class).slash(SEARCH).toString(), EMAIL);
    return new Link(template, REL_SEARCH);
}

From source file:edu.pitt.dbmi.ccd.anno.user.UserLinks.java

/**
 * Get link to user's annotations/*ww  w .  j a  va  2 s .co  m*/
 *
 * @return link to annotations
 */
public Link annotations(UserAccount user) {
    String template = linkToCollection(entityLinks.linkFor(AnnotationResource.class).toString(),
            AnnotationLinks.USER, user.getId().toString());
    return new Link(template, REL_ANNOS);
}

From source file:edu.pitt.dbmi.ccd.anno.vocabulary.VocabularyLinks.java

/**
 * Get link to vocabulary search page//from w  w  w.ja  v  a  2 s .  com
 *
 * @return link to search
 */
public Link search() {
    String template = toTemplate(entityLinks.linkFor(VocabularyResource.class).slash(SEARCH).toString(), QUERY,
            NOT, PAGEABLE);
    return new Link(template, REL_SEARCH);
}

From source file:edu.pitt.dbmi.ccd.anno.annotation.AnnotationLinks.java

/**
 * Get link to annotation search page//  w  w w  .j a  va  2s. c  o m
 *
 * @return link to search
 */
public Link search() {
    String template = toTemplate(entityLinks.linkFor(AnnotationResource.class).slash(SEARCH).toString(), USER,
            GROUP, UPLOAD, VOCAB, LEVEL, NAME, REQUIREMENT, REDACTED, QUERY, NOT, PAGEABLE);
    return new Link(template, REL_SEARCH);
}

From source file:edu.pitt.dbmi.ccd.anno.vocabulary.attribute.AttributeLinks.java

/**
 * Get link to attribute search page/*from   w ww.jav a2s. c  om*/
 *
 * @return link to search
 */
public Link search() {
    String template = toTemplate(entityLinks.linkFor(AttributeResource.class).slash(SEARCH).toString(), VOCAB,
            LEVEL_CONTAINS, NAME_CONTAINS, REQUIREMENT_CONTAINS, PAGEABLE);
    return new Link(template, REL_SEARCH);
}

From source file:edu.pitt.dbmi.ccd.anno.user.UserLinks.java

/**
 * Get link to user's uploads//from   w  w w  . j  av  a2s  .  com
 *
 * @return link to uploads
 */
public Link uploads(UserAccount user) {
    String template = linkToCollection(entityLinks.linkFor(AnnotationTargetResource.class).toString(),
            AnnotationTargetLinks.USER, user.getId().toString());
    return new Link(template, REL_UPLOADS);
}

From source file:edu.pitt.dbmi.ccd.anno.vocabulary.VocabularyLinks.java

/**
 * Get link to vocab's annotations// w  ww. j  a v  a 2 s.  c  o  m
 *
 * @return link to annotations
 */
public Link annotations(Vocabulary vocabulary) {
    String template = linkToCollection(entityLinks.linkFor(AnnotationResource.class).toString(),
            AnnotationLinks.VOCAB, vocabulary.getId().toString());
    return new Link(template, REL_ANNOS);
}