Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
262a2a1
DATAREST-934 - Updated changelog.
odrotbohm Nov 23, 2016
9d57953
DATAREST-941 - Modify existing browser.html
gregturn Nov 30, 2016
aea766b
DATAREST-941 - Polishing.
odrotbohm Nov 30, 2016
080d1b0
DATAREST-960 - Fixed typos in reference documentation.
kryger Nov 14, 2016
b66c827
DATAREST-925 - Invoke ResourceProcessors for ProjectionResources.
candrews Nov 3, 2016
bb26b39
DATAREST-925 - Polishing.
odrotbohm Dec 2, 2016
76ddc30
DATAREST-951 - Fixed example in sample in reference documentation.
kdombeck Dec 5, 2016
30d1733
DATAREST-937 - Transient properties in JSON are now included in merge.
candrews Nov 11, 2016
a928dc0
DATAREST-937 - Polishing.
odrotbohm Dec 6, 2016
7880bef
DATAREST-910 - Adopt interfaces for Pageable and Sort method argument…
mp911de Sep 27, 2016
357bb7a
DATAREST-910 - Support nested Sort properties.
mp911de Sep 28, 2016
9fbdd03
DATAREST-910 - Polishing.
odrotbohm Dec 6, 2016
b17c8bc
DATAREST-938 - Update nested entities instead of replacing them with …
candrews Nov 11, 2016
69fcd39
DATAREST-938 - Polishing.
odrotbohm Dec 7, 2016
a1c538c
DATAREST-953 - Added test case to verify this is fixed.
odrotbohm Dec 7, 2016
59c7bae
DATAREST-956 - Fixed handling of collection element addition and remo…
Dec 7, 2016
29345d3
DATAREST-956 - Polishing.
odrotbohm Dec 8, 2016
a254e1a
DATAREST-957 - Polish most critical Sonar warnings.
odrotbohm Dec 8, 2016
f4e4dcb
DATAREST-862 - Disable manifest lookup after plugin changes in build …
odrotbohm Dec 8, 2016
cea8c12
DATAREST-862 - Fix Querydsl APT setup after compiler plugin update.
odrotbohm Dec 8, 2016
50c2197
DATAREST-835 - Search resources returning a single resource now get a…
odrotbohm Jun 10, 2016
5269a7d
DATAREST-793 - RepositoryRestConfiguration's setters return this cons…
odrotbohm Dec 12, 2016
a3873a9
DATAREST-959 - Fix adding elements to empty array in DomainObjectReader.
mzcu Dec 12, 2016
7a47365
DATAREST-959 - Polishing.
odrotbohm Dec 13, 2016
839682d
DATAREST-964 - Removed deprecated configuration methods in Repository…
odrotbohm Dec 20, 2016
4eeef2f
DATAREST-899 - Prefer user registered modules over default ones.
odrotbohm Dec 20, 2016
9bd5cc8
DATAREST-862 - Updated changelog.
odrotbohm Dec 21, 2016
729e647
DATAREST-862 - Prepare 2.6 RC1 (Ingalls).
odrotbohm Dec 21, 2016
d7da7e1
DATAREST-862 - Release version 2.6 RC1 (Ingalls).
odrotbohm Dec 21, 2016
187b345
DATAREST-862 - Prepare next development iteration.
odrotbohm Dec 21, 2016
c5cbb25
DATAREST-862 - After release cleanups.
odrotbohm Dec 21, 2016
130582a
DATAREST-932 - Updated changelog.
odrotbohm Dec 21, 2016
a3cb7d1
DATAREST-980 HAL browser not working behind zuul with csrf protection
javiersvg Jan 8, 2017
400c644
DATAREST-980 - set my name as contributor
javiersvg Jan 14, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<hibernate.version>4.3.10.Final</hibernate.version>
<jsonpath>1.1.0</jsonpath>
<bundlor.enabled>false</bundlor.enabled>
<manifest.file/>
</properties>

<developers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
*/
package org.springframework.data.rest.core.config;

