本文整理汇总了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);
}
});
}
示例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);
}
}
});
}
示例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();
}
}
示例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);
}
});
}
}
示例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);
}
}
});
}
示例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;
}
示例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;
}
示例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 + "]");
}
示例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;
}
示例10: getQueue
import org.alfresco.events.types.Event; //导入依赖的package包/类
public Queue<Event> getQueue()
{
return this.queue;
}