Beispiel #1
0
  /**
   * @param eventKey
   * @return com.cisco.eManager.common.event.AbstractEventMessage
   * @roseuid 3F2E6ECD03AF
   */
  public EmanagerEventDetails getEventDetails(ManagedObjectId eventId)
      throws EmanagerDatabaseException, EmanagerEventException {
    Iterator iter;
    Collection events;
    EventSearchCriteria criteria;

    if (eventId.getManagedObjectType() != ManagedObjectIdType.Event) {
      EmanagerEventException e;

      e =
          new EmanagerEventException(
              EmanagerEventStatusCode.MalformedEventObjectId,
              EmanagerEventStatusCode.MalformedEventObjectId.getStatusCodeDescription()
                  + eventId.toString());
      throw e;
    }

    criteria = new EventSearchCriteria();
    criteria.setEmanagerEventId(
        new NumericSearchCriteria(
            new Long(eventId.getManagedObjectKey()), new Long(eventId.getManagedObjectKey())));

    events = DatabaseInterface.instance().retrieveEvents(criteria);

    if (events.size() == 0) {
      return null;
    }

    iter = events.iterator();
    return (EmanagerEventDetails) iter.next();
  }
Beispiel #2
0
  /**
   * @param eventMessage
   * @return com.cisco.eManager.common.event.EmanagerEventMessage
   * @roseuid 3F2E6F8A00CC
   */
  public synchronized EmanagerEventDetails addEvent(AbstractEventMessage eventMessage)
      throws EmanagerDatabaseException, EmanagerEventException {
    ManagedObjectId eventObjectId;
    EmanagerEventDetails eventDetails;

    eventDetails = null;
    eventObjectId = DatabaseInterface.instance().createEvent(eventMessage);

    if (eventMessage instanceof EmanagerEventMessage) {
      EmanagerEventMessage emanagerEventMessage = (EmanagerEventMessage) eventMessage;
      eventDetails =
          new EmanagerEventDetails(
              eventObjectId.getManagedObjectKey(),
              emanagerEventMessage.getEventTime(),
              (Date) null,
              emanagerEventMessage.getSeverity(),
              emanagerEventMessage.getManagedObjectId(),
              (EventAcknowledgement) null,
              emanagerEventMessage.getDisplayText());
    } else if (eventMessage instanceof TibcoEventMessage) {
      ManagedObjectId associatedManagedObjectId = null;
      TibcoEventMessage tibcoEventMessage = (TibcoEventMessage) eventMessage;

      eventDetails =
          new TibcoEventDetails(
              eventObjectId.getManagedObjectKey(),
              tibcoEventMessage.getEventTime(),
              (Date) null,
              tibcoEventMessage.getSeverity(),
              tibcoEventMessage.getManagedObjectId(),
              (EventAcknowledgement) null,
              tibcoEventMessage.getTibcoEventId(),
              tibcoEventMessage.getRuleText(),
              tibcoEventMessage.getRuleTestText(),
              tibcoEventMessage.getMicroagentId().name(),
              tibcoEventMessage.getManagementPolicyManagedObjectId(),
              tibcoEventMessage.getDisplayText());
    } else if (eventMessage instanceof ProcessSequencerEventMessage) {
      ProcessSequencerEventMessage psEventMessage = (ProcessSequencerEventMessage) eventMessage;
      eventDetails =
          new ProcessSequencerEventDetails(
              eventObjectId.getManagedObjectKey(),
              psEventMessage.getEventTime(),
              (Date) null,
              psEventMessage.getSeverity(),
              psEventMessage.getManagedObjectId(),
              (EventAcknowledgement) null,
              psEventMessage.getDisplayText(),
              psEventMessage.getProcessSequencerEventId());
    } else {
      EmanagerEventException e;

      e =
          new EmanagerEventException(
              EmanagerEventStatusCode.UnknownEventMessageType,
              EmanagerEventStatusCode.UnknownEventMessageType.getStatusCodeDescription()
                  + eventMessage.getClass().getName());
      throw e;
    }

    return eventDetails;
  }