# Path: server/materialsdatabank/server/models/base.py
# class BaseAccessControlledModel(AccessControlledModel):
#     types = {}
# 
#     def find(self, dataset_id, offset=0, limit=0, timeout=None,
#              fields=None, sort=None):
# 
#         query = {
#             'datasetId': dataset_id
#         }
# 
#         return super(BaseAccessControlledModel, self).find(query, offset, limit,
#                                                            timeout, fields, sort)
#     def validate_list(self, value, func):
#         if not isinstance(value, list):
#             raise ValidationException('Invalid value for list type')
# 
#         return [func(x) for x in value]
# 
#     def validate(self, doc):
#         for k in doc.keys():
#             if k in self.types:
#                 doc[k] = self.types[k](doc[k])
# 
#         return doc


from .base import BaseAccessControlledModel
from girder.constants import AccessType
from girder.models.group import Group
from girder.models.item import Item
from girder.models.file import File
from bson.objectid import ObjectId


class Projection(BaseAccessControlledModel):
    def initialize(self):
        self.name = 'mdb.projections'
        self.ensureIndices(['datasetId'])

        self.types = {
            'voltage': float,
            'convergenceSemiAngle': float,
            'probeSize': float,
            'detectorInnerAngle': float,
            'detectorOuterAngle': float,

# Path: server/materialsdatabank/server/models/base.py
# class BaseAccessControlledModel(AccessControlledModel):
#     types = {}
# 
#     def find(self, dataset_id, offset=0, limit=0, timeout=None,
#              fields=None, sort=None):
# 
#         query = {
#             'datasetId': dataset_id
#         }
# 
#         return super(BaseAccessControlledModel, self).find(query, offset, limit,
#                                                            timeout, fields, sort)
#     def validate_list(self, value, func):
#         if not isinstance(value, list):
#             raise ValidationException('Invalid value for list type')
# 
#         return [func(x) for x in value]
# 
#     def validate(self, doc):
#         for k in doc.keys():
#             if k in self.types:
#                 doc[k] = self.types[k](doc[k])
# 
#         return doc


# Path: server/materialsdatabank/server/models/projection.py
from .base import BaseAccessControlledModel
from girder.constants import AccessType
from girder.models.group import Group
from girder.models.item import Item
from girder.models.file import File
from bson.objectid import ObjectId



class Projection(BaseAccessControlledModel):
    def initialize(self):
        self.name = 'mdb.projections'
        self.ensureIndices(['datasetId'])

        self.types = {
            'voltage': float,
            'convergenceSemiAngle': float,
            'probeSize': float,
            'detectorInnerAngle': float,
            'detectorOuterAngle': float,

            'depthOfFocus': float,