org.javers.repository.mongo.model.MongoHeadId Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javers-persistence-mongo Show documentation
Show all versions of javers-persistence-mongo Show documentation
JaVers - object auditing and diff framework for Java
package org.javers.repository.mongo.model;
import org.bson.Document;
import org.javers.core.commit.CommitId;
/**
* @author pawel szymczyk
*/
public class MongoHeadId {
public static final String COLLECTION_NAME = "jv_head_id";
private static final String KEY = "id";
private final String id;
public MongoHeadId(Document doc) {
this.id = doc.getString(KEY);
}
public MongoHeadId(CommitId id) {
this.id = id.value();
}
public CommitId toCommitId() {
return CommitId.valueOf(getId());
}
public Document toDocument() {
return new Document(KEY, id);
}
public Document getUpdateCommand(){
return new Document("$set", toDocument());
}
private String getId() {
return id;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy