-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
# commons-repository-mongodb | ||
# Commons Repository MongoDB | ||
|
||
![badge-version](https://img.shields.io/badge/Version-v1.0.0-green.svg) | ||
|
||
## Introduction | ||
This Maven module contains Spring Data REST utility classes for working with MongoDB repositories. | ||
|
||
|
||
## Usage | ||
Include the following in the _dependencies_ section of the Maven POM of the Maven module you want | ||
to use the classes in: | ||
|
||
<dependency> | ||
<groupId>nl.agility.commons</groupId> | ||
<artifactId>commons-repository-mongodb</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</dependency> | ||
|
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,50 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>nl.agility.maven</groupId> | ||
<artifactId>parent-pom</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>nl.agility.commons</groupId> | ||
<artifactId>commons-repository-mongodb</artifactId> | ||
<version>1.0.0-${revision}</version> | ||
|
||
<name>Agility IT Services - Commons Repository MongoDB</name> | ||
<description>The Agility IT Services' Commons Repository MongoDB</description> | ||
|
||
<scm> | ||
<url>https://github.com/aduursma/commons-repository-mongodb</url> | ||
<connection>scm:git:git://github.com/aduursma/commons-repository-mongodb.git</connection> | ||
<developerConnection>scm:git:[email protected]:aduursma/commons-repository-mongodb.git</developerConnection> | ||
</scm> | ||
|
||
<properties> | ||
<revision>SNAPSHOT</revision> | ||
<fongo.version>2.1.0</fongo.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-mongodb</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-rest</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.fakemongo</groupId> | ||
<artifactId>fongo</artifactId> | ||
<version>${fongo.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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,16 @@ | ||
<document xmlns="http://maven.apache.org/changes/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> | ||
|
||
<properties> | ||
<title>Release notes</title> | ||
</properties> | ||
|
||
<body> | ||
<release version="1.0.0" description="Initial release"> | ||
<action type="add" dev="aduursma" date="25-12-2017"> | ||
Added initial project setup. | ||
</action> | ||
</release> | ||
</body> | ||
</document> |
44 changes: 44 additions & 0 deletions
44
src/main/java/nl/agility/commons/repository/mongodb/ReadOnlyMongoDbRepository.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,44 @@ | ||
package nl.agility.commons.repository.mongodb; | ||
|
||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
import org.springframework.data.repository.NoRepositoryBean; | ||
import org.springframework.data.rest.core.annotation.RestResource; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
@NoRepositoryBean | ||
public interface ReadOnlyMongoDbRepository<T, ID extends Serializable> extends MongoRepository<T, ID> { | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
<S extends T> List<S> save(Iterable<S> entites); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
<S extends T> S insert(S entity); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
<S extends T> List<S> insert(Iterable<S> entities); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
<S extends T> S save(S entity); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
void delete(ID id); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
void delete(T entity); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
void delete(Iterable<? extends T> entities); | ||
|
||
@Override | ||
@RestResource(exported = false) | ||
void deleteAll(); | ||
} |