-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first iteration of example updates - switched from QueryParams to QuerySpec - made use of QuerySpecResourceRepositoryBase for interface-based repos - Spring now has both interface and annotation-based repos - wildfly example switched to CDI-based service discover with katharsis-cdi - new Spring Config KatharsisConfigV3 with QuerySpec setup and ApplicationContext-based lookup of repositories and modules. More advanced use cases have to be added in a next iteration (katharsis-client/jpa/validation/...).
- Loading branch information
Remo
authored
Nov 15, 2016
1 parent
348949e
commit e5bf6f8
Showing
37 changed files
with
568 additions
and
562 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
In order to run this example do: | ||
* run the dropwizard application with the ```server``` parameter | ||
* The service will be available at: http://localhost:8080/projects |
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
37 changes: 37 additions & 0 deletions
37
...le-example/src/main/java/io/katharsis/example/dropwizard/simple/domain/model/Project.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,37 @@ | ||
package io.katharsis.example.dropwizard.simple.domain.model; | ||
|
||
import io.katharsis.resource.annotations.JsonApiId; | ||
import io.katharsis.resource.annotations.JsonApiResource; | ||
|
||
@JsonApiResource(type = "projects") | ||
public class Project { | ||
|
||
@JsonApiId | ||
private Long id; | ||
|
||
private String name; | ||
|
||
public Project() { | ||
} | ||
|
||
public Project(long id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...main/java/io/katharsis/example/dropwizard/simple/domain/repository/ProjectRepository.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,46 @@ | ||
package io.katharsis.example.dropwizard.simple.domain.repository; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import io.katharsis.example.dropwizard.simple.domain.model.Project; | ||
import io.katharsis.queryspec.QuerySpec; | ||
import io.katharsis.queryspec.QuerySpecResourceRepositoryBase; | ||
|
||
public class ProjectRepository extends QuerySpecResourceRepositoryBase<Project, Long> { | ||
|
||
private static final AtomicLong ID_GENERATOR = new AtomicLong(124); | ||
|
||
private Map<Long, Project> projects = new HashMap<>(); | ||
|
||
public ProjectRepository() { | ||
super(Project.class); | ||
List<String> interests = new ArrayList<>(); | ||
interests.add("coding"); | ||
interests.add("art"); | ||
save(new Project(123L, "Great Project")); | ||
} | ||
|
||
@Override | ||
public synchronized void delete(Long id) { | ||
projects.remove(id); | ||
} | ||
|
||
@Override | ||
public synchronized <S extends Project> S save(S project) { | ||
if (project.getId() == null) { | ||
project.setId(ID_GENERATOR.getAndIncrement()); | ||
} | ||
projects.put(project.getId(), project); | ||
return project; | ||
} | ||
|
||
@Override | ||
public synchronized List<Project> findAll(QuerySpec querySpec) { | ||
return querySpec.apply(projects.values()); | ||
} | ||
|
||
} |
29 changes: 0 additions & 29 deletions
29
...ple-example/src/main/java/io/katharsis/example/dropwizardSimple/domain/model/Project.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.