use of org.hisp.dhis.program.ProgramTempOwner in project dhis2-core by dhis2.
the class DefaultTrackerOwnershipManager method grantTemporaryOwnership.
@Override
@Transactional
public void grantTemporaryOwnership(TrackedEntityInstance entityInstance, Program program, User user, String reason) {
if (canSkipOwnershipCheck(user, program) || entityInstance == null) {
return;
}
if (program.isProtected()) {
if (config.isEnabled(CHANGELOG_TRACKER)) {
programTempOwnershipAuditService.addProgramTempOwnershipAudit(new ProgramTempOwnershipAudit(program, entityInstance, reason, user.getUsername()));
}
ProgramTempOwner programTempOwner = new ProgramTempOwner(program, entityInstance, reason, user, TEMPORARY_OWNERSHIP_VALIDITY_IN_HOURS);
programTempOwnerService.addProgramTempOwner(programTempOwner);
tempOwnerCache.invalidate(getTempOwnershipCacheKey(entityInstance.getUid(), program.getUid(), user.getUid()));
}
}
Aggregations