org.sakaiproject.event.api.Event.getEvent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.sakaiproject.event.api.Event.getEvent()方法的一些代码示例,展示了Event.getEvent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getEvent()方法的具体详情如下:
包路径:org.sakaiproject.event.api.Event
类名称:Event
方法名:getEvent

Event.getEvent介绍

[英]Access the event id string
[中]访问事件id字符串

代码示例

代码示例来源:origin: org.sakaiproject.samigo/samigo-services

private void noEventHandlerFor(Notification notification, Event event) {
  // Really shouldn't ever happen ... registerEventCallbacks() filters out events we're not interested in,
  // so would be either a static bug in this class or a change in behavior of Sakai's notification system.
  // Either way, we don't care about the event, so just a debug message.
  log.debug("Unexpected event type: " + event.getEvent());
  return;
}

代码示例来源:origin: sakaiproject/sakai

/**
 * Constructor
 * 
 * Converts an Event object into a SimpleEvent object
 * in order to be serializable for distribution
 * 
 * @param event the event object
 * @param serverId the server id this event originated from
 */
public SimpleEvent(Event event, String serverId) {
  if (event == null) {
    throw new IllegalArgumentException("The SimpleEvent event cannot be null.");
  }
  if (serverId == null) {
    throw new IllegalArgumentException("The SimpleEvent serverId cannot be null.");
  }
  setEvent(event.getEvent());
  setResource(event.getResource());
  setSessionId(event.getSessionId());
  setUserId(event.getUserId());
  setContext(event.getContext());
  setModify(event.getModify());
  setPriority(event.getPriority());
  setEventTime(event.getEventTime());
  setServerId(serverId);
  setLRSStatement(event.getLrsStatement());
}

代码示例来源:origin: sakaiproject/sakai

