Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit module (Change Tracking) #3879

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
import edu.cornell.mannlib.vitro.webapp.dao.NewURIMakerVitro;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.N3EditUtils;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames;
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeSet;
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
Expand Down Expand Up @@ -391,7 +392,7 @@ protected ResponseValues processRequest(VitroRequest vreq) {
}

// Finished processing confirmation, write the differences between the existing and updated model
writeChanges(vreq.getRDFService(), existingModel, updatedModel);
writeChanges(vreq.getRDFService(), existingModel, updatedModel, N3EditUtils.getEditorUri(vreq));
}

// Get any IDs that have not yet been processed from the form
Expand Down Expand Up @@ -1815,8 +1816,9 @@ protected boolean isResourceOfType(Resource resource, String typeUri) {
* @param rdfService
* @param existingModel
* @param updatedModel
* @param editroUri
*/
protected void writeChanges(RDFService rdfService, Model existingModel, Model updatedModel) {
protected void writeChanges(RDFService rdfService, Model existingModel, Model updatedModel, String editorUri) {
Model removeModel = existingModel.difference(updatedModel);
Model addModel = updatedModel.difference(existingModel);

Expand All @@ -1829,12 +1831,12 @@ protected void writeChanges(RDFService rdfService, Model existingModel, Model up

if (!addModel.isEmpty()) {
addStream = makeN3InputStream(addModel);
changeSet.addAddition(addStream, RDFService.ModelSerializationFormat.N3, ModelNames.ABOX_ASSERTIONS);
changeSet.addAddition(addStream, RDFService.ModelSerializationFormat.N3, ModelNames.ABOX_ASSERTIONS, editorUri);
}

if (!removeModel.isEmpty()) {
removeStream = makeN3InputStream(removeModel);
changeSet.addRemoval(removeStream, RDFService.ModelSerializationFormat.N3, ModelNames.ABOX_ASSERTIONS);
changeSet.addRemoval(removeStream, RDFService.ModelSerializationFormat.N3, ModelNames.ABOX_ASSERTIONS, editorUri);
}

try {
Expand Down
12 changes: 12 additions & 0 deletions home/src/main/resources/config/example.applicationSetup.n3
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,22 @@
:hasSearchIndexer :basicSearchIndexer ;
:hasImageProcessor :iioImageProcessor ;
:hasFileStorage :ptiFileStorage ;
# :hasAuditModule :tdbAuditModule ;
:hasContentTripleSource :tdbContentTripleSource ;
:hasConfigurationTripleSource :tdbConfigurationTripleSource ;
:hasTBoxReasonerModule :jfactTBoxReasonerModule .

# ----------------------------
#
# Audit module:
#

#:tdbAuditModule
# a <java:edu.cornell.mannlib.vitro.webapp.audit.TDBAuditModule> ,
# <java:edu.cornell.mannlib.vitro.webapp.audit.AuditModule> ;
# :hasTdbDirectory "tdbAuditModels" .


# ----------------------------
#
# Image processor module:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ edu.cornell.mannlib.vitro.webapp.controller.individual.VIVOIndividualResponseBui

# This should be near the end, because it will issue a warning if the connection to the SearchEngine times out.
edu.cornell.mannlib.vitro.webapp.servlet.setup.SearchEngineSmokeTest

edu.cornell.mannlib.vitro.webapp.audit.AuditSetup

Loading