protected String getReceiverID(Task task) { String receiverID; Object receiver = task.getPrepositionalPhrase(Constants.Preposition.FOR); if (receiver != null) receiver = ((PrepositionalPhrase) receiver).getIndirectObject(); // Add field with recipient if (receiver == null) { receiverID = UNKNOWN; _gp.getLoggingService() .error("Filler.addContentsInfo - Task " + task.getUID() + " had no FOR prep."); } else if (receiver instanceof String) { receiverID = (String) receiver; } else if (!(receiver instanceof Asset)) { receiverID = UNKNOWN; } else { ItemIdentificationPG itemIdentificationPG = ((Asset) receiver).getItemIdentificationPG(); if ((itemIdentificationPG == null) || (itemIdentificationPG.getItemIdentification() == null) || (itemIdentificationPG.getItemIdentification().equals(""))) { receiverID = UNKNOWN; } else { receiverID = itemIdentificationPG.getItemIdentification(); } } return receiverID; }
/** * Process "Start_publishing_Cmd" task .It update internal data structure for kind of sensor data * user has requested for. * * @param publichcmdlist Enumeration on Collection of newly Start_publishing_Cmd * @see org.cougaar.core.security.oldmonitoring.util.PublishCmdObj */ protected void process_publishCmd(Enumeration publichcmdlist) { PublishCmdObj pcmd; for (; publichcmdlist.hasMoreElements(); ) { Task tsk = (Task) publichcmdlist.nextElement(); PrepositionalPhrase pp = tsk.getPrepositionalPhrase(MonitoringUtils.Start_publishing_Preposition); if (pp != null) { pcmd = (PublishCmdObj) pp.getIndirectObject(); if (!currentlypublishing.contains(pcmd.Type)) { currentlypublishing.add(pcmd.Type); if (MonitoringUtils.debug > 0) System.out.println( "In sensor Plugin process_publishCmd Add ::::::::" + pcmd.Type + " to current publishing list"); } } } }