Java Code Examples for org.springframework.hateoas.LinkBuilder

The following examples show how to use org.springframework.hateoas.LinkBuilder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: service-block-samples   Source File: AccountController.java    License: Apache License 2.0 5 votes vote down vote up
private LinkBuilder linkBuilder(String name, Long id) {
    Method method;

    try {
        method = AccountController.class.getMethod(name, Long.class);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    return linkTo(AccountController.class, method, id);
}
 
Example 2
Source Project: service-block-samples   Source File: CommitController.java    License: Apache License 2.0 5 votes vote down vote up
private LinkBuilder linkBuilder(String name, Long id) {
    Method method;

    try {
        method = ProjectController.class.getMethod(name, Long.class);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    return linkTo(ProjectController.class, method, id);
}
 
Example 3
Source Project: service-block-samples   Source File: ProjectController.java    License: Apache License 2.0 5 votes vote down vote up
private LinkBuilder linkBuilder(String name, Long id) {
    Method method;

    try {
        method = ProjectController.class.getMethod(name, Long.class);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    return linkTo(ProjectController.class, method, id);
}
 
Example 4
private Link shortcutLink(URI baseUri, ContentStoreInfo store, Object id, String linkRel) {
	LinkBuilder builder = BasicLinkBuilder.linkToCurrentMapping();

	if (baseUri != null) {
		builder = builder.slash(baseUri);
	}

	return builder.slash(ContentStoreUtils.storePath(store))
			.slash(id)
			.withRel(linkRel);
}
 
Example 5
private Link fullyQualifiedLink(URI baseUri, ContentStoreInfo store, Object id, String fieldName) {
	LinkBuilder builder = BasicLinkBuilder.linkToCurrentMapping();

	if (baseUri != null) {
		builder = builder.slash(baseUri);
	}

	String property = StringUtils.uncapitalize(ContentStoreUtils.propertyName(fieldName));
	return builder.slash(ContentStoreUtils.storePath(store))
			.slash(id)
			.slash(property)
			.withRel(property);
}
 
Example 6
private Link propertyLink(ResourceMetadata md, URI baseUri, Object id, String property, String contentId) {
	LinkBuilder builder = new RepositoryLinkBuilder(md, new BaseUri(baseUri));

	builder = builder.slash(id).slash(property);

	if (contentId != null) {
		builder = builder.slash(contentId);
	}

	return builder.withRel(property);
}
 
Example 7
@Override
public LinkBuilder linkFor(Class<?> type) {
	ResourceMetadata metadata = resourceMappings.getMappingFor(type);
	return new DemoRepositoryLinkBuilder(metadata, config.getBaseUri());
}