-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Requested fields on super resource type are now taken into account.
* Update DocumentMapperUtil.getRequestedFields to read requested fields on super type. * Add test case.
- Loading branch information
Gregory Fernandez
committed
Sep 7, 2022
1 parent
7164f37
commit 3466bf5
Showing
6 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
crnk-core/src/test/java/io/crnk/core/mock/models/SpecialTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.crnk.core.mock.models; | ||
|
||
import io.crnk.core.resource.annotations.JsonApiResource; | ||
|
||
@JsonApiResource(type = "specialTask", resourcePath = "superTasks") | ||
public class SpecialTask extends SuperTask { | ||
|
||
private boolean recurring; | ||
|
||
private String end; | ||
|
||
public boolean isRecurring() { | ||
return recurring; | ||
} | ||
|
||
public void setRecurring(final boolean recurring) { | ||
this.recurring = recurring; | ||
} | ||
|
||
public String getEnd() { | ||
return end; | ||
} | ||
|
||
public void setEnd(final String end) { | ||
this.end = end; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
crnk-core/src/test/java/io/crnk/core/mock/models/SuperTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.crnk.core.mock.models; | ||
|
||
import io.crnk.core.resource.annotations.JsonApiId; | ||
import io.crnk.core.resource.annotations.JsonApiResource; | ||
|
||
@JsonApiResource(type = "superTasks", subTypes = SpecialTask.class) | ||
public abstract class SuperTask { | ||
|
||
@JsonApiId | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private String category; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public SuperTask setId(Long id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(@SuppressWarnings("SameParameterValue") String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getCategory() { | ||
return category; | ||
} | ||
|
||
public void setCategory(final String category) { | ||
this.category = category; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
crnk-core/src/test/java/io/crnk/core/mock/repository/SuperTaskRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.crnk.core.mock.repository; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import io.crnk.core.mock.models.SpecialTask; | ||
import io.crnk.core.mock.models.SuperTask; | ||
import io.crnk.core.queryspec.QuerySpec; | ||
import io.crnk.core.repository.ReadOnlyResourceRepositoryBase; | ||
import io.crnk.core.resource.list.ResourceList; | ||
|
||
public class SuperTaskRepository extends ReadOnlyResourceRepositoryBase<SuperTask, Long> { | ||
|
||
private Set<SpecialTask> tasks = new HashSet<>(); | ||
|
||
private long nextId = 0; | ||
|
||
public SuperTaskRepository() { | ||
super(SuperTask.class); | ||
} | ||
|
||
@Override | ||
public ResourceList<SuperTask> findAll(final QuerySpec querySpec) { | ||
return null; | ||
} | ||
} |