import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Value;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -118,7 +123,7 @@ public ProjectionDefinitionConfiguration addProjection(Class<?> projectionType,
Assert.notEmpty(sourceTypes, "Source types must not be null!");

for (Class<?> sourceType : sourceTypes) {
this.projectionDefinitions.add(new ProjectionDefinition(sourceType, projectionType, name));
this.projectionDefinitions.add(ProjectionDefinition.of(sourceType, projectionType, name));
}

return this;
Expand Down Expand Up @@ -189,10 +194,12 @@ private static boolean isSubTypeOf(Class<?> left, Class<?> right) {
*
* @author Oliver Gierke
*/
@Value
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
static final class ProjectionDefinition {

private final Class<?> sourceType, targetType;
private final String name;
private final @NonNull Class<?> sourceType, targetType;
private final @NonNull String name;

/**
* Creates a new {@link ProjectionDefinitionKey} for the given source type and name;
Expand All @@ -201,47 +208,11 @@ static final class ProjectionDefinition {
* @param targetType must not be {@literal null}.
* @param name must not be {@literal null} or empty.
*/
public ProjectionDefinition(Class<?> sourceType, Class<?> targetType, String name) {
static ProjectionDefinition of(Class<?> sourceType, Class<?> targetType, String name) {

Assert.notNull(sourceType, "Source type must not be null!");
Assert.notNull(targetType, "Target type must not be null!");
Assert.hasText(name, "Name must not be null or empty!");

this.sourceType = sourceType;
this.targetType = targetType;
this.name = name;
}

/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {

if (!(obj instanceof ProjectionDefinition)) {
return false;
}

ProjectionDefinition that = (ProjectionDefinition) obj;
return this.name.equals(that.name) && this.sourceType.equals(that.sourceType)
&& this.sourceType.equals(that.sourceType);
}

/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {

int result = 31;

result += name.hashCode();
result += sourceType.hashCode();
result += targetType.hashCode();

return result;
return new ProjectionDefinition(sourceType, targetType, name);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ public URI getBasePath() {
*
* @param basePath the basePath to set
*/
public void setBasePath(String basePath) {
public RepositoryRestConfiguration setBasePath(String basePath) {

Assert.isTrue(!basePath.startsWith("http"), "Use a path not a URI");
basePath = StringUtils.trimTrailingCharacter(basePath, '/');
this.basePath = URI.create(basePath.startsWith("/") ? basePath : "/".concat(basePath));

Assert.isTrue(!this.basePath.isAbsolute(), "Absolute URIs are not supported as base path!");

return this;
}

/**
Expand Down Expand Up @@ -504,8 +506,11 @@ public MetadataConfiguration getMetadataConfiguration() {
* @param enableEnumTranslation
* @see #getEnumTranslationConfiguration()
*/
public void setEnableEnumTranslation(boolean enableEnumTranslation) {
public RepositoryRestConfiguration setEnableEnumTranslation(boolean enableEnumTranslation) {

this.enableEnumTranslation = enableEnumTranslation;

return this;
}

/**
Expand Down Expand Up @@ -547,9 +552,13 @@ public RepositoryDetectionStrategy getRepositoryDetectionStrategy() {
* @param repositoryDetectionStrategy can be {@literal null}.
* @since 2.5
*/
public void setRepositoryDetectionStrategy(RepositoryDetectionStrategy repositoryDetectionStrategy) {
public RepositoryRestConfiguration setRepositoryDetectionStrategy(
RepositoryDetectionStrategy repositoryDetectionStrategy) {

this.repositoryDetectionStrategy = repositoryDetectionStrategy == null ? RepositoryDetectionStrategies.DEFAULT
: repositoryDetectionStrategy;

return this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.rest.core.util;

/**
* Mimics Java 8's Supplier interface to allow deferring a computation.
*
* @author Oliver Gierke
* @since 2.6
* @soundtrack KRS-One - Sound Of Da Police (Return Of The Boom Bap)
*/
public interface Supplier<T> {

T get();
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public void defaultsNameToSimpleClassNameIfNotAnnotated() {
@Test
public void definitionEquals() {

ProjectionDefinition objectName = new ProjectionDefinition(Object.class, Object.class, "name");
ProjectionDefinition sameObjectName = new ProjectionDefinition(Object.class, Object.class, "name");
ProjectionDefinition stringName = new ProjectionDefinition(String.class, Object.class, "name");
ProjectionDefinition objectOtherNameKey = new ProjectionDefinition(Object.class, Object.class, "otherName");
ProjectionDefinition objectName = ProjectionDefinition.of(Object.class, Object.class, "name");
ProjectionDefinition sameObjectName = ProjectionDefinition.of(Object.class, Object.class, "name");
ProjectionDefinition stringName = ProjectionDefinition.of(String.class, Object.class, "name");
ProjectionDefinition objectOtherNameKey = ProjectionDefinition.of(Object.class, Object.class, "otherName");

assertThat(objectName, is(objectName));
assertThat(objectName, is(sameObjectName));
Expand Down
47 changes: 47 additions & 0 deletions spring-data-rest-hal-browser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,53 @@
<copy todir="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/vendor/js">
<fileset dir="${project.build.directory}/json-editor/META-INF/resources/webjars/json-editor/${json-editor.version}" />
</copy>
<copy file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/browser.html"
tofile="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/index.html" />
<replace file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/index.html">
<replacefilter>
<replacetoken><![CDATA[</body>]]></replacetoken>
<replacevalue><![CDATA[
<script id="dynamic-request-template" type="text/template">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Create/Update</h3>
</div>

<form class="non-safe" action="<%= href %>">
<div class="modal-body" style="padding-top: 0px">
<div id="jsoneditor"></div>

<div class="well well-small" style="padding-bottom: 0px;">
<div class="container-fluid">
<div class="row-fluid">
<div class="control-group">
<label class="control-label" style="display: inline-block; font-weight: bold;">Action:</label>
<input name="method" type="text" class="method controls" style="width: 98%" value="POST" />
<input name="url" type="text" class="url controls" style="width: 98%" value="<%= href %>" />
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Make Request</button>
</div>
</form>
</script>

<script src="vendor/js/jsoneditor.js"></script>
<script src="js/CustomPostForm.js"></script>

</body>]]>
</replacevalue>
</replacefilter>
</replace>
<replace file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/index.html">
<replacefilter>
<replacetoken>The HAL Browser</replacetoken>
<replacevalue>The HAL Browser (for Spring Data REST)</replacevalue>
</replacefilter>
</replace>
<delete file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/browser.html" />
</target>
</configuration>
Expand Down
Loading