本文整理了Java中org.sakaiproject.event.api.Event
类的一些代码示例,展示了Event
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event
类的具体详情如下:
包路径:org.sakaiproject.event.api.Event
类名称:Event
[英]Event represents a single significant activity by the end-user.
[中]事件表示最终用户的单个重要活动。
代码示例来源: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: 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: 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: 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: stackoverflow.com
for( Event evt : allEvents ) {
System.out.println( evt.getId() );
System.out.println( evt.getEvent() );
System.out.println( evt.getCity() );
}
代码示例来源:origin: org.sakaiproject.sitestats/sitestats-impl
private boolean isMyWorkspaceEvent(Event e) {
return e.getResource() != null && e.getResource().startsWith("/site/~");
}
代码示例来源: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;
}
代码示例来源: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.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
/**
* 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;
// if this is just a read, not a modify event, we can ignore it
if (!event.getModify()) return false;
String key = null;
// filter out events not for us
if (m_resourcePattern != null)
{
key = event.getResource();
// if this resource is not in my pattern of resources, we can ignore it
if (!key.startsWith(m_resourcePattern)) return false;
}
return true;
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
Event e = (Event) o;
String userId = e.getUserId();
log.debug("No userId for event, getting from the UsageSession instead: " + e.getEvent());
UsageSession session = usageSessionService.getSession(e.getSessionId());
if(session != null) {
userId = session.getUserId();
log.debug("Couldn't get a userId for event, cannot update cache - skipping: " + e.getEvent());
return;
if(StringUtils.equals(e.getEvent(), UsageSessionService.EVENT_LOGOUT)) {
userActivityCache.remove(userId);
log.debug("Removed from user activity cache: " + userId);
代码示例来源: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: stackoverflow.com
Event evt = ...
System.out.println( evt.getEvent() );
System.out.println( evt.Id() );
System.out.println( evt.getCity() );
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
/**
* Cause this new event to get to wherever it has to go for persistence, etc.
*
* @param event
* The new event to post.
*/
protected void postEvent(Event event)
{
String reportId = null;
if (event.getSessionId() != null)
{
reportId = event.getSessionId();
}
else
{
reportId = "~" + event.getUserId();
}
log.info(m_logId + reportId + "@" + event);
// notify observers, sending the event
notifyObservers(event, true);
}
}
代码示例来源:origin: sakaiproject/sakai
String priStr = Integer.toString(event.getPriority());
String eventContext = event.getContext();
if (eventContext != null) {
props = prefs.getProperties(NotificationService.PREFS_TYPE + type + NotificationService.NOTI_OVERRIDE_EXTENSION);
代码示例来源:origin: sakaiproject/sakai
String userEmail = null;
String userId = event.getUserId();
代码示例来源:origin: org.sakaiproject.presence/sakai-presence-impl
public void notify(Notification notification, Event event)
{
removeSessionPresence(event.getSessionId());
}
代码示例来源:origin: org.sakaiproject.search.elasticsearch/elasticsearch-util
protected void validateResourceName(Event event, Map<String, Object> validationContext)
throws IllegalArgumentException, IllegalStateException {
String resourceName = event.getResource();
if (resourceName == null) {
// default if null (historical behavior)
resourceName = "";
}
if (resourceName.length() > 255) {
throw new IllegalArgumentException("Entity Reference is longer than 255 characters. Reference="
+ resourceName);
}
validationContext.put(ADD_RESOURCE_VALIDATION_KEY_RESOURCE_NAME, resourceName);
}
代码示例来源: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/sakai-citations-impl
public void update(Observable arg0, Object arg1)
{
if (arg1 instanceof Event)
{
Event event = (Event) arg1;
/*
* Modified? If so, reload if it's one of our hierarchy files
*/
if (event.getModify())
{
String refstr = event.getResource();
synchronized (this)
{
if (this.updatableResources.contains(refstr))
{
m_log.debug("Updating configuration from " + refstr);
this.updateHierarchy(refstr);
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!