csli.dialog.app.calo.browser
Class BrowserFeedbackServiceImpl

java.lang.Object
  extended by csli.dialog.app.calo.browser.BrowserFeedbackServiceImpl
All Implemented Interfaces:
Service, FeedbackService

public class BrowserFeedbackServiceImpl
extends Object
implements FeedbackService

An implementation of the browser feedback service which additionally starts a small HTTP server.

Author:
niekrasz

Constructor Summary
BrowserFeedbackServiceImpl()
          A default constructor.
 
Method Summary
 boolean addFeedback(String meetingId, String personId, String action, String actor, String property, String startTime, String endTime, String object, String id, String oldValue, String newValue)
           
 void addFeedbackBean(String meetingId, String personId, Document feedbackBean)
          Takes a feedback Java bean and converts to OPI format, then adds into the destination model, creating links to any references to objects in the source model.
static boolean addFeedbackBeansToOpi(ArrayList<Feedback> feedbackBeans, CslitopicaiOpi_1_0 sourceModel, CslitopicaiOpi_1_0 destModel)
          Takes an array of feedback Java beans, converts these to OPI format and adds them into the destination model , and creating links to any references to objects that are in the source model.
 void addFeedbacks(String meetingId, String personId, ArrayList<Feedback> feedbacks)
          Take feedback data that a user has provided on the most recent hypotheses over a particular meeting and save it to the KB -- this will overwrite any feedback data previously saved for that hypothesis and meeting so be sure that you have integrated any prevously existing feedback using a call to getMostRecentFeedbacks().
static boolean addFeedbackToOpi(ArrayList<Feedback> feedbackBeans, CslitopicaiOpi_1_0 sourceModel, CslitopicaiOpi_1_0 destModel)
          Takes a feedback, converts to OPI format and adds to destination model, creating links to any references to objects that are in the source model.
 void addHypsAsNotes(CslitopicaiOpi_1_0 destModel, String meetingId, String persId, CslitopicaiOpi_1_0 aiOpi)
          Takes a set of action item hypotheses and creates an agenda item containing all the hyps as notes entries.
 void addLogMessage(String meetingId, String personId)
          Print a log message to the text area.
static void addMainNotesObject(CslitopicaiOpi_1_0 destModel, CorporaOpi_2_0.NOMOSMeeting meeting)
          Creates a main meeting notes object in the destination model for the given meeting.
 boolean cacheTranscript(String meetingId)
          Retrieve the utterances and sort them by start time
 Document convertFeedbackToBean(String action, String actor, String propertyType, String startTime, String endTime, String object, String id, String oldValue, String newValue)
          Takes a number of String parameters for a feedback action and converts them to a feedback Java bean (an XML Document), for conversion to OPI format.
 void createActionItemHyp(String meetingId, String start, String end, String description, String timeframe, String owner, String agree)
          Creates an action item in the latest ai hyp model for a particular meeting, setting properties specified by text
static Document extractSmartnotesXmlFromOpi(CslitopicaiOpi_1_0 opi)
          Takes an OPI model containing a meeting notes object and converts it to a smartnotes XML document.
 Document getBrowserContent(String meetingId, String personId)
          Collects the AI hyps, notes, and any browser feedback, and interprets this into the most recent state of the meeting notes.
 JPanel getGui()
          Get a Swing JPanel which provides a GUI to this service.
static CslitopicaiOpi_1_0.NOMOSMeeting getMeeting(CslitopicaiOpi_1_0 destModel, String meetingId)
          Get the meeting object with the specified alt ID from the specified model.
static File getMeetingDir(String meetingID)
           
 String getMeetingList(String personId)
          Get an XML list of available meetings for a particular user.
 String getParticipantsForMeeting(String meetingId)
          Returns a String of XML listing all participants in a meeting
 String getParticipantsList()
          Get an XML list of available users.
 String getTitle()
          Get the name of this service as it should appear in the GUI.
 Document getTodoContent(String meetingId, String personId)
          Returns a DOM document which contains only the action items which would normally be in the browser content.
 Document getTodoContentAsEvents(String meetingId, String personId, boolean printToFile)
          Returns an XML version of the action items from browser content, for use in Simile timeline display
 String getTodoContentAsICal(String meetingId, String personId)
          Returns a String in iCal format which contains the action items from browser content, for use by TOWEL Todo system.
 String getTranscript(String meetingId, long startMillis, long endMillis)
          Get the (1-best) transcript of utterances between (overlapping with) a given start & end time
 boolean hasCachedTranscript(String meetingId)
          Returns a boolean for whether a transcript of utterances has been cached for a particular meeting
 boolean isServiceAlive()
          Is the service happy and alive?
