foliolib.folio.api.sourceRecordManager.ChangeManager
- class foliolib.folio.api.sourceRecordManager.ChangeManager(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiChange Manager API
API for accessing ChangeManager’s bussiness logic
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_jobExecution(jobExecutionsId)Delete jobExecution item with given {jobExecutionId}
delete_jobExecutions(jobExecution)Delete JobExecution by multiple IDs
delete_record(jobExecutionsId)Delete JobExecution and associated records in SRS
get_children(jobExecutionsId, **kwargs)Get children JobExecutions by parent id, by default returns all existing children JobExecutions, in order to limit the collection parameter limit should be explicitly specified
get_jobExecution(jobExecutionsId)Get JobExecution by id
get_parsedRecords(**kwargs)Retrieve ParsedRecord by externalId
modify_jobExecution(jobExecutionsId, ...)Update jobExecution item with given {jobExecutionId}
modify_jobProfile(jobExecutionsId, jobProfile)Set JobProfile for JobExecution
modify_parsedRecord(parsedRecordsId, ...)PUT /change-manager/parsedRecords/{parsedRecordsId}modify_status(jobExecutionsId, status)Update JobExecution status
set_jobExecution(jobExecution)Initialize JobExecutions
set_record(jobExecutionsId, record)Receive chunk of raw records
- delete_jobExecution(jobExecutionsId: str)
Delete jobExecution item with given {jobExecutionId}
DELETE /change-manager/jobExecutions/{jobExecutionsId}- Parameters
jobExecutionsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- delete_jobExecutions(jobExecution: dict)
Delete JobExecution by multiple IDs
DELETE /change-manager/jobExecutions- Parameters
jobExecution (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Request to delete JobExecution entities", "type": "object", "additionalProperties": false, "properties": { "ids": { "description": "Id of JobExecution entities to be deleted", "type": "array", "items": { "description": "Unique identifier", "$ref": "../../raml-util/schemas/uuid.schema" } } } }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Response status of soft delete JobExecution entities", "type": "object", "additionalProperties": false, "properties": { "jobExecutionDetails": { "description": "Details of job execution entities processed for soft deletion", "type": "array", "items": { "description": "Job Execution Deletion Key Value Pair", "$ref": "jobExecutionDeletionPair.json" } } } }
- delete_record(jobExecutionsId: str)
Delete JobExecution and associated records in SRS
DELETE /change-manager/jobExecutions/{jobExecutionsId}/records- Parameters
jobExecutionsId (str) –
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
- get_children(jobExecutionsId: str, **kwargs)
Get children JobExecutions by parent id, by default returns all existing children JobExecutions, in order to limit the collection parameter limit should be explicitly specified
GET /change-manager/jobExecutions/{jobExecutionsId}/children- Parameters
jobExecutionsId (str) –
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
offset (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Collection of execution job dtos", "type": "object", "additionalProperties": false, "properties": { "jobExecutions": { "description": "List of execution job dtos", "type": "array", "id": "jobExecutionList", "items": { "type": "object", "$ref": "jobExecutionDto.json" } }, "totalRecords": { "type": "integer" } }, "excludedFromEqualsAndHashCode": [ "totalRecords" ], "required": [ "jobExecutions", "totalRecords" ] }
- get_jobExecution(jobExecutionsId: str)
Get JobExecution by id
GET /change-manager/jobExecutions/{jobExecutionsId}- Parameters
jobExecutionsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Job Execution Schema", "type": "object", "properties": { "id": { "description": "Unique identifier", "$ref": "../../raml-util/schemas/uuid.schema" }, "hrId": { "description": "Human readable id", "type": "integer" }, "parentJobId": { "description": "Id of the parent JobExecution entity", "$ref": "../../raml-util/schemas/uuid.schema" }, "subordinationType": { "description": "Type of subordination to another JobExecution entities", "type": "string", "enum": [ "CHILD", "PARENT_SINGLE", "PARENT_MULTIPLE" ] }, "jobProfileInfo": { "description": "Related JobProfile information", "type": "object", "$ref": "../common/profileInfo.json" }, "jobProfileSnapshotWrapper": { "description": "Snapshot wrapper of related JobProfile", "$ref": "../mod-data-import-converter-storage/profileSnapshotWrapper.json" }, "sourcePath": { "description": "Path to the file", "type": "string" }, "fileName": { "description": "File name", "type": "string" }, "runBy": { "description": "First and last name of the user that triggered the job execution", "type": "object", "properties": { "firstName": { "description": "First name", "type": "string" }, "lastName": { "description": "Last name", "type": "string" } } }, "progress": { "description": "Execution progress of the job", "type": "object", "$ref": "./progress.json" }, "startedDate": { "description": "Date and time when the job execution started", "type": "string", "format": "date-time" }, "completedDate": { "description": "Date and time when the job execution completed", "type": "string", "format": "date-time" }, "status": { "description": "Current status of the job execution", "type": "string", "$ref": "../common/status.json" }, "uiStatus": { "description": "Status that is rendered on UI", "type": "string", "$ref": "uiStatus.json" }, "errorStatus": { "description": "Status that describe error state of job execution", "type": "string", "$ref": "errorStatus.json" }, "userId": { "description": "ID of the user who created the JobExecution", "$ref": "../../raml-util/schemas/uuid.schema" } }, "required": [ "id", "parentJobId", "subordinationType", "status", "uiStatus", "userId" ], "excludedFromEqualsAndHashCode": [ "hrId", "progress", "runBy" ] }
- get_parsedRecords(**kwargs)
Retrieve ParsedRecord by externalId
GET /change-manager/parsedRecords- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
externalId (str (^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$) – ): externalId parameter
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Record DTO Schema", "type": "object", "additionalProperties": false, "properties": { "id": { "description": "UUID", "$ref": "../../raml-util/schemas/uuid.schema" }, "externalIdsHolder": { "description": "Container for identifiers of external entities", "type": "object", "$ref": "../common/externalIdsHolder.json" }, "recordType": { "description": "Type of record, e.g. MARC", "type": "string", "$ref": "../mod-source-record-storage/recordType.json" }, "parsedRecord": { "description": "Parsed record", "type": "object", "$ref": "../mod-source-record-storage/parsedRecord.json" }, "recordState": { "description": "State of source record in QM workflow", "type": "string", "enum": [ "ACTUAL", "IN_PROGRESS", "ERROR" ], "default": "ACTUAL" }, "additionalInfo": { "description": "Auxiliary data which is not related to MARC type record", "type": "object", "$ref": "../mod-source-record-storage/additionalInfo.json" }, "metadata": { "description": "Metadata provided by the server", "type": "object", "$ref": "../../raml-util/schemas/metadata.schema", "readonly": true }, "relatedRecordVersion": { "type": "string", "description": "Related record (instance, holdings) version for optimistic locking needs" } }, "required": [ "id", "recordType", "relatedRecordVersion", "parsedRecord" ] }
- modify_jobExecution(jobExecutionsId: str, jobExecution: dict)
Update jobExecution item with given {jobExecutionId}
PUT /change-manager/jobExecutions/{jobExecutionsId}- Parameters
jobExecutionsId (str) –
jobExecution (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Job Execution Schema", "type": "object", "properties": { "id": { "description": "Unique identifier", "$ref": "../../raml-util/schemas/uuid.schema" }, "hrId": { "description": "Human readable id", "type": "integer" }, "parentJobId": { "description": "Id of the parent JobExecution entity", "$ref": "../../raml-util/schemas/uuid.schema" }, "subordinationType": { "description": "Type of subordination to another JobExecution entities", "type": "string", "enum": [ "CHILD", "PARENT_SINGLE", "PARENT_MULTIPLE" ] }, "jobProfileInfo": { "description": "Related JobProfile information", "type": "object", "$ref": "../common/profileInfo.json" }, "jobProfileSnapshotWrapper": { "description": "Snapshot wrapper of related JobProfile", "$ref": "../mod-data-import-converter-storage/profileSnapshotWrapper.json" }, "sourcePath": { "description": "Path to the file", "type": "string" }, "fileName": { "description": "File name", "type": "string" }, "runBy": { "description": "First and last name of the user that triggered the job execution", "type": "object", "properties": { "firstName": { "description": "First name", "type": "string" }, "lastName": { "description": "Last name", "type": "string" } } }, "progress": { "description": "Execution progress of the job", "type": "object", "$ref": "./progress.json" }, "startedDate": { "description": "Date and time when the job execution started", "type": "string", "format": "date-time" }, "completedDate": { "description": "Date and time when the job execution completed", "type": "string", "format": "date-time" }, "status": { "description": "Current status of the job execution", "type": "string", "$ref": "../common/status.json" }, "uiStatus": { "description": "Status that is rendered on UI", "type": "string", "$ref": "uiStatus.json" }, "errorStatus": { "description": "Status that describe error state of job execution", "type": "string", "$ref": "errorStatus.json" }, "userId": { "description": "ID of the user who created the JobExecution", "$ref": "../../raml-util/schemas/uuid.schema" } }, "required": [ "id", "parentJobId", "subordinationType", "status", "uiStatus", "userId" ], "excludedFromEqualsAndHashCode": [ "hrId", "progress", "runBy" ] }
- modify_jobProfile(jobExecutionsId: str, jobProfile: dict)
Set JobProfile for JobExecution
PUT /change-manager/jobExecutions/{jobExecutionsId}/jobProfile- Parameters
jobExecutionsId (str) –
jobProfile (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Related JobProfile information", "javaType": "org.folio.rest.jaxrs.model.JobProfileInfo", "type": "object", "additionalProperties": false, "properties": { "id": { "description": "Unique JobProfile identifier", "$ref": "../../raml-util/schemas/uuid.schema" }, "name": { "description": "Job Profile name", "type": "string" }, "dataType": { "description": "Data type", "type": "string", "$ref": "./dataType.json" }, "hidden": { "description": "Indicates that job should be hidden in data-import log", "type": "boolean", "default": false, "example": false } }, "required": [ "id" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Job Execution Schema", "type": "object", "properties": { "id": { "description": "Unique identifier", "$ref": "../../raml-util/schemas/uuid.schema" }, "hrId": { "description": "Human readable id", "type": "integer" }, "parentJobId": { "description": "Id of the parent JobExecution entity", "$ref": "../../raml-util/schemas/uuid.schema" }, "subordinationType": { "description": "Type of subordination to another JobExecution entities", "type": "string", "enum": [ "CHILD", "PARENT_SINGLE", "PARENT_MULTIPLE" ] }, "jobProfileInfo": { "description": "Related JobProfile information", "type": "object", "$ref": "../common/profileInfo.json" }, "jobProfileSnapshotWrapper": { "description": "Snapshot wrapper of related JobProfile", "$ref": "../mod-data-import-converter-storage/profileSnapshotWrapper.json" }, "sourcePath": { "description": "Path to the file", "type": "string" }, "fileName": { "description": "File name", "type": "string" }, "runBy": { "description": "First and last name of the user that triggered the job execution", "type": "object", "properties": { "firstName": { "description": "First name", "type": "string" }, "lastName": { "description": "Last name", "type": "string" } } }, "progress": { "description": "Execution progress of the job", "type": "object", "$ref": "./progress.json" }, "startedDate": { "description": "Date and time when the job execution started", "type": "string", "format": "date-time" }, "completedDate": { "description": "Date and time when the job execution completed", "type": "string", "format": "date-time" }, "status": { "description": "Current status of the job execution", "type": "string", "$ref": "../common/status.json" }, "uiStatus": { "description": "Status that is rendered on UI", "type": "string", "$ref": "uiStatus.json" }, "errorStatus": { "description": "Status that describe error state of job execution", "type": "string", "$ref": "errorStatus.json" }, "userId": { "description": "ID of the user who created the JobExecution", "$ref": "../../raml-util/schemas/uuid.schema" } }, "required": [ "id", "parentJobId", "subordinationType", "status", "uiStatus", "userId" ], "excludedFromEqualsAndHashCode": [ "hrId", "progress", "runBy" ] }
- modify_parsedRecord(parsedRecordsId: str, parsedRecord: dict)
PUT /change-manager/parsedRecords/{parsedRecordsId}- Parameters
parsedRecordsId (str) –
parsedRecord (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Record DTO Schema", "type": "object", "additionalProperties": false, "properties": { "id": { "description": "UUID", "$ref": "../../raml-util/schemas/uuid.schema" }, "externalIdsHolder": { "description": "Container for identifiers of external entities", "type": "object", "$ref": "../common/externalIdsHolder.json" }, "recordType": { "description": "Type of record, e.g. MARC", "type": "string", "$ref": "../mod-source-record-storage/recordType.json" }, "parsedRecord": { "description": "Parsed record", "type": "object", "$ref": "../mod-source-record-storage/parsedRecord.json" }, "recordState": { "description": "State of source record in QM workflow", "type": "string", "enum": [ "ACTUAL", "IN_PROGRESS", "ERROR" ], "default": "ACTUAL" }, "additionalInfo": { "description": "Auxiliary data which is not related to MARC type record", "type": "object", "$ref": "../mod-source-record-storage/additionalInfo.json" }, "metadata": { "description": "Metadata provided by the server", "type": "object", "$ref": "../../raml-util/schemas/metadata.schema", "readonly": true }, "relatedRecordVersion": { "type": "string", "description": "Related record (instance, holdings) version for optimistic locking needs" } }, "required": [ "id", "recordType", "relatedRecordVersion", "parsedRecord" ] }
- modify_status(jobExecutionsId: str, status: dict)
Update JobExecution status
PUT /change-manager/jobExecutions/{jobExecutionsId}/status- Parameters
jobExecutionsId (str) –
status (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Status DTO Schema", "type": "object", "additionalProperties": false, "properties": { "status": { "description": "Current status of the job execution", "type": "string", "$ref": "../common/status.json" }, "errorStatus": { "description": "Status that describe error state of job execution", "type": "string", "$ref": "../mod-source-record-manager/errorStatus.json" } }, "required": [ "status" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Job Execution Schema", "type": "object", "properties": { "id": { "description": "Unique identifier", "$ref": "../../raml-util/schemas/uuid.schema" }, "hrId": { "description": "Human readable id", "type": "integer" }, "parentJobId": { "description": "Id of the parent JobExecution entity", "$ref": "../../raml-util/schemas/uuid.schema" }, "subordinationType": { "description": "Type of subordination to another JobExecution entities", "type": "string", "enum": [ "CHILD", "PARENT_SINGLE", "PARENT_MULTIPLE" ] }, "jobProfileInfo": { "description": "Related JobProfile information", "type": "object", "$ref": "../common/profileInfo.json" }, "jobProfileSnapshotWrapper": { "description": "Snapshot wrapper of related JobProfile", "$ref": "../mod-data-import-converter-storage/profileSnapshotWrapper.json" }, "sourcePath": { "description": "Path to the file", "type": "string" }, "fileName": { "description": "File name", "type": "string" }, "runBy": { "description": "First and last name of the user that triggered the job execution", "type": "object", "properties": { "firstName": { "description": "First name", "type": "string" }, "lastName": { "description": "Last name", "type": "string" } } }, "progress": { "description": "Execution progress of the job", "type": "object", "$ref": "./progress.json" }, "startedDate": { "description": "Date and time when the job execution started", "type": "string", "format": "date-time" }, "completedDate": { "description": "Date and time when the job execution completed", "type": "string", "format": "date-time" }, "status": { "description": "Current status of the job execution", "type": "string", "$ref": "../common/status.json" }, "uiStatus": { "description": "Status that is rendered on UI", "type": "string", "$ref": "uiStatus.json" }, "errorStatus": { "description": "Status that describe error state of job execution", "type": "string", "$ref": "errorStatus.json" }, "userId": { "description": "ID of the user who created the JobExecution", "$ref": "../../raml-util/schemas/uuid.schema" } }, "required": [ "id", "parentJobId", "subordinationType", "status", "uiStatus", "userId" ], "excludedFromEqualsAndHashCode": [ "hrId", "progress", "runBy" ] }
- set_jobExecution(jobExecution: dict)
Initialize JobExecutions
POST /change-manager/jobExecutions- Parameters
jobExecution (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Request to initialize JobExecution entities", "type": "object", "additionalProperties": false, "properties": { "files": { "description": "Information about files to upload", "type": "array", "items": { "type": "object", "$ref": "fileDto.json" } }, "sourceType": { "description": "Raw records source type", "type": "string", "$ref": "./sourceType.json" }, "jobProfileInfo": { "description": "Related JobProfile information", "type": "object", "$ref": "../common/profileInfo.json" }, "userId": { "description": "ID of the user initializing JobExecutions", "$ref": "../../raml-util/schemas/uuid.schema" } }, "required": [ "sourceType", "userId" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Initialized JobExecution entities", "type": "object", "additionalProperties": false, "properties": { "parentJobExecutionId": { "description": "UUID of the JobExecution entity which is parent for all JobExecution entities in a scope of one file upload process", "$ref": "../../raml-util/schemas/uuid.schema" }, "jobExecutions": { "description": "Array of initialized JobExecution entities", "type": "array", "items": { "type": "object", "$ref": "../mod-source-record-manager/jobExecution.json" } } } }
- set_record(jobExecutionsId: str, record: dict)
Receive chunk of raw records
POST /change-manager/jobExecutions/{jobExecutionsId}/records- Parameters
jobExecutionsId (str) –
record (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema that describes payload for receiving a chunk of raw records", "type": "object", "additionalProperties": false, "properties": { "id": { "description": "UUID", "$ref": "../../raml-util/schemas/uuid.schema" }, "initialRecords": { "description": "List of raw records", "type": "array", "items": { "type": "object", "$ref": "./rawRecordDto.json" } }, "recordsMetadata": { "description": "Metadata with info about records", "type": "object", "$ref": "./rawRecordsMetadata.json" } }, "required": [ "id", "recordsMetadata", "initialRecords" ] }