#!/usr/bin/env python

#
# Implementation for file controller.
#

from dm.common.objects.dmObject import DmObject
from dm.common.objects.dmObjectManager import DmObjectManager
from dm.common.mongodb.api.fileMongoDbApi import FileMongoDbApi

class FileSessionControllerImpl(DmObjectManager):
    """ File controller implementation class. """

    def __init__(self):
        DmObjectManager.__init__(self)
        self.fileMongoDbApi = FileMongoDbApi()

    def addExperimentFile(self, fileInfo):
        return self.fileMongoDbApi.addExperimentFile(fileInfo)

    def updateExperimentFile(self, fileInfo):
        return self.fileMongoDbApi.updateExperimentFile(fileInfo)

    def updateExperimentFileById(self, fileInfo):
        return self.fileMongoDbApi.updateExperimentFileById(fileInfo)

    def getExperimentFiles(self, experimentName, queryDict):
        return self.fileMongoDbApi.getExperimentFiles(experimentName, queryDict=queryDict)

    def getExperimentFileById(self, experimentName, id):
        return self.fileMongoDbApi.getExperimentFileById(experimentName, id)

    def getExperimentFile(self, experimentName, fileName):
        return self.fileMongoDbApi.getExperimentFile(experimentName, fileName)