static void processEntryFields(Document result, CslitopicaiOpi_1_0.NOMOSMeeting meeting, Element itemNode, CslitopicaiOpi_1_0.MbEntry entry)
          Process the entry fields of an OPI entry, creating the XML document nodes for it.
 void retrain(String meetingId, String personId)
          Tell any supporting training algorithms to train/retrain given the latest available feedback data for a particular meeting and person.
 boolean setTasksAsICal(String personId, String setterId, String iCalTasks)
          Provide information about the contents of a person's task (to-do) list, for use as implicit supervision
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrowserFeedbackServiceImpl

public BrowserFeedbackServiceImpl()
A default constructor.

Method Detail

addFeedbackBeansToOpi

public static boolean addFeedbackBeansToOpi(ArrayList<Feedback> feedbackBeans,
                                            CslitopicaiOpi_1_0 sourceModel,
                                            CslitopicaiOpi_1_0 destModel)
Takes an array of feedback Java beans, converts these to OPI format and adds them into the destination model , and creating links to any references to objects that are in the source model.

All objects referred in the object or property fields of the feedback beans must be in the source model, or an error will occur.

Parameters:
feedbackBeans - the beans to convert
sourceModel - the model containing any referenced entities
destModel - the model in which to put the newly converted OPI feedback event objects
Returns:
a boolean describing whether or not the operation was successfully performed

addFeedbackToOpi

public static boolean addFeedbackToOpi(ArrayList<Feedback> feedbackBeans,
                                       CslitopicaiOpi_1_0 sourceModel,
                                       CslitopicaiOpi_1_0 destModel)
Takes a feedback, converts to OPI format and adds to destination model, creating links to any references to objects that are in the source model.

All objects referred in the object or property fields of the feedback beans must be in the source model, or an error will occur.

Parameters:
feedbackBeans - the beans to convert
sourceModel - the model containing any referenced entities
destModel - the model in which to put the newly converted OPI feedback event objects
Returns:
a boolean describing whether or not the operation was successfully performed

getMeetingDir

public static File getMeetingDir(String meetingID)

extractSmartnotesXmlFromOpi

public static Document extractSmartnotesXmlFromOpi(CslitopicaiOpi_1_0 opi)
Takes an OPI model containing a meeting notes object and converts it to a smartnotes XML document.

If the opi is null, this will return an empty Document. If it is not null, but does not contain any notes objects, it returns a document with a single smartnotes tag.

Parameters:
opi - the opi containing the notes object
Returns:

processEntryFields

public static void processEntryFields(Document result,
                                      CslitopicaiOpi_1_0.NOMOSMeeting meeting,
                                      Element itemNode,
                                      CslitopicaiOpi_1_0.MbEntry entry)
Process the entry fields of an OPI entry, creating the XML document nodes for it.

Parameters:
result - the document from which to create the new nodes
meeting - the meeting from which to get the meeting info
itemNode - the item node to which the sub properties should be added
entry - the source OPI entry to get the data from

addFeedbacks

public void addFeedbacks(String meetingId,
                         String personId,
                         ArrayList<Feedback> feedbacks)
Description copied from interface: FeedbackService
Take feedback data that a user has provided on the most recent hypotheses over a particular meeting and save it to the KB -- this will overwrite any feedback data previously saved for that hypothesis and meeting so be sure that you have integrated any prevously existing feedback using a call to getMostRecentFeedbacks().

In the CALO framework, this will send the latest interpretation of the feedback to IRIS, but in NOMOS it will just add the feedback to the feedback model.

Specified by:
addFeedbacks in interface FeedbackService
Parameters:
meetingId - the alternate (short) ID of the meeting
personId - the alternate (short) ID of the person

