org.springframework.data.rest.webmvc.BaseUri Java Examples

The following examples show how to use org.springframework.data.rest.webmvc.BaseUri. 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: 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 #2
Source File: ValuePropertyFactory.java    From moserp with Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ValueListKey valueListValue = getAnnotation(context, ValueListKey.class);
    String valueListKey = valueListValue.value();
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource("valueLists") + "/valueLists");
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.pathSegment(valueListKey).pathSegment("values").build().toUriString();
}
 
Example #3
Source File: ResourceAssociationPropertyFactory.java    From moserp with Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ResourceAssociation resourceAssociation = getAnnotation(context, ResourceAssociation.class);
    String resourceName = resourceAssociation.value();

    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource(resourceName));
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.path(resourceName).build().toUriString();
}
 
Example #4
Source File: ValuePropertyJsonSchemaFactory.java    From moserp with Apache License 2.0 5 votes vote down vote up
private String calculateValueListUri(PropertyFactoryContext context) {
    ValueListKey valueListValue = getAnnotation(context, ValueListKey.class);
    String valueListKey = valueListValue.value();
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource("valueLists") + "/valueLists");
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.pathSegment(valueListKey).pathSegment("values").build().toUriString();
}
 
Example #5
Source File: ApplicationStructureController.java    From moserp with Apache License 2.0 4 votes vote down vote up
private String getRootPath() {
    BaseUri baseUri = new BaseUri(configuration.getBaseUri());
    return baseUri.getUriComponentsBuilder().path(BASE_PATH).build().toString();
}
 
Example #6
Source File: AssociationPropertyFactory.java    From moserp with Apache License 2.0 4 votes vote down vote up
private String calculateUri(PropertyFactoryContext context) {
    ResourceMetadata mapping = mappings.getMetadataFor(context.getPersistentProperty().getType());
    final BaseUri baseUri = new BaseUri("http://" + moduleRegistry.getModuleForResource(mapping.getRel()));
    UriComponentsBuilder builder = baseUri.getUriComponentsBuilder();
    return builder.path(mapping.getPath().toString()).build().toUriString();
}