Skip to content

Commit

Permalink
#3944 - Ability to use recommenders as curator
Browse files Browse the repository at this point in the history
- Rename methods and variables to better reflect the separation between session owner and document owner
  • Loading branch information
reckart committed Apr 16, 2023
1 parent 5723a03 commit d7c6741
Show file tree
Hide file tree
Showing 40 changed files with 169 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ public void onSpanCreated(SpanCreatedEvent aEvent)
}

// Does event match the current active learning configuration?
if (!aEvent.getUser().equals(getModelObject().getUser().getUsername())
if (!aEvent.getDocumentOwner().equals(getModelObject().getUser().getUsername())
|| !aEvent.getLayer().equals(alState.getLayer())) {
return;
}
Expand All @@ -1090,7 +1090,7 @@ public void onRelationCreated(RelationCreatedEvent aEvent)
}

// Does event match the current active learning configuration?
if (!aEvent.getUser().equals(getModelObject().getUser().getUsername())
if (!aEvent.getDocumentOwner().equals(getModelObject().getUser().getUsername())
|| !aEvent.getLayer().equals(alState.getLayer())) {
return;
}
Expand Down Expand Up @@ -1119,7 +1119,7 @@ public void onFeatureValueUpdated(FeatureValueUpdatedEvent aEvent)
}

// Does event match the current active learning configuration?
if (!aEvent.getUser().equals(getModelObject().getUser().getUsername())
if (!aEvent.getDocumentOwner().equals(getModelObject().getUser().getUsername())
|| !aEvent.getFeature().getLayer().equals(alState.getLayer())
|| !aEvent.getFeature().getName()
.equals(alState.getSuggestion().get().getFeature())) {
Expand Down Expand Up @@ -1148,7 +1148,7 @@ public void onAnnotationDeleted(SpanDeletedEvent aEvent)
}

// Does event match the current active learning configuration?
if (!aEvent.getUser().equals(getModelObject().getUser().getUsername())
if (!aEvent.getDocumentOwner().equals(getModelObject().getUser().getUsername())
|| !aEvent.getLayer().equals(alState.getLayer())) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface AnnotationCreatedEvent
{
SourceDocument getDocument();

String getUser();
String getDocumentOwner();

AnnotationLayer getLayer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface AnnotationDeletedEvent
{
SourceDocument getDocument();

String getUser();
String getDocumentOwner();

AnnotationLayer getLayer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,25 @@ public abstract class AnnotationEvent

private final Project project;
private final SourceDocument document;
private final String user;
private final String documentOwner;
private final AnnotationLayer layer;

public AnnotationEvent(Object aSource, Project aProject, String aUser, AnnotationLayer aLayer)
public AnnotationEvent(Object aSource, Project aProject, String aDocumentOwner,
AnnotationLayer aLayer)
{
this(aSource, aProject, null, aUser, aLayer);
this(aSource, aProject, null, aDocumentOwner, aLayer);
}

public AnnotationEvent(Object aSource, SourceDocument aDocument, String aUser,
public AnnotationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer)
{
this(aSource, aDocument != null ? aDocument.getProject() : null, aDocument, aUser, aLayer);
this(aSource, aDocument != null ? aDocument.getProject() : null, aDocument, aDocumentOwner,
aLayer);

Validate.notNull(getProject(), "Project must be specified");
Validate.notNull(getDocument(), "Document must be specified");
Validate.notNull(getLayer(), "Layer must be specified");
Validate.notNull(getUser(), "User must be specified");
Validate.notNull(getDocumentOwner(), "User must be specified");
}

public AnnotationEvent(Object aSource, SourceDocument aDocument, String aUser)
Expand All @@ -59,16 +61,16 @@ public AnnotationEvent(Object aSource, SourceDocument aDocument, String aUser)

Validate.notNull(getProject(), "Project must be specified");
Validate.notNull(getDocument(), "Document must be specified");
Validate.notNull(getUser(), "User must be specified");
Validate.notNull(getDocumentOwner(), "Document owner must be specified");
}

private AnnotationEvent(Object aSource, Project aProject, SourceDocument aDocument,
String aUser, AnnotationLayer aLayer)
String aDocumentOwner, AnnotationLayer aLayer)
{
super(aSource);
project = aProject;
document = aDocument;
user = aUser;
documentOwner = aDocumentOwner;
layer = aLayer;
}

Expand All @@ -82,9 +84,9 @@ public SourceDocument getDocument()
return document;
}

public String getUser()
public String getDocumentOwner()
{
return user;
return documentOwner;
}

public AnnotationLayer getLayer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public class BeforeDocumentOpenedEvent
private final CAS cas;
private final SourceDocument document;
// user who owns/annotates the opened document
private final String annotator;
private final String documentOwner;
// user who opened the document
private final String opener;
private final String sessionOwner;
private final boolean editable;

public BeforeDocumentOpenedEvent(Object aSource, CAS aCas, SourceDocument aDocument,
String aAnnotator, String aOpener, boolean aEditable)
String aDocumentOwner, String aSessionOwner, boolean aEditable)
{
super(aSource);
cas = aCas;
document = aDocument;
annotator = aAnnotator;
opener = aOpener;
documentOwner = aDocumentOwner;
sessionOwner = aSessionOwner;
editable = aEditable;
}

