parent
13516fe0cc
commit
173e19dbf9
@ -0,0 +1,48 @@
|
||||
package fr.uca.iut.codecs;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import fr.uca.iut.entities.GenericEntity;
|
||||
import org.bson.*;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.CollectibleCodec;
|
||||
import org.bson.codecs.DecoderContext;
|
||||
import org.bson.codecs.EncoderContext;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
public abstract class GenericCodec<T extends GenericEntity> implements CollectibleCodec<T> {
|
||||
private final Codec<Document> documentCodec;
|
||||
protected GenericCodec() {
|
||||
this.documentCodec = MongoClientSettings.getDefaultCodecRegistry()
|
||||
.get(Document.class);
|
||||
}
|
||||
|
||||
public Codec<Document> getDocumentCodec() {
|
||||
return documentCodec;
|
||||
}
|
||||
@Override
|
||||
public abstract void encode(BsonWriter writer, T entity, EncoderContext encoderContext);
|
||||
|
||||
@Override
|
||||
public abstract Class<T> getEncoderClass();
|
||||
|
||||
@Override
|
||||
public T generateIdIfAbsentFromDocument(T document) {
|
||||
if (!documentHasId(document)) {
|
||||
document.setId(new ObjectId().toString());
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean documentHasId(T document) {
|
||||
return document.getId() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BsonValue getDocumentId(T document) {
|
||||
return new BsonObjectId(new ObjectId(document.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract T decode(BsonReader reader, DecoderContext decoderContext);
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package fr.uca.iut.codecs.pokemong;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import fr.uca.iut.codecs.GenericCodec;
|
||||
import fr.uca.iut.entities.Pokemong;
|
||||
import fr.uca.iut.entities.Type;
|
||||
import fr.uca.iut.utils.PokemongName;
|
||||
import fr.uca.iut.utils.TypeName;
|
||||
import org.bson.*;
|
||||
import org.bson.codecs.*;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PokemongCodec extends GenericCodec<Pokemong> {
|
||||
private final Codec<Document> documentCodec;
|
||||
|
||||
public PokemongCodec() {
|
||||
this.documentCodec = MongoClientSettings.getDefaultCodecRegistry()
|
||||
.get(Document.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(BsonWriter writer, Pokemong pokemong, EncoderContext encoderContext) {
|
||||
Document doc = new Document();
|
||||
doc.put("_id", new ObjectId(pokemong.getId()));
|
||||
doc.put("nickname", pokemong.getNickname());
|
||||
doc.put("dob",
|
||||
Date.from(pokemong.getDob()
|
||||
.atStartOfDay(ZoneId.systemDefault())
|
||||
.toInstant()));
|
||||
doc.put("level", pokemong.getLevel());
|
||||
doc.put("pokedexId", pokemong.getPokedexId());
|
||||
doc.put("evoStage", pokemong.getEvoStage());
|
||||
List<String> evoTrack = Optional.ofNullable(pokemong.getEvoTrack())
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
doc.put("evoTrack", evoTrack);
|
||||
doc.put("isMegaEvolved", pokemong.getMegaEvolved());
|
||||
doc.put("trainer", pokemong.getTrainer());
|
||||
List<Document> types = Optional.ofNullable(pokemong.getTypes())
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(type -> {
|
||||
Document typeDoc = new Document();
|
||||
typeDoc.put("name",
|
||||
type.getName()
|
||||
.name());
|
||||
List<String> weakAgainst = type.getWeakAgainst()
|
||||
.stream()
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
typeDoc.put("weakAgainst", weakAgainst);
|
||||
List<String> effectiveAgainst = type.getEffectiveAgainst()
|
||||
.stream()
|
||||
.map(Enum::name)
|
||||
.collect(Collectors.toList());
|
||||
typeDoc.put("effectiveAgainst", effectiveAgainst);
|
||||
return typeDoc;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
doc.put("types", types);
|
||||
doc.put("moveSet", pokemong.getMoveSet());
|
||||
documentCodec.encode(writer, doc, encoderContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Pokemong> getEncoderClass() {
|
||||
return Pokemong.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pokemong decode(BsonReader reader, DecoderContext decoderContext) {
|
||||
Document document = documentCodec.decode(reader, decoderContext);
|
||||
Pokemong pokemong = new Pokemong();
|
||||
pokemong.setId(document.getObjectId("_id").toString());
|
||||
pokemong.setNickname(document.getString("nickname"));
|
||||
Date dob = document.getDate("dob");
|
||||
if (dob != null) {
|
||||
pokemong.setDob(dob.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate());
|
||||
}
|
||||
pokemong.setPokedexId(document.getInteger("pokedexId"));
|
||||
pokemong.setEvoStage(document.getInteger("evoStage"));
|
||||
List<PokemongName> evoTrack = Optional.ofNullable((List<String>) document.get("evoTrack"))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(PokemongName::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
pokemong.setEvoTrack(evoTrack);
|
||||
pokemong.setMegaEvolved(document.getBoolean("isMegaEvolved"));
|
||||
pokemong.setTrainer(document.getObjectId("trainer"));
|
||||
List<Type> types = Optional.ofNullable((List<Document>) document.get("types"))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(typeDoc -> {
|
||||
Type type = new Type();
|
||||
type.setName(TypeName.valueOf(typeDoc.getString("name")));
|
||||
List<TypeName> weakAgainst = Optional
|
||||
.ofNullable((List<String>) typeDoc.get("weakAgainst"))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(TypeName::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
type.setWeakAgainst(weakAgainst);
|
||||
List<TypeName> effectiveAgainst = Optional
|
||||
.ofNullable((List<String>) typeDoc.get("effectiveAgainst"))
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(TypeName::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
type.setEffectiveAgainst(effectiveAgainst);
|
||||
return type;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
pokemong.setTypes(types);
|
||||
pokemong.setMoveSet(Optional.ofNullable(document.getList("moveSet", ObjectId.class))
|
||||
.orElse(Collections.emptyList()));
|
||||
return pokemong;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package fr.uca.iut.codecs.pokemong;
|
||||
|
||||
import fr.uca.iut.entities.Pokemong;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.configuration.CodecProvider;
|
||||
import org.bson.codecs.configuration.CodecRegistry;
|
||||
|
||||
public class PokemongCodecProvider implements CodecProvider {
|
||||
@Override
|
||||
public <T> Codec<T> get(Class<T> clazz, CodecRegistry registry) {
|
||||
if (clazz.equals(Pokemong.class)) {
|
||||
return (Codec<T>) new PokemongCodec();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package fr.uca.iut.codecs.trainer;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import fr.uca.iut.codecs.GenericCodec;
|
||||
import fr.uca.iut.entities.Trainer;
|
||||
import org.bson.*;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.DecoderContext;
|
||||
import org.bson.codecs.EncoderContext;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
|
||||
public class TrainerCodec extends GenericCodec<Trainer> {
|
||||
private final Codec<Document> documentCodec;
|
||||
|
||||
public TrainerCodec() {
|
||||
this.documentCodec = MongoClientSettings.getDefaultCodecRegistry()
|
||||
.get(Document.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(BsonWriter writer, Trainer trainer, EncoderContext encoderContext) {
|
||||
Document doc = new Document();
|
||||
doc.put("_id", new ObjectId(trainer.getId()));
|
||||
doc.put("name", trainer.getName());
|
||||
doc.put("dob", Date.from(trainer.getDob().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
doc.put("wins", trainer.getWins());
|
||||
doc.put("losses", trainer.getLosses());
|
||||
doc.put("pastOpponents", trainer.getPastOpponents());
|
||||
doc.put("pokemongs", trainer.getPokemongs());
|
||||
documentCodec.encode(writer, doc, encoderContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Trainer> getEncoderClass() {
|
||||
return Trainer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Trainer decode(BsonReader reader, DecoderContext decoderContext) {
|
||||
Document document = documentCodec.decode(reader, decoderContext);
|
||||
Trainer trainer = new Trainer();
|
||||
trainer.setId(document.getObjectId("_id").toString());
|
||||
trainer.setName(document.getString("name"));
|
||||
Date dob = document.getDate("dob");
|
||||
if (dob != null) {
|
||||
trainer.setDob(dob.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
||||
}
|
||||
trainer.setWins(document.getInteger("wins", 0));
|
||||
trainer.setLosses(document.getInteger("losses", 0));
|
||||
trainer.setPastOpponents(document.getList("pastOpponents", ObjectId.class));
|
||||
trainer.setPokemongs(document.getList("pokemongs", ObjectId.class));
|
||||
return trainer;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package fr.uca.iut.codecs.trainer;
|
||||
|
||||
import fr.uca.iut.entities.Trainer;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.configuration.CodecProvider;
|
||||
import org.bson.codecs.configuration.CodecRegistry;
|
||||
|
||||
public class TrainerCodecProvider implements CodecProvider {
|
||||
@Override
|
||||
public <T> Codec<T> get(Class<T> clazz, CodecRegistry registry) {
|
||||
if (clazz.equals(Trainer.class)) {
|
||||
return (Codec<T>) new TrainerCodec();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package fr.uca.iut.codecs.type;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import fr.uca.iut.entities.Type;
|
||||
import fr.uca.iut.utils.TypeName;
|
||||
import org.bson.*;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.DecoderContext;
|
||||
import org.bson.codecs.EncoderContext;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TypeCodec implements Codec<Type> {
|
||||
private final Codec<Document> documentCodec;
|
||||
|
||||
public TypeCodec() {
|
||||
this.documentCodec = MongoClientSettings.getDefaultCodecRegistry()
|
||||
.get(Document.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(BsonWriter writer, Type type, EncoderContext encoderContext) {
|
||||
Document doc = new Document();
|
||||
Optional.ofNullable(type.getName())
|
||||
.map(Enum::name)
|
||||
.ifPresent(name -> doc.put("name", name));
|
||||
|
||||
Optional.ofNullable(type.getWeakAgainst())
|
||||
.map(weakAgainst -> weakAgainst.stream().map(Enum::name).collect(Collectors.toList()))
|
||||
.ifPresent(weakAgainst -> doc.put("weakAgainst", weakAgainst));
|
||||
|
||||
Optional.ofNullable(type.getEffectiveAgainst())
|
||||
.map(effectiveAgainst -> effectiveAgainst.stream().map(Enum::name).collect(Collectors.toList()))
|
||||
.ifPresent(effectiveAgainst -> doc.put("effectiveAgainst", effectiveAgainst));
|
||||
|
||||
documentCodec.encode(writer, doc, encoderContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Type> getEncoderClass() {
|
||||
return Type.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type decode(BsonReader reader, DecoderContext decoderContext) {
|
||||
Document document = documentCodec.decode(reader, decoderContext);
|
||||
Type type = new Type();
|
||||
|
||||
Optional.ofNullable(document.getString("name"))
|
||||
.map(TypeName::valueOf)
|
||||
.ifPresent(type::setName);
|
||||
|
||||
Optional.ofNullable(document.get("weakAgainst"))
|
||||
.filter(obj -> obj instanceof List<?>)
|
||||
.map(obj -> ((List<String>) obj).stream().map(TypeName::valueOf).collect(Collectors.toList()))
|
||||
.ifPresent(type::setWeakAgainst);
|
||||
|
||||
Optional.ofNullable(document.get("effectiveAgainst"))
|
||||
.filter(obj -> obj instanceof List<?>)
|
||||
.map(obj -> ((List<String>) obj).stream().map(TypeName::valueOf).collect(Collectors.toList()))
|
||||
.ifPresent(type::setEffectiveAgainst);
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package fr.uca.iut.codecs.type;
|
||||
|
||||
import fr.uca.iut.entities.Type;
|
||||
import org.bson.codecs.Codec;
|
||||
import org.bson.codecs.configuration.CodecProvider;
|
||||
import org.bson.codecs.configuration.CodecRegistry;
|
||||
|
||||
public class TypeCodecProvider implements CodecProvider {
|
||||
@Override
|
||||
public <T> Codec<T> get(Class<T> clazz, CodecRegistry registry) {
|
||||
if (clazz.equals(Type.class)) {
|
||||
return (Codec<T>) new TypeCodec();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package fr.uca.iut.config;
|
||||
|
||||
import com.mongodb.client.MongoClient;
|
||||
import com.mongodb.client.MongoClients;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.enterprise.inject.Disposes;
|
||||
import jakarta.enterprise.inject.Produces;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
|
||||
@ApplicationScoped
|
||||
public class MongoClientProvider {
|
||||
|
||||
@ConfigProperty(name = "quarkus.mongodb.connection-string")
|
||||
String CONNECTION_STRING;
|
||||
@Produces
|
||||
@ApplicationScoped
|
||||
public MongoClient createMongoClient() {
|
||||
return MongoClients.create(CONNECTION_STRING);
|
||||
}
|
||||
|
||||
public void close(@Disposes MongoClient client) {
|
||||
client.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package fr.uca.iut.entities;
|
||||
|
||||
import org.bson.codecs.pojo.annotations.BsonId;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class GenericEntity {
|
||||
|
||||
@BsonId
|
||||
private String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
GenericEntity entity = (GenericEntity) o;
|
||||
return Objects.equals(id, entity.id);
|
||||
}
|
||||
}
|
@ -1,12 +1,65 @@
|
||||
package fr.uca.iut.entities;
|
||||
|
||||
import org.bson.codecs.pojo.annotations.BsonId;
|
||||
|
||||
public class Move {
|
||||
public class Move extends GenericEntity {
|
||||
public static final String COLLECTION_NAME = "moves";
|
||||
|
||||
public String name;
|
||||
public String category;
|
||||
public Integer power;
|
||||
public Integer accuracy;
|
||||
public Type type;
|
||||
@BsonId
|
||||
private String id;
|
||||
private String name;
|
||||
private String category;
|
||||
private Integer power;
|
||||
private Integer accuracy;
|
||||
private Type type;
|
||||
|
||||
public Move() {}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Integer getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
public void setPower(Integer power) {
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
public Integer getAccuracy() {
|
||||
return accuracy;
|
||||
}
|
||||
|
||||
public void setAccuracy(Integer accuracy) {
|
||||
this.accuracy = accuracy;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Type type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -1,23 +1,119 @@
|
||||
package fr.uca.iut.entities;
|
||||
|
||||
import fr.uca.iut.utils.PokemongName;
|
||||
import org.bson.codecs.pojo.annotations.BsonId;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Pokemong {
|
||||
public class Pokemong extends GenericEntity {
|
||||
public static final String COLLECTION_NAME = "pokemongs";
|
||||
public String nickname;
|
||||
public LocalDate dob;
|
||||
public Integer level;
|
||||
public Integer pokedexId;
|
||||
public Integer evoStage;
|
||||
public List<PokemongName> evoTrack;
|
||||
public Boolean isMegaEvolved;
|
||||
public ObjectId trainer;
|
||||
public Set<Type> types; // TODO Bound this within [1;2] (in controller)
|
||||
public List<ObjectId> moveSet; // TODO Bound this within [1;4] (in controller) and denormalize move "name"
|
||||
@BsonId
|
||||
private String id;
|
||||
private String nickname;
|
||||
private LocalDate dob;
|
||||
private Integer level;
|
||||
private Integer pokedexId;
|
||||
private Integer evoStage;
|
||||
private List<PokemongName> evoTrack;
|
||||
private Boolean isMegaEvolved;
|
||||
private ObjectId trainer;
|
||||
private List<Type> types; // TODO Bound this within [1;2] (in controller)
|
||||
private List<ObjectId> moveSet; // TODO Bound this within [1;4] (in controller) and denormalize move "name"
|
||||
|
||||
public Pokemong() {}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public LocalDate getDob() {
|
||||
return dob;
|
||||
}
|
||||
|
||||
public void setDob(LocalDate dob) {
|
||||
this.dob = dob;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getPokedexId() {
|
||||
return pokedexId;
|
||||
}
|
||||
|
||||
public void setPokedexId(Integer pokedexId) {
|
||||
this.pokedexId = pokedexId;
|
||||
}
|
||||
|
||||
public Integer getEvoStage() {
|
||||
return evoStage;
|
||||
}
|
||||
|
||||
public void setEvoStage(Integer evoStage) {
|
||||
this.evoStage = evoStage;
|
||||
}
|
||||
|
||||
public List<PokemongName> getEvoTrack() {
|
||||
return evoTrack;
|
||||
}
|
||||
|
||||
public void setEvoTrack(List<PokemongName> evoTrack) {
|
||||
this.evoTrack = evoTrack;
|
||||
}
|
||||
|
||||
public Boolean getMegaEvolved() {
|
||||
return isMegaEvolved;
|
||||
}
|
||||
|
||||
public void setMegaEvolved(Boolean megaEvolved) {
|
||||
isMegaEvolved = megaEvolved;
|
||||
}
|
||||
|
||||
public ObjectId getTrainer() {
|
||||
return trainer;
|
||||
}
|
||||
|
||||
public void setTrainer(ObjectId trainer) {
|
||||
this.trainer = trainer;
|
||||
}
|
||||
|
||||
// TODO take particular care with collections
|
||||
|
||||
// TODO study the question of encapsulation when it comes to using these dependencies...
|
||||
public List<Type> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(List<Type> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
public List<ObjectId> getMoveSet() {
|
||||
return moveSet;
|
||||
}
|
||||
|
||||
public void setMoveSet(List<ObjectId> moveSet) {
|
||||
this.moveSet = moveSet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,78 @@
|
||||
package fr.uca.iut.entities;
|
||||
|
||||
import org.bson.codecs.pojo.annotations.BsonId;
|
||||
import org.bson.types.ObjectId;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public class Trainer {
|
||||
public class Trainer extends GenericEntity {
|
||||
public static final String COLLECTION_NAME = "trainers";
|
||||
|
||||
public String name;
|
||||
public LocalDate dob;
|
||||
public Integer wins;
|
||||
public Integer losses;
|
||||
public List<ObjectId> pastOpponents;
|
||||
public List<ObjectId> pokemongs;
|
||||
@BsonId
|
||||
private String id;
|
||||
private String name;
|
||||
private LocalDate dob;
|
||||
private Integer wins;
|
||||
private Integer losses;
|
||||
private List<ObjectId> pastOpponents;
|
||||
private List<ObjectId> pokemongs;
|
||||
|
||||
public Trainer() {}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public LocalDate getDob() {
|
||||
return dob;
|
||||
}
|
||||
|
||||
public void setDob(LocalDate dob) {
|
||||
this.dob = dob;
|
||||
}
|
||||
|
||||
public Integer getWins() {
|
||||
return wins;
|
||||
}
|
||||
|
||||
public void setWins(Integer wins) {
|
||||
this.wins = wins;
|
||||
}
|
||||
|
||||
public Integer getLosses() {
|
||||
return losses;
|
||||
}
|
||||
|
||||
public void setLosses(Integer losses) {
|
||||
this.losses = losses;
|
||||
}
|
||||
|
||||
public List<ObjectId> getPastOpponents() {
|
||||
return pastOpponents;
|
||||
}
|
||||
|
||||
public void setPastOpponents(List<ObjectId> pastOpponents) {
|
||||
this.pastOpponents = pastOpponents;
|
||||
}
|
||||
|
||||
public List<ObjectId> getPokemongs() {
|
||||
return pokemongs;
|
||||
}
|
||||
|
||||
public void setPokemongs(List<ObjectId> pokemongs) {
|
||||
this.pokemongs = pokemongs;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,2 @@
|
||||
quarkus.mongodb.connection-string=mongodb+srv://<username>:<password>@<cluster>.<node>.mongodb.net
|
||||
quarkus.mongodb.database=<database>
|
||||
quarkus.mongodb.credentials.username=<username>
|
||||
quarkus.mongodb.credentials.password=<password>
|
||||
quarkus.mongodb.database=<database>
|
Loading…
Reference in new issue