当前位置: 首页>>代码示例>>Java>>正文


Java Event类代码示例

本文整理汇总了Java中org.alfresco.events.types.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Event类属于org.alfresco.events.types包,在下文中一共展示了Event类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: publishEvent

import org.alfresco.events.types.Event; //导入依赖的package包/类
/**
 * Publish new user event
 * 
 * @param eventType String
 * @param properties Map<QName, Serializable>
 */
private void publishEvent(String eventType,  Map<QName, Serializable> properties)
{
	if(properties == null)	return;
	
 	final String managedUsername  = (String)properties.get(ContentModel.PROP_USERNAME);
    final String managedFirstname = (String)properties.get(ContentModel.PROP_FIRSTNAME);
    final String managedLastname  = (String)properties.get(ContentModel.PROP_LASTNAME);
    final String eventTType 	  = eventType;
    
    eventPublisher.publishEvent(new EventPreparator(){
        @Override
        public Event prepareEvent(String user, String networkId, String transactionId)
        {         
        	return new UserManagementEvent(eventTType , transactionId, networkId,new Date().getTime(), 
        			user, managedUsername,managedFirstname,managedLastname);
        }
    });
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:PersonServiceImpl.java

示例2: publishReadEvent

import org.alfresco.events.types.Event; //导入依赖的package包/类
/**
 * Notifies listeners that a read has taken place.
 *
 * @param nodeRef NodeRef
 * @param name String
 * @param mimeType String
 * @param contentSize long
 * @param encoding String
 * @param range String
 */
protected void publishReadEvent(final NodeRef nodeRef, final String name, final String mimeType, final long contentSize, final String encoding, final String range)
{
    final QName nodeType = nodeRef==null?null:nodeService.getType(nodeRef);

    eventPublisher.publishEvent(new EventPreparator(){
        @Override
        public Event prepareEvent(String user, String networkId, String transactionId)
        {
            if (StringUtils.hasText(range))
            {
                return new ContentReadRangeEvent(user, networkId, transactionId,
                            nodeRef.getId(), null, nodeType.toString(), Client.asType(ClientType.cmis), name, mimeType, contentSize, encoding, range);
            }
            else
            {
                return new ContentEventImpl(ContentEvent.DOWNLOAD, user, networkId, transactionId,
                            nodeRef.getId(), null, nodeType.toString(), Client.asType(ClientType.cmis), name, mimeType, contentSize, encoding);
            }
        }
    });


}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:CMISConnector.java

示例3: login

import org.alfresco.events.types.Event; //导入依赖的package包/类
protected Map<String, Object> login(final String username, String password)
{
    try
    {
        // get ticket
        authenticationService.authenticate(username, password.toCharArray());

        eventPublisher.publishEvent(new EventPreparator(){
            @Override
            public Event prepareEvent(String user, String networkId, String transactionId)
            {
            	// TODO need to fix up to pass correct seqNo and alfrescoClientId
                return new RepositoryEventImpl(-1l, "login", transactionId, networkId, new Date().getTime(),
                		username, null);
            }
        });
        
        // add ticket to model for javascript and template access
        Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
        model.put("username", username);
        model.put("ticket",  authenticationService.getCurrentTicket());
        
        return model;
    }
    catch(AuthenticationException e)
    {
        throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Login failed");
    }
    finally
    {
        AuthenticationUtil.clearCurrentSecurityContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:34,代码来源:AbstractLoginBean.java

示例4: publishReadEvent

import org.alfresco.events.types.Event; //导入依赖的package包/类
/**
 * Notifies listeners that a read has taken place
 * @param realNodeInfo FileInfo
 * @param mimetype String
 * @param size Long
 * @param contentEncoding String
 * @param range String
 */
protected void publishReadEvent(final FileInfo realNodeInfo, final String mimetype, final Long size, final String contentEncoding, final String range)
{
 
    if (!StringUtils.hasText(range))
    {
        // Its not a range request
        eventPublisher.publishEvent(new EventPreparator()
        {
            @Override
            public Event prepareEvent(String user, String networkId, String transactionId)
            {
                return new ContentEventImpl(ContentEvent.DOWNLOAD, user, networkId, transactionId, realNodeInfo.getNodeRef().getId(), null,
                            realNodeInfo.getType().toString(), Client.asType(ClientType.webdav), realNodeInfo.getName(), mimetype,
                            size, contentEncoding);
            }
        });

    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:28,代码来源:WebDAVHelper.java

示例5: publishReadEvent

import org.alfresco.events.types.Event; //导入依赖的package包/类
/**
 * Notifies listeners that a read has taken place.
 * 
 * @param nodeRef NodeRef
 * @param name String
 * @param mimeType String
 * @param contentSize long
 * @param encoding String
 * @param range String
 */
protected void publishReadEvent(final NodeRef nodeRef, final String name, final String mimeType, final long contentSize, final String encoding, final String range)
{
    final QName nodeType = nodeRef==null?null:nodeService.getType(nodeRef);
    
    eventPublisher.publishEvent(new EventPreparator(){
        @Override
        public Event prepareEvent(String user, String networkId, String transactionId)
        {
            if (StringUtils.hasText(range))
            {
                return new ContentReadRangeEvent(user, networkId, transactionId,
                            nodeRef.getId(), null, nodeType.toString(), Client.asType(ClientType.cmis), name, mimeType, contentSize, encoding, range); 
            } 
            else 
            {
                return new ContentEventImpl(ContentEvent.DOWNLOAD, user, networkId, transactionId,
                            nodeRef.getId(), null, nodeType.toString(), Client.asType(ClientType.cmis), name, mimeType, contentSize, encoding);            
            }
        }
    });
    

}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:34,代码来源:CMISConnector.java

示例6: addFavouriteDocumentOrFolder

import org.alfresco.events.types.Event; //导入依赖的package包/类
private PersonFavourite addFavouriteDocumentOrFolder(String userName, Type type, NodeRef nodeRef)
  {
Map<PersonFavouriteKey, PersonFavourite> personFavourites = getFavouriteNodes(userName, type);
PersonFavourite personFavourite = getPersonFavourite(userName, type, nodeRef);
if(personFavourite == null)
{
	Date createdAt = new Date();
	final String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
	personFavourite = new PersonFavourite(userName, nodeRef, type, name, createdAt);
	personFavourites.put(personFavourite.getKey(), personFavourite);
	updateFavouriteNodes(userName, type, personFavourites);
	
	QName nodeClass = nodeService.getType(nodeRef);
	final String finalRef = nodeRef.getId();
	final QName nodeType = nodeClass;
	
          eventPublisher.publishEvent(new EventPreparator(){
              @Override
              public Event prepareEvent(String user, String networkId, String transactionId)
              {            
                  return new ActivityEvent("favorite.added", transactionId, networkId, user, finalRef,
                              null, nodeType==null?null:nodeType.toString(),  Client.asType(ClientType.script), null,
                              name, null, 0l, null);
              }
          });
          
       OnAddFavouritePolicy policy = onAddFavouriteDelegate.get(nodeRef, nodeClass);
       policy.onAddFavourite(userName, nodeRef);
}

return personFavourite;
  }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:FavouritesServiceImpl.java

示例7: removeFavouriteNode

import org.alfresco.events.types.Event; //导入依赖的package包/类
private boolean removeFavouriteNode(String userName, Type type, NodeRef nodeRef)
  {
boolean exists = false;

Map<PersonFavouriteKey, PersonFavourite> personFavourites = getFavouriteNodes(userName, type);

PersonFavouriteKey personFavouriteKey = new PersonFavouriteKey(userName, null, type, nodeRef);
PersonFavourite personFavourite = personFavourites.remove(personFavouriteKey);
exists = personFavourite != null;
updateFavouriteNodes(userName, type, personFavourites);

QName nodeClass = nodeService.getType(nodeRef);
      final String finalRef = nodeRef.getId();
      final QName nodeType = nodeClass;
      
      eventPublisher.publishEvent(new EventPreparator(){
          @Override
          public Event prepareEvent(String user, String networkId, String transactionId)
          {            
              return new ActivityEvent("favorite.removed", transactionId, networkId, user, finalRef,
                          null, nodeType==null?null:nodeType.toString(),  Client.asType(ClientType.script), null,
                          null, null, 0l, null);
          }
      });
      
      OnRemoveFavouritePolicy policy = onRemoveFavouriteDelegate.get(nodeRef, nodeClass);
      policy.onRemoveFavourite(userName, nodeRef);

  	return exists;
  }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:FavouritesServiceImpl.java

示例8: publishEvent

import org.alfresco.events.types.Event; //导入依赖的package包/类
@Override
public void publishEvent(EventPreparator prep)
{
    ThreadInfo info = getThreadInfo();
    Event event = prep.prepareEvent(info.user, info.network, info.transaction);
    queue.add(event);
    log("Event published: [" + event + "]");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:EventPublisherForTestingOnly.java

示例9: getQueueByType

import org.alfresco.events.types.Event; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Event> List<T> getQueueByType(Class<T> type)
{
    List<T> toReturn = new ArrayList<>();
    for (Event event : queue)
    {
       if (type.equals(event.getClass()))
       {
           toReturn.add((T) event);
       }
    }
    return (List<T>) toReturn;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:EventPublisherForTestingOnly.java

示例10: getQueue

import org.alfresco.events.types.Event; //导入依赖的package包/类
public Queue<Event> getQueue()
{
    return this.queue;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:EventPublisherForTestingOnly.java


注:本文中的org.alfresco.events.types.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。