Expand All @@ -61,14 +61,14 @@ public SourceDocument getDocument()
return document;
}

public String getUser()
public String getSessionOwner()
{
return opener;
return sessionOwner;
}

public String getAnnotator()
public String getDocumentOwner()
{
return annotator;
return documentOwner;
}

public boolean isEditable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ public class BulkAnnotationEvent
{
private static final long serialVersionUID = -1187536069360130349L;

public BulkAnnotationEvent(Object aSource, Project aProject, String aUser,
public BulkAnnotationEvent(Object aSource, Project aProject, String aDocumentOwner,
AnnotationLayer aLayer)
{
super(aSource, aProject, aUser, aLayer);
super(aSource, aProject, aDocumentOwner, aLayer);
}

public BulkAnnotationEvent(Object aSource, SourceDocument aDocument, String aUser,
public BulkAnnotationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer)
{
super(aSource, aDocument, aUser, aLayer);
super(aSource, aDocument, aDocumentOwner, aLayer);
}

public BulkAnnotationEvent(Object aSource, SourceDocument aDocument, String aUser)
public BulkAnnotationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner)
{
super(aSource, aDocument, aUser);
super(aSource, aDocument, aDocumentOwner);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ public class DocumentOpenedEvent
private final CAS cas;
private final SourceDocument document;
// user who owns/annotates the opened document
private final String annotator;
private final String documentOwner;
// user who opened the document
private final String opener;
private final String sessionOwner;
private final AnnotationDocumentState stateBeforeOpening;

public DocumentOpenedEvent(Object aSource, CAS aCas, SourceDocument aDocument,
AnnotationDocumentState aStateBeforeOpening, String aAnnotator, String aOpener)
AnnotationDocumentState aStateBeforeOpening, String aDocumentOwner,
String aSessionOwner)
{
super(aSource);
cas = aCas;
document = aDocument;
annotator = aAnnotator;
opener = aOpener;
documentOwner = aDocumentOwner;
sessionOwner = aSessionOwner;
stateBeforeOpening = aStateBeforeOpening;
}

Expand All @@ -59,14 +60,14 @@ public SourceDocument getDocument()
return document;
}

public String getUser()
public String getSessionOwner()
{
return opener;
return sessionOwner;
}

public String getAnnotator()
public String getDocumentOwner()
{
return annotator;
return documentOwner;
}

