org.springframework.hateoas.LinkBuilder Java Examples

The following examples show how to use org.springframework.hateoas.LinkBuilder. 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 File: AccountController.java    From service-block-samples with 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 File: CommitController.java    From service-block-samples with 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 File: ProjectController.java    From service-block-samples with 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
Source File: ContentLinksResourceProcessor.java    From spring-content with Apache License 2.0 5 votes vote down vote up
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
Source File: ContentLinksResourceProcessor.java    From spring-content with Apache License 2.0 5 votes vote down vote up
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
Source File: ContentLinksResourceProcessor.java    From spring-content with Apache License 2.0 5 votes vote down vote up
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
Source File: DemoRepositoryEntityLinks.java    From spring-data-dynamodb-demo with Apache License 2.0 4 votes vote down vote up
@Override
public LinkBuilder linkFor(Class<?> type) {
	ResourceMetadata metadata = resourceMappings.getMappingFor(type);
	return new DemoRepositoryLinkBuilder(metadata, config.getBaseUri());
}