forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
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
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...ests/mongodb-panache/src/main/java/io/quarkus/it/mongodb/panache/bugs/Bug16399Entity.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,51 @@ | ||
package io.quarkus.it.mongodb.panache.bugs; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.bson.codecs.pojo.annotations.BsonId; | ||
import org.bson.codecs.pojo.annotations.BsonIgnore; | ||
import org.bson.codecs.pojo.annotations.BsonProperty; | ||
|
||
import io.quarkus.mongodb.panache.PanacheMongoEntityBase; | ||
|
||
//@MongoEntity(collection = "Bug16399") | ||
public class Bug16399Entity extends PanacheMongoEntityBase { | ||
@BsonId | ||
@BsonProperty("_id") | ||
// @Schema(example = "516448966") | ||
public Long id = -1L; | ||
|
||
@BsonProperty("last_activity") | ||
public LocalDateTime lastActivity = LocalDateTime.now(); | ||
|
||
@BsonIgnore | ||
//TROUBLE METHOD CAUSES ERROR | ||
public Bug16399Entity setLastActivity(final LocalDateTime... lastActivities) { | ||
setLastActivity(Arrays.stream(lastActivities).max(LocalDateTime::compareTo).orElse(getTimeLastYear())); | ||
return this; | ||
} | ||
|
||
private LocalDateTime getTimeLastYear() { | ||
return null; | ||
} | ||
|
||
public LocalDateTime getLastActivity() { | ||
return lastActivity; | ||
} | ||
|
||
public Bug16399Entity setLastActivity(final LocalDateTime lastActivity) { | ||
this.lastActivity = lastActivity; | ||
return this; | ||
} | ||
|
||
public static List<Bug16399Entity> dbFindById(final Iterable<?> entities) { | ||
if (entities.iterator().hasNext()) { | ||
return find("_id in ?1", entities).list(); | ||
} | ||
return Collections.emptyList(); | ||
} | ||
|
||
} |
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