Exemplo n.º 1
0
class Marc21Draft(Draft):
    """Marc21 draft API."""

    model_cls = DraftMetadata

    index = IndexField("marc21records-drafts-marc21-v1.0.0",
                       search_alias="marc21records-marc21")

    pid = PIDField(
        key="id",
        provider=MarcDraftProvider,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
        delete=False,
    )

    conceptpid = PIDField(
        key="conceptid",
        provider=MarcDraftProvider,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
        delete=False,
    )

    files = FilesField(
        store=False,
        file_cls=DraftFile,
        delete=False,
    )

    bucket_id = ModelField(dump=False)

    bucket = ModelField(dump=False)
Exemplo n.º 2
0
class Marc21Record(Record):
    """Define API for Marc21 create and manipulate."""

    model_cls = RecordMetadata

    index = IndexField("marc21records-marc21-marc21-v1.0.0",
                       search_alias="marc21records-marc21")

    pid = PIDField(
        key="id",
        provider=MarcRecordProvider,
        delete=False,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
    )

    conceptpid = PIDField(
        key="conceptid",
        provider=MarcRecordProvider,
        delete=False,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
    )

    files = FilesField(
        store=False,
        file_cls=RecordFile,
        create=False,
        delete=False,
    )

    bucket_id = ModelField(dump=False)

    bucket = ModelField(dump=False)
Exemplo n.º 3
0
class Marc21Record(Record):
    """Define API for Marc21 create and manipulate."""

    model_cls = RecordMetadata
    versions_model_cls = VersionsState
    parent_record_cls = Marc21Parent

    index = IndexField("marc21records-marc21-marc21-v1.0.0",
                       search_alias="marc21records-marc21")

    parent = ParentField(Marc21Parent,
                         create=True,
                         soft_delete=False,
                         hard_delete=True)

    pid = PIDField(
        key="id",
        provider=MarcRecordProvider,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
        delete=False,
    )

    files = FilesField(
        store=False,
        file_cls=RecordFile,
        create=False,
        delete=False,
    )

    bucket_id = ModelField(dump=False)

    bucket = ModelField(dump=False)
Exemplo n.º 4
0
class Draft(DraftBase):
    """Example record API."""

    # Configuration
    model_cls = DraftMetadata
    versions_model_cls = ParentState
    parent_record_cls = ParentRecord

    # System fields
    schema = ConstantField(
        '$schema', 'http://localhost/schemas/records/record-v1.0.0.json')

    index = IndexField('draftsresources-drafts-draft-v1.0.0',
                       search_alias='draftsresources-drafts')

    files = FilesField(
        store=False,
        file_cls=FileDraft,
        # Don't delete, we'll manage in the service
        delete=False,
    )

    bucket_id = ModelField(dump=False)

    bucket = ModelField(dump=False)
Exemplo n.º 5
0
class BibliographicRecord(Record):
    """Bibliographic Record API."""

    model_cls = models.RecordMetadata

    index = IndexField('rdmrecords-records-record-v1.0.0',
                       search_alias='rdmrecords-records')

    dumper = ElasticsearchDumper(extensions=[
        EDTFDumperExt('metadata.publication_date'),
        RelationDumperExt('relations'),
    ])

    relations = RelationsField(languages=PIDListRelation(
        'metadata.languages', attrs=['metadata'], pid_field=Language.pid), )

    files = FilesField(
        store=False,
        file_cls=RecordFile,
        # Don't create
        create=False,
        # Don't delete, we'll manage in the service
        delete=False,
    )
    bucket_id = ModelField(dump=False)
    bucket = ModelField(dump=False)
Exemplo n.º 6
0
class Marc21Draft(Draft):
    """Marc21 draft API."""

    model_cls = DraftMetadata
    versions_model_cls = VersionsState
    parent_record_cls = Marc21Parent

    index = IndexField("marc21records-drafts-marc21-v1.0.0",
                       search_alias="marc21records-marc21")

    parent = ParentField(Marc21Parent,
                         create=True,
                         soft_delete=False,
                         hard_delete=True)

    pid = PIDField(
        key="id",
        provider=MarcDraftProvider,
        context_cls=MarcPIDFieldContext,
        resolver_cls=MarcResolver,
        delete=False,
    )

    files = FilesField(
        store=False,
        file_cls=DraftFile,
        delete=False,
    )

    bucket_id = ModelField(dump=False)

    bucket = ModelField(dump=False)
Exemplo n.º 7
0
class LOMDraft(Draft):
    """For representing entries from the 'lom_drafts_metadata'-SQL-table."""

    model_cls = models.LOMDraftMetadata
    parent_record_cls = LOMParent
    versions_model_cls = models.LOMVersionsState

    pid = PIDField(
        key="id",
        provider=LOMDraftRecordIdProvider,
        resolver_cls=LOMResolver,
        context_cls=LOMPIDFieldContext,
        # flag for deleting pid from database on post-record-deletion,
        # delete pid via LOMRecordService instead
        delete=False,
    )
    files = FilesField(
        file_cls=LOMFileDraft,
        delete=False,
        store=False,
    )
    access = RecordAccessField()
    bucket_id = ModelField(dump=False)
    bucket = ModelField(dump=False)
    index = IndexField("lomrecords-drafts-draft-v1.0.0",
                       search_alias="lomrecords")
    is_published = PIDStatusCheckField(status=PIDStatus.REGISTERED, dump=True)
    resource_type = DictField()
Exemplo n.º 8
0
class RDMDraft(CommonFieldsMixin, Draft):
    """RDM draft API."""

    model_cls = models.RDMDraftMetadata

    index = IndexField("rdmrecords-drafts-draft-v3.0.0",
                       search_alias="rdmrecords")

    files = FilesField(
        store=False,
        file_cls=RDMFileDraft,
        # Don't delete, we'll manage in the service
        delete=False,
    )

    has_draft = HasDraftCheckField()
Exemplo n.º 9
0
class RDMRecord(CommonFieldsMixin, Record):
    """RDM Record API."""

    model_cls = models.RDMRecordMetadata

    index = IndexField("rdmrecords-records-record-v3.0.0",
                       search_alias="rdmrecords-records")

    files = FilesField(
        store=False,
        file_cls=RDMFileRecord,
        # Don't create
        create=False,
        # Don't delete, we'll manage in the service
        delete=False,
    )

    has_draft = HasDraftCheckField(RDMDraft)
Exemplo n.º 10
0
class Community(Record):
    """Community API."""

    pid = PIDField('id', provider=CommunitiesIdProvider, create=False)
    schema = ConstantField('$schema',
                           'local://communities/communities-v1.0.0.json')

    model_cls = models.CommunityMetadata

    index = IndexField("communities-communities-v1.0.0",
                       search_alias="communities")

    access = CommunityAccessField()

    bucket_id = ModelField(dump=False)
    bucket = ModelField(dump=False)
    files = FilesField(
        store=False,
        file_cls=CommunityFile,
        # Don't delete, we'll manage in the service
        delete=False,
    )
Exemplo n.º 11
0
class RecordWithFiles(Record):
    """Example record with file API."""

    files = FilesField(store=False, file_cls=FileRecord)
    bucket_id = ModelField()
    bucket = ModelField(dump=False)