public AnnotationDocumentState getStateBeforeOpening()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public String toString()
builder.append("docID=");
builder.append(getDocument());
builder.append(", user=");
builder.append(getUser());
builder.append(getDocumentOwner());
builder.append(", ");
}
builder.append("addr=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public AnnotationFS handle(CreateSpanAnnotationRequest aRequest) throws Annotati

AnnotationFS newSpan = createChainElementAnnotation(request);

publishEvent(new ChainSpanCreatedEvent(this, aRequest.getDocument(), aRequest.getUsername(),
publishEvent(new ChainSpanCreatedEvent(this, aRequest.getDocument(), aRequest.getDocumentOwner(),
getLayer(), newSpan));

return newSpan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public String toString()
builder.append("docID=");
builder.append(getDocument().getId());
builder.append(", user=");
builder.append(getUser());
builder.append(getDocumentOwner());
builder.append(", ");
}
builder.append("element=[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ public class RelationCreatedEvent
{
private static final long serialVersionUID = 1729547025986959164L;

public RelationCreatedEvent(Object aSource, SourceDocument aDocument, String aUser,
public RelationCreatedEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer, AnnotationFS aRelationFS, AnnotationFS aTargetAnnotation,
AnnotationFS aSourceAnnotation)
{
super(aSource, aDocument, aUser, aLayer, aRelationFS, aTargetAnnotation, aSourceAnnotation);
super(aSource, aDocument, aDocumentOwner, aLayer, aRelationFS, aTargetAnnotation,
aSourceAnnotation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public class RelationDeletedEvent
{
private static final long serialVersionUID = -3212535102141634478L;

public RelationDeletedEvent(Object aSource, SourceDocument aDocument, String aUser,
public RelationDeletedEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer, AnnotationFS aRelationFS, AnnotationFS aTargetAnnotation,
AnnotationFS aSourceAnnotation)
{
super(aSource, aDocument, aUser, aLayer, aRelationFS, aTargetAnnotation, aSourceAnnotation);
super(aSource, aDocument, aDocumentOwner, aLayer, aRelationFS, aTargetAnnotation, aSourceAnnotation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public abstract class RelationEvent
private final AnnotationFS targetAnno;
private final AnnotationFS sourceAnno;

public RelationEvent(Object aSource, SourceDocument aDocument, String aUser,
public RelationEvent(Object aSource, SourceDocument aDocument, String aDocumentOwner,
AnnotationLayer aLayer, AnnotationFS aRelationFS, AnnotationFS aTargetAnnotation,
AnnotationFS aSourceAnnotation)
{
super(aSource, aDocument, aUser, aLayer);
super(aSource, aDocument, aDocumentOwner, aLayer);

relation = aRelationFS;
targetAnno = aTargetAnnotation;
Expand Down Expand Up @@ -76,8 +76,8 @@ public String toString()
if (getDocument() != null) {
builder.append("docID=");
builder.append(getDocument());
builder.append(", user=");
builder.append(getUser());
builder.append(", docOwner=");
builder.append(getDocumentOwner());
builder.append(", ");
}
builder.append("relation=[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
public class CreateSpanAnnotationRequest
extends SpanAnnotationRequest_ImplBase<CreateSpanAnnotationRequest>
{
public CreateSpanAnnotationRequest(SourceDocument aDocument, String aUsername, CAS aCas,
public CreateSpanAnnotationRequest(SourceDocument aDocument, String aDocumentOwner, CAS aCas,
int aBegin, int aEnd)
{
this(null, aDocument, aUsername, aCas, aBegin, aEnd);
this(null, aDocument, aDocumentOwner, aCas, aBegin, aEnd);
}

private CreateSpanAnnotationRequest(CreateSpanAnnotationRequest aOriginal,
SourceDocument aDocument, String aUsername, CAS aCas, int aBegin, int aEnd)
SourceDocument aDocument, String aDocumentOwner, CAS aCas, int aBegin, int aEnd)
{
super(null, aDocument, aUsername, aCas, aBegin, aEnd);
super(null, aDocument, aDocumentOwner, aCas, aBegin, aEnd);
}

@Override
public CreateSpanAnnotationRequest changeSpan(int aBegin, int aEnd)
{
return new CreateSpanAnnotationRequest(this, getDocument(), getUsername(), getCas(), aBegin,
return new CreateSpanAnnotationRequest(this, getDocument(), getDocumentOwner(), getCas(), aBegin,
aEnd);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public class MoveSpanAnnotationRequest
{
private final AnnotationFS annotation;

public MoveSpanAnnotationRequest(SourceDocument aDocument, String aUsername, CAS aCas,
public MoveSpanAnnotationRequest(SourceDocument aDocument, String aDocumentOwner, CAS aCas,
AnnotationFS aAnnotation, int aBegin, int aEnd)
{
this(null, aDocument, aUsername, aCas, aAnnotation, aBegin, aEnd);
this(null, aDocument, aDocumentOwner, aCas, aAnnotation, aBegin, aEnd);
}

private MoveSpanAnnotationRequest(MoveSpanAnnotationRequest aOriginal, SourceDocument aDocument,
String aUsername, CAS aCas, AnnotationFS aAnnotation, int aBegin, int aEnd)
String aDocumentOwner, CAS aCas, AnnotationFS aAnnotation, int aBegin, int aEnd)
{
super(null, aDocument, aUsername, aCas, aBegin, aEnd);
super(null, aDocument, aDocumentOwner, aCas, aBegin, aEnd);
annotation = aAnnotation;
}

Expand All @@ -48,7 +48,7 @@ public AnnotationFS getAnnotation()
@Override
public MoveSpanAnnotationRequest changeSpan(int aBegin, int aEnd)
{
return new MoveSpanAnnotationRequest(this, getDocument(), getUsername(), getCas(),
return new MoveSpanAnnotationRequest(this, getDocument(), getDocumentOwner(), getCas(),
getAnnotation(), aBegin, aEnd);
}
}

0 comments on commit d7c6741

Please sign in to comment.