addFeedbackBean

public void addFeedbackBean(String meetingId,
                            String personId,
                            Document feedbackBean)
Takes a feedback Java bean and converts to OPI format, then adds into the destination model, creating links to any references to objects in the source model.

All objects referred in the object or property fields of the feedback beans must be in the source model, or an error will occur.

Specified by:
addFeedbackBean in interface FeedbackService
Parameters:
feedbackBean - the beans to convert
sourceModel - the model containing any referenced entities
destModel - the model in which to put the newly converted OPI feedback event object

addHypsAsNotes

public void addHypsAsNotes(CslitopicaiOpi_1_0 destModel,
                           String meetingId,
                           String persId,
                           CslitopicaiOpi_1_0 aiOpi)
Takes a set of action item hypotheses and creates an agenda item containing all the hyps as notes entries.

Parameters:
destModel -
meetingId -
persId -

addLogMessage

public void addLogMessage(String meetingId,
                          String personId)
Print a log message to the text area.

Parameters:
meetingId -
personId -

addMainNotesObject

public static void addMainNotesObject(CslitopicaiOpi_1_0 destModel,
                                      CorporaOpi_2_0.NOMOSMeeting meeting)
Creates a main meeting notes object in the destination model for the given meeting.

Parameters:
destModel - the model in which to put the new feedback events
meeting - the meeting to base the info on

getBrowserContent

public Document getBrowserContent(String meetingId,
                                  String personId)
Description copied from interface: FeedbackService
Collects the AI hyps, notes, and any browser feedback, and interprets this into the most recent state of the meeting notes.

If there are no AI hyps, this will return an almost-empty XML document with only the smartnotes tag with nothing in it. If there is an error during processing, this will return a valid but empty XML document.

Specified by:
getBrowserContent in interface FeedbackService
Parameters:
meetingId - the alternate (short) ID of the meeting
personId - the alternate (short) ID of the person
Returns:
SmartNotes formatted XML

getMeetingList

public String getMeetingList(String personId)
Get an XML list of available meetings for a particular user.

Specified by:
getMeetingList in interface FeedbackService
Parameters:
personId -
Returns:

getParticipantsList

public String getParticipantsList()
Get an XML list of available users.

Specified by:
getParticipantsList in interface FeedbackService
Parameters:
personId -
Returns:

getParticipantsForMeeting

public String getParticipantsForMeeting(String meetingId)
Description copied from interface: FeedbackService
Returns a String of XML listing all participants in a meeting

Specified by:
getParticipantsForMeeting in interface FeedbackService
Parameters:
meetingId - the alternate (short) ID of the meeting
Returns:
A string of a flat XML tree listing one user (participant) per node

hasCachedTranscript

public boolean hasCachedTranscript(String meetingId)
Description copied from interface: FeedbackService
Returns a boolean for whether a transcript of utterances has been cached for a particular meeting

Specified by:
hasCachedTranscript in interface FeedbackService
Parameters:
meetingId -
Returns:
true if the transcript for this meeting has been cached via cacheTranscript()

cacheTranscript

public boolean cacheTranscript(String meetingId)
Retrieve the utterances and sort them by start time

Specified by:
cacheTranscript in interface FeedbackService
Parameters:
meetingId -
Returns:
A boolean for when caching is completed

getTranscript

public String getTranscript(String meetingId,
                            long startMillis,
                            long endMillis)
Get the (1-best) transcript of utterances between (overlapping with) a given start & end time

Specified by:
getTranscript in interface FeedbackService
Parameters:
meetingId -
start -
end -
Returns:
XML representation of transcript

getMeeting

public static CslitopicaiOpi_1_0.NOMOSMeeting getMeeting(CslitopicaiOpi_1_0 destModel,
                                                         String meetingId)
Get the meeting object with the specified alt ID from the specified model.

Parameters:
destModel -
meetingId -
Returns:

getTitle

public String getTitle()
Description copied from interface: Service
Get the name of this service as it should appear in the GUI.

Specified by:
getTitle in interface Service

getTodoContent

public Document getTodoContent(String meetingId,
                               String personId)
