@@ -76,47 +76,34 @@ public T findOneByAttributes(final String... attributes) {
7676
7777 // find - all
7878
79- protected HttpEntity <Void > findRequestEntity () {
80- return new HttpEntity <Void >(createGetHeaders ());
81- }
82-
8379 @ Override
8480 public final List <T > findAll () {
8581 final ResponseEntity <List > findAllResponse = restTemplate .exchange (getURI (), HttpMethod .GET , findRequestEntity (), List .class );
8682 return findAllResponse .getBody ();
8783 }
8884
85+ @ Override
86+ public final List <T > findAllPaginatedAndSorted (final int page , final int size , final String sortBy , final String sortOrder ) {
87+ throw new UnsupportedOperationException ();
88+ }
89+
8990 @ Override
9091 public final List <T > findAllSorted (final String sortBy , final String sortOrder ) {
9192 final ResponseEntity <List > findAllResponse = restTemplate .exchange (getURI () + QueryConstants .Q_SORT_BY + sortBy , HttpMethod .GET , findRequestEntity (), List .class );
9293 return findAllResponse .getBody ();
9394 }
9495
9596 @ Override
96- public List <T > findAllPaginated (final int page , final int size ) {
97+ public final List <T > findAllPaginated (final int page , final int size ) {
9798 throw new UnsupportedOperationException ();
9899 }
99100
100- public final ResponseEntity <List > findAllAsResponse () {
101- return restTemplate .exchange (getURI (), HttpMethod .GET , findRequestEntity (), List .class );
102- }
103-
104101 @ Override
105102 public final List <T > findAllByAttributes (final String ... attributes ) {
106103 final List <T > resourcesByAttributes = findAllByURI (getURI () + QueryConstants .QUERY_PREFIX + constructURI (attributes ));
107104 return resourcesByAttributes ;
108105 }
109106
110- public final List <T > findAllByURI (final String uri ) {
111- final ResponseEntity <List > response = restTemplate .exchange (uri , HttpMethod .GET , findRequestEntity (), List .class );
112- return response .getBody ();
113- }
114-
115- public final List <T > findExperimental (final String uri ) {
116- final ResponseEntity <List > response = restTemplate .exchange (uri , HttpMethod .GET , findRequestEntity (), List .class );
117- return response .getBody ();
118- }
119-
120107 // create
121108
122109 @ Override
@@ -178,6 +165,11 @@ public long count() {
178165
179166 // util
180167
168+ final List <T > findAllByURI (final String uri ) {
169+ final ResponseEntity <List > response = restTemplate .exchange (uri , HttpMethod .GET , findRequestEntity (), List .class );
170+ return response .getBody ();
171+ }
172+
181173 protected HttpHeaders createGetHeaders () {
182174 final HttpHeaders headers = new HttpHeaders () {
183175 {
@@ -196,7 +188,7 @@ protected final HttpHeaders createContentTypeHeaders() {
196188 return headers ;
197189 }
198190
199- static final String constructURI (final String ... attributes ) {
191+ protected static String constructURI (final String ... attributes ) {
200192 Preconditions .checkNotNull (attributes );
201193 Preconditions .checkArgument (attributes .length > 0 );
202194 Preconditions .checkArgument (attributes .length % 2 == 0 );
@@ -211,6 +203,10 @@ static final String constructURI(final String... attributes) {
211203 return query .replaceAll ("&" , "," );
212204 }
213205
206+ protected HttpEntity <Void > findRequestEntity () {
207+ return new HttpEntity <Void >(createGetHeaders ());
208+ }
209+
214210 // template method
215211
216212 public abstract String getURI ();
0 commit comments