Search in sources :

Example 1 with ContributionRecord

use of org.ehrbase.jooq.pg.tables.records.ContributionRecord in project ehrbase by ehrbase.

the class FolderAccess method update.

// *************Data Access and modification methods*****************
/**
 * {@inheritDoc}
 */
@Override
public boolean update(final LocalDateTime transactionTime, UUID systemId, UUID committerId, String description, ContributionChangeType changeType) {
    /*create new contribution*/
    UUID oldContribution = this.folderRecord.getInContribution();
    UUID newContribution;
    // No custom contribution is provided, so create a new one
    UUID contributionAccessEhrId = this.contributionAccess.getEhrId();
    /*save the EHR id from oldContribution since it will be the same as this is an update operation*/
    if (this.contributionAccess.getEhrId() == null) {
        ContributionRecord rec = getContext().fetchOne(CONTRIBUTION, CONTRIBUTION.ID.eq(oldContribution));
        contributionAccessEhrId = rec.getEhrId();
    }
    this.contributionAccess.setEhrId(contributionAccessEhrId);
    this.contributionAccess.commit(Timestamp.valueOf(transactionTime), committerId, systemId, ContributionDataType.folder, ContributionDef.ContributionState.COMPLETE, changeType, description);
    this.getFolderRecord().setInContribution(this.contributionAccess.getId());
    newContribution = folderRecord.getInContribution();
    return this.internalUpdate(Timestamp.valueOf(transactionTime), true, null, oldContribution, newContribution, systemId, committerId, description, changeType);
}
Also used : ContributionRecord(org.ehrbase.jooq.pg.tables.records.ContributionRecord) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 ContributionRecord (org.ehrbase.jooq.pg.tables.records.ContributionRecord)1