org.schoellerfamily.gedbrowser.api.crud.OperationsEnabler Maven / Gradle / Ivy
package org.schoellerfamily.gedbrowser.api.crud;
import org.schoellerfamily.gedbrowser.api.transformers.DocumentToApiModelTransformer;
import org.schoellerfamily.gedbrowser.datamodel.GedObject;
import org.schoellerfamily.gedbrowser.persistence.domain.GedDocument;
import org.schoellerfamily.gedbrowser.persistence.mongo.gedconvert.GedObjectToGedDocumentMongoConverter;
import org.schoellerfamily.gedbrowser.persistence.mongo.loader.GedDocumentFileLoader;
import org.schoellerfamily.gedbrowser.persistence.mongo.repository.RepositoryManagerMongo;
/**
* @param the data model type we are creating
* @param the DB type associated with the type X
* @author Dick Schoeller
*/
public abstract class OperationsEnabler<
X extends GedObject, Y extends GedDocument> extends CrudParams {
/**
* Handles data conversion from DB model to API model.
*/
private final DocumentToApiModelTransformer d2dm =
new DocumentToApiModelTransformer();
/**
* @param loader the file loader that we will use
* @param toDocConverter the document converter
* @param repositoryManager the repository manager
*/
public OperationsEnabler(final GedDocumentFileLoader loader,
final GedObjectToGedDocumentMongoConverter toDocConverter,
final RepositoryManagerMongo repositoryManager) {
super(loader, toDocConverter, repositoryManager);
}
/**
* @return the data model class
*/
public abstract Class getGedClass();
/**
* @return the class the converts from DB model to API model
*/
public final DocumentToApiModelTransformer getD2dm() {
return d2dm;
}
}