Skip to content

Commit 04c432e

Browse files
author
Aaron Klish
committed
Fixed rebase errors
1 parent c3ac3da commit 04c432e

5 files changed

Lines changed: 20 additions & 163 deletions

File tree

elide-core/src/main/java/com/yahoo/elide/Elide.java

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,6 @@ protected Set<Class<?>> registerCustomSerdeScan() {
146146
return ClassScanner.getAnnotatedClasses(ElideTypeConverter.class);
147147
}
148148

149-
/**
150-
* Handle GET.
151-
*
152-
* @param path the path
153-
* @param queryParams the query params
154-
* @param opaqueUser the opaque user
155-
* @return Elide response object
156-
*/
157-
public ElideResponse get(String path, MultivaluedMap<String, String> queryParams, Object opaqueUser) {
158-
return get(null, path, queryParams, opaqueUser);
159-
}
160-
161149
/**
162150
* Handle GET.
163151
*
@@ -197,32 +185,6 @@ public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<Str
197185
});
198186
}
199187

200-
/**
201-
* Handle POST.
202-
*
203-
* @param path the path
204-
* @param jsonApiDocument the json api document
205-
* @param opaqueUser the opaque user
206-
* @return Elide response object
207-
*/
208-
public ElideResponse post(String path, String jsonApiDocument, Object opaqueUser) {
209-
return post(null, path, jsonApiDocument, null, opaqueUser);
210-
}
211-
212-
/**
213-
* Handle POST.
214-
*
215-
* @param path the path
216-
* @param jsonApiDocument the json api document
217-
* @param queryParams the query params
218-
* @param opaqueUser the opaque user
219-
* @return Elide response object
220-
*/
221-
public ElideResponse post(String path, String jsonApiDocument,
222-
MultivaluedMap<String, String> queryParams, Object opaqueUser) {
223-
return post(null, path, jsonApiDocument, queryParams, opaqueUser);
224-
}
225-
226188
/**
227189
* Handle POST.
228190
*
@@ -264,21 +226,6 @@ public ElideResponse post(String baseUrlEndPoint, String path, String jsonApiDoc
264226
});
265227
}
266228

267-
/**
268-
* Handle PATCH.
269-
*
270-
* @param contentType the content type
271-
* @param accept the accept
272-
* @param path the path
273-
* @param jsonApiDocument the json api document
274-
* @param opaqueUser the opaque user
275-
* @return Elide response object
276-
*/
277-
public ElideResponse patch(String contentType, String accept,
278-
String path, String jsonApiDocument, Object opaqueUser) {
279-
return patch(null, contentType, accept, path, jsonApiDocument, null, opaqueUser);
280-
}
281-
282229
/**
283230
* Handle PATCH.
284231
*
@@ -298,23 +245,6 @@ public ElideResponse patch(String baseUrlEndPoint, String contentType, String ac
298245
null, opaqueUser, apiVersion, UUID.randomUUID());
299246
}
300247

301-
/**
302-
* Handle PATCH.
303-
*
304-
* @param contentType the content type
305-
* @param accept the accept
306-
* @param path the path
307-
* @param jsonApiDocument the json api document
308-
* @param queryParams the query params
309-
* @param opaqueUser the opaque user
310-
* @return Elide response object
311-
*/
312-
public ElideResponse patch(String contentType, String accept,
313-
String path, String jsonApiDocument,
314-
MultivaluedMap<String, String> queryParams, Object opaqueUser) {
315-
return patch(null, contentType, accept, path, jsonApiDocument, queryParams, opaqueUser);
316-
}
317-
318248
/**
319249
* Handle PATCH.
320250
*
@@ -362,18 +292,6 @@ public ElideResponse patch(String baseUrlEndPoint, String contentType, String ac
362292
return handleRequest(false, opaqueUser, dataStore::beginTransaction, requestId, handler);
363293
}
364294

365-
/**
366-
* Handle DELETE.
367-
*
368-
* @param path the path
369-
* @param jsonApiDocument the json api document
370-
* @param opaqueUser the opaque user
371-
* @return Elide response object
372-
*/
373-
public ElideResponse delete(String path, String jsonApiDocument, Object opaqueUser) {
374-
return delete(null, path, jsonApiDocument, null, opaqueUser);
375-
}
376-
377295
/**
378296
* Handle DELETE.
379297
*
@@ -389,20 +307,6 @@ public ElideResponse delete(String baseUrlEndPoint, String path, String jsonApiD
389307
return delete(baseUrlEndPoint, path, jsonApiDocument, null, opaqueUser, apiVersion, UUID.randomUUID());
390308
}
391309

392-
/**
393-
* Handle DELETE.
394-
*
395-
* @param path the path
396-
* @param jsonApiDocument the json api document
397-
* @param queryParams the query params
398-
* @param opaqueUser the opaque user
399-
* @return Elide response object
400-
*/
401-
public ElideResponse delete(String path, String jsonApiDocument,
402-
MultivaluedMap<String, String> queryParams, Object opaqueUser) {
403-
return delete(null, path, jsonApiDocument, queryParams, opaqueUser);
404-
}
405-
406310
/**
407311
* Handle DELETE.
408312
*

elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,6 @@ public class RequestScope implements com.yahoo.elide.security.RequestScope {
7979
/* Used to filter across heterogeneous types during the first load */
8080
private FilterExpression globalFilterExpression;
8181

