return result;
}
- static public boolean setAuthorityItemDeprecated(DocumentModel docModel, String authorityItemCommonSchemaName, Boolean flag) throws Exception {
+ static public boolean setAuthorityItemDeprecated(ServiceContext ctx,
+ DocumentModel docModel, String authorityItemCommonSchemaName, Boolean flag) throws Exception {
boolean result = false;
docModel.setProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.DEPRECATED,
new Boolean(flag));
- CoreSessionInterface session = (CoreSessionInterface) docModel.getCoreSession();
- session.saveDocument(docModel);
+ CoreSessionInterface repoSession = (CoreSessionInterface) ctx.getCurrentRepositorySession();
+ repoSession.saveDocument(docModel);
result = true;
return result;
try {
DocumentModel docModel = NuxeoUtils.getDocFromCsid(ctx, (CoreSessionInterface)ctx.getCurrentRepositorySession(), itemCsid);
- result = setAuthorityItemDeprecated(docModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);
+ result = setAuthorityItemDeprecated(ctx, docModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED);
} catch (Exception e) {
logger.warn(String.format("Could not mark item '%s' as deprecated.", itemCsid), e);
throw e;
//
// This exception means we tried unsuccessfully to soft-delete (workflow transition 'delete') an item that still has references to it from other records.
//
- AuthorityServiceUtils.setAuthorityItemDeprecated(itemDocModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED); // Since we can't sof-delete it, we need to mark it as deprecated since it is soft-deleted on the SAS
+ AuthorityServiceUtils.setAuthorityItemDeprecated(ctx, itemDocModel, authorityItemCommonSchemaName, AuthorityServiceUtils.DEPRECATED); // Since we can't sof-delete it, we need to mark it as deprecated since it is soft-deleted on the SAS
logger.warn(String.format("Could not transition item CSID='%s' from workflow state '%s' to '%s'. Check the services log file for details.",
localItemCsid, localItemWorkflowState, sasWorkflowState));
}