private void noEventHandlerFor(Notification notification, Event event) {
  // Really shouldn't ever happen ... registerEventCallbacks() filters out events we're not interested in,
  // so would be either a static bug in this class or a change in behavior of Sakai's notification system.
  // Either way, we don't care about the event, so just a debug message.
  log.debug("Unexpected event type: " + event.getEvent());
  return;
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

private boolean isUserLoginEvent(Event e) {
  return StringUtils.equals(StatsManager.LOGIN_EVENTID, e.getEvent()) || StringUtils.equals(StatsManager.CONTAINER_LOGIN_EVENTID, e.getEvent());
}

代码示例来源:origin: org.sakaiproject/sakai-rwiki-impl

public Integer getAction(Event event)
{
  String eventName = event.getEvent();
  if (RWikiObjectService.EVENT_RESOURCE_ADD.equals(eventName)
      || RWikiObjectService.EVENT_RESOURCE_WRITE.equals(eventName))
  {
    return SearchBuilderItem.ACTION_ADD;
  }
  if (RWikiObjectService.EVENT_RESOURCE_REMOVE.equals(eventName))
  {
    return SearchBuilderItem.ACTION_DELETE;
  }
  return SearchBuilderItem.ACTION_UNKNOWN;
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

/** EventTrackingService observer for cache invalidation. */
public void update(Observable obs, Object o) {
  if(o instanceof Event){
    Event e = (Event) o;
    String event = LOG_APP + '.' + LOG_OBJ_PREFSDATA + '.' + LOG_ACTION_EDIT;
    if(e.getEvent() != null && e.getEvent().equals(event)) {
      String siteId = e.getResource().split("/")[2];
      cachePrefsData.remove(siteId);
      LOG.debug("Expiring preferences cache for site: "+siteId);
    }
  }
}

代码示例来源:origin: stackoverflow.com

public String getEventById(List<Event> eventList, String id) {
  for (Event event : eventList) {
    if (event.getId().equals(id)) {
      return event.getEvent();
    }
  }
  return null;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
  public void update(Observable observable, Object o) {
    if (o instanceof Event) {
      Event event = (Event) o;
      if (event.getResource() != null && (
          BaseSiteService.SECURE_ADD_SITE.equals(event.getEvent())
              || BaseSiteService.SECURE_UPDATE_SITE.equals(event.getEvent())
              || BaseSiteService.SECURE_REMOVE_SITE.equals(event.getEvent())
      )
    ) {
        String siteRef = event.getResource();
        m_cache.remove(siteRef);
      }
    }
  }
}

代码示例来源:origin: stackoverflow.com

for( Event evt : allEvents ) {
  System.out.println( evt.getId() );
  System.out.println( evt.getEvent() );
  System.out.println( evt.getCity() );
}

代码示例来源:origin: stackoverflow.com

Event evt = findEvent( "someID", allEvents );
System.out.println( evt.getId() );
System.out.println( evt.getCity() );
System.out.println( evt.getEvent() );

代码示例来源:origin: sakaiproject/sakai

/**
 * Check to see if we want to process or ignore this update.
 * 
 * @param arg
 *        The arg from the update.
 * @return true to continue, false to quit.
 */
public boolean check(Object arg)
{
  // arg is Event
  if (!(arg instanceof Event)) return false;
  Event event = (Event) arg;
  String key = event.getResource();
  // reject non presence events
  String function = event.getEvent();
  if (!(function.equals(PresenceService.EVENT_PRESENCE) || function.equals(PresenceService.EVENT_ABSENCE))) return false;
  // look for matches to the pattern
  if (m_resourcePattern != null)
  {
    if (!key.equals(m_resourcePattern)) return false;
  }
  return true;
}

代码示例来源:origin: org.sakaiproject.userauditservice/userauditservice-impl

public void update(Observable o, Object arg)
  {
    if (arg instanceof Event)
    {
      Event event = (Event) arg;
      if (event != null && event.getEvent() != null && siteService.SECURE_REMOVE_SITE.equals(event.getEvent()))
      {
        String resource = event.getResource();
        String siteRefRoot = siteService.REFERENCE_ROOT;
        // double check we have a /site/siteId style string
        if (resource.startsWith(siteRefRoot))
        {
          String siteId = resource.substring(siteRefRoot.length()+1);
          userAuditRegistration.deleteUserAuditingFromSite(siteId);
        }
      }
    }
  }
}

代码示例来源:origin: stackoverflow.com

Event evt = ...
System.out.println( evt.getEvent() );
System.out.println( evt.Id() );
System.out.println( evt.getCity() );

代码示例来源:origin: sakaiproject/sakai

public void update(Observable o, final Object arg) {

    if (arg instanceof Event) {
      Event e = (Event) arg;
      String event = e.getEvent();
      if (ProfileConstants.EVENT_FRIEND_CONFIRM.equals(event)
        || ProfileConstants.EVENT_FRIEND_REMOVE.equals(event)) {
        String ref = e.getResource();
        String[] pathParts = ref.split("/");
        String from = e.getUserId();
        String to = pathParts[2];
        List<String> contextIds = new ArrayList();
        contextIds.add(from);
        contextIds.add(to);
        removeContextIdsFromCache(contextIds);
      }
    }
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
  public void update(Observable observable, Object o) {
    if (o instanceof Event) {
      Event event = (Event) o;
      if (event.getResource() != null && (
        SECURE_UPDATE_USER_OWN.equals(event.getEvent())
        || SECURE_UPDATE_USER_ANY.equals(event.getEvent())
        || SECURE_REMOVE_USER.equals(event.getEvent())
        )
      ) {
        String userRef = event.getResource();
        UserEdit u = getCachedUser(userRef);
        String oldEid = u != null ? u.getEid() : null;
        removeCachedUser(userRef, oldEid);
      }
    }
  }
}

代码示例来源:origin: sakaiproject/sakai

/**
 * Called when events occur which come in from the event system
 * @param event the event from the system
 */
protected void handleEvent(Event event) {
  for (EventReceiver receiver : receivers.values()) {
    if (match(receiver, event)) {
      receiver.receiveEvent(event.getEvent(), event.getResource());
    }
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public void update(Observable o, Object obj) {
  if (obj == null || !(obj instanceof Event))
  {
    return;
  }
  Event event = (Event) obj;
  
  if (SiteService.EVENT_SITE_USER_INVALIDATE.equals(event.getEvent()))
  {
    Site site = null;
    try {
      site = siteService().getSite(event.getResource());
    } catch (IdUnusedException e) {
      log.warn("Security invalidation error when handling an event (" + event.getEvent() + "), for site " + event.getResource());
    }
    if (site != null) {
      resetSecurityCache(site.getReference());
    }
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * @param event
 * @return a valid context for the event (based on the site/course) OR null if one cannot be determined
 */
private LRS_Context getEventContext(Event event) {
  LRS_Context context = null;
  if (event != null && event.getContext() != null) {
    String eventContext = event.getContext();
    String e = StringUtils.lowerCase(event.getEvent());
    // NOTE: wiki puts /site/ in front of the context, others are just the site_id
    if (StringUtils.startsWith(e, "wiki")) {
      eventContext = StringUtils.replace(eventContext, "/site/", "");
    }
    // the site is the parent for all event activities
    context = new LRS_Context("parent", serverConfigurationService.getPortalUrl()+"/site/"+eventContext);
  }
  return context;
}

代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl

/** Method called whenever an new event is generated from EventTrackingService: do not call this method! */
public void update(Observable obs, Object o) {
  // At the moment this isn't threadsafe, but as sakai event handling is single threaded this shoudn't be a problem,
  // but it's not a formal contract.
  if(o instanceof Event){
    Event e = (Event) o;
    Event eventWithPreciseDate = buildEvent(getToday(), e.getEvent(), e.getResource(), e.getContext(), e.getUserId(), e.getSessionId());
    collectThreadQueue.add(eventWithPreciseDate);
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * Ensure that the provided event is an instance of BaseEvent.  If not, create a new BaseEvent
 * and transfer state.
 *
 * @param e
 * @return
 */
protected BaseEvent ensureBaseEvent(Event e)
{
  BaseEvent event = null;
  if (e instanceof BaseEvent)
  {
    event = (BaseEvent) e;
  }
  else
  {
    event = new BaseEvent(e.getEvent(), e.getResource(), e.getModify(), e.getPriority(),null);
    event.setSessionId(e.getSessionId());
    event.setUserId(e.getUserId());
  }
  return event;
}

相关文章