use of org.alfresco.repo.event.v1.model.UserInfo in project be5 by DevelopmentOnTheEdge.
the class UserHelper method saveUser.
public UserInfo saveUser(String userName, List<String> availableRoles, List<String> currentRoles, Locale locale, String remoteAddr, Session session) {
UserInfo ui = new UserInfo(userName, availableRoles, currentRoles, session);
ui.setRemoteAddr(remoteAddr);
ui.setLocale(meta.getLocale(locale));
UserInfoHolder.setUserInfo(ui);
return ui;
}
use of org.alfresco.repo.event.v1.model.UserInfo in project alfresco-repository by Alfresco.
the class EventConsolidator method buildNodeResourceBeforeDelta.
protected NodeResource buildNodeResourceBeforeDelta(NodeResource after) {
if (after == null) {
return null;
}
Builder builder = NodeResource.builder();
Map<QName, Serializable> changedPropsBefore = getBeforeMapChanges(propertiesBefore, propertiesAfter);
if (!changedPropsBefore.isEmpty()) {
// Set only the changed properties
Map<String, Serializable> mappedProps = helper.mapToNodeProperties(changedPropsBefore);
if (!mappedProps.isEmpty()) {
builder.setProperties(mappedProps);
resourceBeforeAllFieldsNull = false;
}
String name = (String) changedPropsBefore.get(ContentModel.PROP_NAME);
if (name != null) {
builder.setName(name);
resourceBeforeAllFieldsNull = false;
}
ContentInfo contentInfo = helper.getContentInfo(changedPropsBefore);
if (contentInfo != null) {
builder.setContent(contentInfo);
resourceBeforeAllFieldsNull = false;
}
UserInfo modifier = helper.getUserInfo((String) changedPropsBefore.get(ContentModel.PROP_MODIFIER));
if (modifier != null) {
builder.setModifiedByUser(modifier);
resourceBeforeAllFieldsNull = false;
}
ZonedDateTime modifiedAt = helper.getZonedDateTime((Date) changedPropsBefore.get(ContentModel.PROP_MODIFIED));
if (modifiedAt != null) {
builder.setModifiedAt(modifiedAt);
resourceBeforeAllFieldsNull = false;
}
}
Set<String> aspectsBefore = getMappedAspectsBefore(after.getAspectNames());
if (!aspectsBefore.isEmpty()) {
builder.setAspectNames(aspectsBefore);
resourceBeforeAllFieldsNull = false;
}
if (primaryHierarchyBefore != null && !primaryHierarchyBefore.isEmpty()) {
builder.setPrimaryHierarchy(primaryHierarchyBefore);
resourceBeforeAllFieldsNull = false;
}
if (nodeTypeBefore != null) {
builder.setNodeType(helper.getQNamePrefixString(nodeTypeBefore));
resourceBeforeAllFieldsNull = false;
}
return builder.build();
}
use of org.alfresco.repo.event.v1.model.UserInfo in project alfresco-repository by Alfresco.
the class NodeResourceHelper method getUserInfo.
private UserInfo getUserInfo(String userName, Map<String, UserInfo> mapUserCache) {
UserInfo userInfo = mapUserCache.get(userName);
if (userInfo == null) {
userInfo = getUserInfo(userName);
mapUserCache.put(userName, userInfo);
}
return userInfo;
}
Aggregations