diff --git a/README.md b/README.md index 000f492..506c891 100644 --- a/README.md +++ b/README.md @@ -1 +1,18 @@ -# commons-repository-mongodb \ No newline at end of file +# 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: + + + nl.agility.commons + commons-repository-mongodb + 1.0.0-SNAPSHOT + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0970b02 --- /dev/null +++ b/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + + nl.agility.maven + parent-pom + 1.0.0-SNAPSHOT + + + nl.agility.commons + commons-repository-mongodb + 1.0.0-${revision} + + Agility IT Services - Commons Repository MongoDB + The Agility IT Services' Commons Repository MongoDB + + + https://github.com/aduursma/commons-repository-mongodb + scm:git:git://github.com/aduursma/commons-repository-mongodb.git + scm:git:git@github.com:aduursma/commons-repository-mongodb.git + + + + SNAPSHOT + 2.1.0 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-test + test + + + com.github.fakemongo + fongo + ${fongo.version} + test + + + diff --git a/src/changes/changes.xml b/src/changes/changes.xml new file mode 100644 index 0000000..06f520b --- /dev/null +++ b/src/changes/changes.xml @@ -0,0 +1,16 @@ + + + + Release notes + + + + + + Added initial project setup. + + + + diff --git a/src/main/java/nl/agility/commons/repository/mongodb/ReadOnlyMongoDbRepository.java b/src/main/java/nl/agility/commons/repository/mongodb/ReadOnlyMongoDbRepository.java new file mode 100644 index 0000000..655b32a --- /dev/null +++ b/src/main/java/nl/agility/commons/repository/mongodb/ReadOnlyMongoDbRepository.java @@ -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 extends MongoRepository { + + @Override + @RestResource(exported = false) + List save(Iterable entites); + + @Override + @RestResource(exported = false) + S insert(S entity); + + @Override + @RestResource(exported = false) + List insert(Iterable entities); + + @Override + @RestResource(exported = false) + 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 entities); + + @Override + @RestResource(exported = false) + void deleteAll(); +}