Skip to content

Commit

Permalink
Updated for seed 3.10+
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienlauer committed Aug 5, 2020
1 parent aa94580 commit 1bf5868
Show file tree
Hide file tree
Showing 62 changed files with 95 additions and 99 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 3.1.2 (2020-08-05)

* [chg] Updated for seed 3.10+

# Version 3.1.1 (2020-02-05)

* [fix] Fix `BaseMorphiaRepository.get(id)` always returning the first document from the collection (ignoring given id).
Expand Down
29 changes: 14 additions & 15 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -23,6 +23,11 @@
<property name="eachLine" value="true"/>
</module>

<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
Expand All @@ -37,10 +42,6 @@
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
Expand Down Expand Up @@ -205,24 +206,22 @@
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<!--<module name="SummaryJavadoc">-->
<!--<property name="forbiddenSummaryFragments"-->
<!--value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>-->
<!--</module>-->
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<module name="MissingJavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="minLineCount" value="2"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.addons.mongodb</groupId>
<artifactId>mongodb</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.1.2-SNAPSHOT</version>
</parent>

<artifactId>mongodb-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.seedstack.mongodb.internal;

import com.mongodb.MongoClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/org/seedstack/mongodb/MongoDbIT.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
# Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
4 changes: 2 additions & 2 deletions morphia/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.addons.mongodb</groupId>
<artifactId>mongodb</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.1.2-SNAPSHOT</version>
</parent>

<artifactId>mongodb-morphia</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.seedstack.mongodb.morphia;

import static com.google.common.base.Preconditions.checkArgument;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.seedstack.mongodb.morphia.internal;

import static org.seedstack.mongodb.morphia.internal.MorphiaUtils.createDatastoreAnnotation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -8,14 +8,10 @@
package org.seedstack.mongodb.morphia.internal;

import com.google.common.collect.Lists;
import dev.morphia.Morphia;
import io.nuun.kernel.api.plugin.InitState;
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.api.plugin.request.ClasspathScanRequest;
import java.util.Collection;
import java.util.HashSet;
import java.util.Collection;
import java.util.HashSet;
import dev.morphia.Morphia;
import org.seedstack.mongodb.morphia.MorphiaDatastore;
import org.seedstack.seed.Application;
import org.seedstack.seed.core.internal.AbstractSeedPlugin;
Expand All @@ -24,6 +20,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collection;
import java.util.HashSet;

/**
* This plugin manages the MongoDb Morphia object/document mapping library.
*/
Expand All @@ -45,7 +44,7 @@ public Collection<Class<?>> dependencies() {
@Override
public Collection<ClasspathScanRequest> classpathScanRequests() {
return classpathScanRequestBuilder()
.specification(MorphiaSpecifications.PERSISTED_CLASSES)
.predicate(MorphiaPredicates.PERSISTED_CLASSES)
.build();
}

Expand All @@ -58,8 +57,8 @@ public InitState initialize(InitContext initContext) {
morphia.getMapper().addInterceptor(new ValidatingEntityInterceptor());
}

Collection<Class<?>> morphiaScannedClasses = initContext.scannedTypesBySpecification()
.get(MorphiaSpecifications.PERSISTED_CLASSES);
Collection<Class<?>> morphiaScannedClasses = initContext.scannedTypesByPredicate()
.get(MorphiaPredicates.PERSISTED_CLASSES);
if (morphiaScannedClasses != null && !morphiaScannedClasses.isEmpty()) {
morphia.map(new HashSet<>(morphiaScannedClasses));
for (Class<?> morphiaClass : morphiaScannedClasses) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.seedstack.mongodb.morphia.internal;

import org.kametic.specifications.Specification;
import dev.morphia.annotations.Embedded;
import dev.morphia.annotations.Entity;
import org.seedstack.seed.core.internal.utils.SpecificationBuilder;

import java.lang.reflect.Modifier;
import java.util.function.Predicate;

import static org.seedstack.shed.reflect.AnnotationPredicates.elementAnnotatedWith;
import static org.seedstack.shed.reflect.ClassPredicates.classIsInterface;
import static org.seedstack.shed.reflect.ClassPredicates.classModifierIs;

class MorphiaSpecifications {
static Specification<Class<?>> PERSISTED_CLASSES = new SpecificationBuilder<>(classIsInterface().negate()
class MorphiaPredicates {
static Predicate<Class<?>> PERSISTED_CLASSES = classIsInterface().negate()
.and(classModifierIs(Modifier.ABSTRACT).negate())
.and(elementAnnotatedWith(Entity.class, false)
.or(elementAnnotatedWith(Embedded.class, false))
)).build();
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.seedstack.mongodb.morphia.internal;

import com.mongodb.DBObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2019, The SeedStack authors <http://seedstack.org>
* Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down

0 comments on commit 1bf5868

Please sign in to comment.