Returns a DOM document which contains only the action items which would normally be in the browser content. This is to be used to serve content to the TOWEL Todo system.

Specified by:
getTodoContent in interface FeedbackService
Parameters:
meetingID -
personId -
Returns:

getTodoContentAsICal

public String getTodoContentAsICal(String meetingId,
                                   String personId)
Description copied from interface: FeedbackService
Returns a String in iCal format which contains the action items from browser content, for use by TOWEL Todo system.

Specified by:
getTodoContentAsICal in interface FeedbackService
personId - the alternate (short) ID of the person
Returns:
an iCal text String

getTodoContentAsEvents

public Document getTodoContentAsEvents(String meetingId,
                                       String personId,
                                       boolean printToFile)
Description copied from interface: FeedbackService
Returns an XML version of the action items from browser content, for use in Simile timeline display

Specified by:
getTodoContentAsEvents in interface FeedbackService
personId - the alternate (short) ID of the person
printToFile - flag to write timeline xml contents to file on disk
Returns:
Simile formatted XML

createActionItemHyp

public void createActionItemHyp(String meetingId,
                                String start,
                                String end,
                                String description,
                                String timeframe,
                                String owner,
                                String agree)
Creates an action item in the latest ai hyp model for a particular meeting, setting properties specified by text

Parameters:
meetingID -
start -
end -
description -
timeframe -
owner -
agree -

setTasksAsICal

public boolean setTasksAsICal(String personId,
                              String setterId,
                              String iCalTasks)
Description copied from interface: FeedbackService
Provide information about the contents of a person's task (to-do) list, for use as implicit supervision

Specified by:
setTasksAsICal in interface FeedbackService
Parameters:
personId - the alternate (short) ID of the person
setterId - a string which identifies the agent doing the setting (e.g. "TOWEL")
iCalTasks - an iCal-format String
Returns:
false on error, true otherwise

getGui

public JPanel getGui()
Description copied from interface: Service
Get a Swing JPanel which provides a GUI to this service.

Specified by:
getGui in interface Service

isServiceAlive

public boolean isServiceAlive()
Description copied from interface: Service
Is the service happy and alive?

Specified by:
isServiceAlive in interface Service
Returns:

retrain

public void retrain(String meetingId,
                    String personId)
Description copied from interface: FeedbackService
Tell any supporting training algorithms to train/retrain given the latest available feedback data for a particular meeting and person.

Specified by:
retrain in interface FeedbackService
Parameters:
meetingId - the alternate (short) ID of the meeting
personId - the alternate (short) ID of the person

addFeedback

public boolean addFeedback(String meetingId,
                           String personId,
                           String action,
                           String actor,
                           String property,
                           String startTime,
                           String endTime,
                           String object,
                           String id,
                           String oldValue,
                           String newValue)

convertFeedbackToBean

public Document convertFeedbackToBean(String action,
                                      String actor,
                                      String propertyType,
                                      String startTime,
                                      String endTime,
                                      String object,
                                      String id,
                                      String oldValue,
                                      String newValue)
Takes a number of String parameters for a feedback action and converts them to a feedback Java bean (an XML Document), for conversion to OPI format.

Specified by:
convertFeedbackToBean in interface FeedbackService
Parameters:
action - the type feedback action either an ObjectAction: CreateAction, ConfirmAction, DeleteAction, EquivalenceAction, NotMineAction or, a PropertyValueAction: PropertyValueAddAction, PropertyValueRemoveAction, PropertyValueChangeAction
actor - the individual performing the feedback
propertyType - for feedback on properties, the type of object property for which feedback is being given one of: NOMOS-description, CsliAITimeframe, CsliAIOwnerDescription, CsliAIOwnerId
startTime - start time of feedback in milliseconds as string
endTime - end time of feedback in milliseconds as string
object - the opiId for the note on which feedback is being given
id - the opiId for the note on which feedback is being given
oldValue - for PropertyValueChangeAction or PropertyValueRemoveAction, the old value of the property
newValue - for PropertyValueChangeAction or PropertyValueAddAction, the new value of the property
Returns:
a boolean describing whether or not the operation was successfully performed