82-
/**
83-
* Create a new RequestScope with specified update status code.
84-
*
85-
* @param path the URL path
86-
* @param jsonApiDocument the document for this request
87-
* @param transaction the transaction for this request
88-
* @param user the user making this request
89-
* @param queryParams the query parameters
90-
* @param elideSettings Elide settings object
91-
*/
92-
public RequestScope(String path,
93-
JsonApiDocument jsonApiDocument,
94-
DataStoreTransaction transaction,
95-
User user,
96-
MultivaluedMap<String, String> queryParams,
97-
ElideSettings elideSettings) {
98-
this(null, path, jsonApiDocument, transaction, user, queryParams, elideSettings);
99-
}
10082
/**
10183
* Create a new RequestScope with specified update status code.
10284
*

elide-core/src/test/java/com/yahoo/elide/core/datastore/inmemory/InMemoryStoreTransactionTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,5 @@ public void testInMemoryDataStore() {
551551
assertTrue(tos.contains("Table class example.StringId contents"));
552552
assertTrue(tos.contains("Table class example.UpdateAndCreate contents"));
553553
assertTrue(tos.contains("Table class example.User contents"));
554-
assertTrue(tos.contains("Table class example.packageshareable.ContainerWithPackageShare contents"));
555-
assertTrue(tos.contains("Table class example.packageshareable.ShareableWithPackageShare contents"));
556-
assertTrue(tos.contains("Table class example.packageshareable.UnshareableWithEntityUnshare contents"));
557554
}
558555
}

elide-datastore/elide-datastore-hibernate/src/main/java/com/yahoo/elide/core/hibernate/hql/AbstractHQLQueryBuilder.java

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public abstract class AbstractHQLQueryBuilder {
4444
protected static final String FROM = " FROM ";
4545
protected static final String JOIN = " JOIN ";
4646
protected static final String LEFT = " LEFT";
47-
protected static final String FETCH = "FETCH ";
47+
protected static final String FETCH = " FETCH ";
4848
protected static final String SELECT = "SELECT ";
4949
protected static final String AS = " AS ";
5050
protected static final String DISTINCT = "DISTINCT ";
@@ -53,7 +53,6 @@ public abstract class AbstractHQLQueryBuilder {
5353
protected static final boolean USE_ALIAS = true;
5454
protected static final boolean NO_ALIAS = false;
5555
protected Set<String> alreadyJoined = new HashSet<>();
56-
protected Set<String> alreadyJoinedAliases = new HashSet<>();
5756

5857
/**
5958
* Represents a relationship between two entities.
@@ -170,8 +169,9 @@ protected void addPaginationToQuery(Query query) {
170169
* @param skipFetches Don't fetch join
171170
* @return A HQL string representing the join
172171
*/
173-
private String joinClauseFromPath(Path path, boolean skipFetches) {
172+
private String extractJoinClause(Path path, boolean skipFetches) {
174173
StringBuilder joinClause = new StringBuilder();
174+
175175
String previousAlias = null;
176176

177177
for (Path.PathElement pathElement : path.getPathElements()) {
@@ -203,14 +203,14 @@ private String joinClauseFromPath(Path path, boolean skipFetches) {
203203
//This is a to-One relationship belonging to the collection being retrieved.
204204
if (!skipFetches && entityProjection.getIncludedRelationsName().contains(fieldName) && type.isToOne()
205205
&& !type.isComputed() && previousAlias == null) {
206-
fetch = FETCH;
206+
fetch = "FETCH ";
207+
207208
}
208209
String joinFragment = LEFT + JOIN + fetch + joinKey + SPACE + alias + SPACE;
209210

210211
if (!alreadyJoined.contains(joinKey)) {
211212
joinClause.append(joinFragment);
212213
alreadyJoined.add(joinKey);
213-
alreadyJoinedAliases.add(alias);
214214
}
215215

216216
previousAlias = alias;
@@ -243,17 +243,12 @@ protected String extractToOneMergeJoins(Class<?> entityClass, String alias,
243243
continue;
244244
}
245245
String joinKey = alias + PERIOD + relationshipName;
246-
String relationshipAlias = alias + UNDERSCORE + relationshipName;
247246

248247
if (alreadyJoined.contains(joinKey)) {
249248
continue;
250249
}
251250

252-
alreadyJoined.add(joinKey);
253-
alreadyJoinedAliases.add(relationshipAlias);
254-
joinString.append(LEFT);
255-
joinString.append(JOIN);
256-
joinString.append(FETCH);
251+
joinString.append(" LEFT JOIN FETCH ");
257252
joinString.append(joinKey);
258253
joinString.append(SPACE);
259254
alreadyJoined.add(joinKey);
@@ -262,26 +257,6 @@ protected String extractToOneMergeJoins(Class<?> entityClass, String alias,
262257
return joinString.toString();
263258
}
264259

265-
/**
266-
* Builds a explicit LEFT JOIN clauses instead of implicit sorting joins.
267-
* @param sorting The sorting object passed from the client
268-
* @param sortClass The class to sort.
269-
* @return The JOIN clause that can be added to the FROM clause.
270-
*/
271-
protected String explicitSortJoins(final Optional<Sorting> sorting, Class<?> sortClass) {
272-
StringBuilder joinClause = new StringBuilder();
273-
if (sorting.isPresent() && !sorting.get().isDefaultInstance()) {
274-
final Map<Path, Sorting.SortOrder> validSortingRules = sorting.get().getValidSortingRules(
275-
sortClass, dictionary
276-
);
277-
for (Map.Entry<Path, Sorting.SortOrder> entry : validSortingRules.entrySet()) {
278-
Path path = entry.getKey();
279-
joinClause.append(joinClauseFromPath(path, true));
280-
}
281-
}
282-
return joinClause.toString();
283-
}
284-
285260
/**
286261
* Returns a sorting object into a HQL ORDER BY string.
287262
* @param sorting The sorting object passed from the client

elide-datastore/elide-datastore-hibernate/src/main/java/com/yahoo/elide/core/hibernate/hql/RootCollectionFetchQueryBuilder.java

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,26 @@ public Query build() {
6060

6161
Boolean sortOverRelationship = entityProjection.getSorting() != null
6262
&& entityProjection.getSorting().getSortingPaths().keySet()
63-
.stream().anyMatch(path -> path.getPathElements().size() > 1);
63+
.stream().anyMatch(path -> path.getPathElements().size() > 1);
6464
if (requiresDistinct && sortOverRelationship) {
6565
//SQL does not support distinct and order by on columns which are not selected
6666
throw new InvalidValueException("Combination of pagination, sorting over relationship and"
67-
+ " filtering over toMany relationships unsupported");
67+
+ " filtering over toMany relationships unsupported");
6868
}
6969
query = session.createQuery(
7070
SELECT
71-
+ (requiresDistinct ? DISTINCT : "")
72-
+ entityAlias
73-
+ FROM
74-
+ entityName
75-
+ AS
76-
+ entityAlias
77-
+ SPACE
78-
+ joinClause
79-
+ SPACE
80-
+ filterClause
81-
+ SPACE
82-
+ getSortClause(entityProjection.getSorting())
71+
+ (requiresDistinct ? DISTINCT : "")
72+
+ entityAlias
73+
+ FROM
74+
+ entityName
75+
+ AS
76+
+ entityAlias
77+
+ SPACE
78+
+ joinClause
79+
+ SPACE
80+
+ filterClause
81+
+ SPACE
82+
+ getSortClause(entityProjection.getSorting())
8383
);
8484

8585
//Fill in the query parameters
@@ -94,7 +94,6 @@ public Query build() {
9494
+ SPACE
9595
+ getJoinClauseFromSort(entityProjection.getSorting())
9696
+ extractToOneMergeJoins(entityClass, entityAlias)
97-
+ explicitSortJoins(sorting, entityClass)
9897
+ SPACE
9998
+ getSortClause(entityProjection.getSorting()));
10099
}

0 commit comments

Comments
 (0)