Search in sources :

Example 6 with UserInfo

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;
}
Also used : UserInfo(com.developmentontheedge.be5.model.UserInfo)

Example 7 with UserInfo

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();
}
Also used : Serializable(java.io.Serializable) ContentInfo(org.alfresco.repo.event.v1.model.ContentInfo) ZonedDateTime(java.time.ZonedDateTime) QName(org.alfresco.service.namespace.QName) Builder(org.alfresco.repo.event.v1.model.NodeResource.Builder) UserInfo(org.alfresco.repo.event.v1.model.UserInfo)

Example 8 with UserInfo

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;
}
Also used : UserInfo(org.alfresco.repo.event.v1.model.UserInfo)

Aggregations

UserInfo (com.developmentontheedge.be5.model.UserInfo)3 UserInfo (org.alfresco.repo.event.v1.model.UserInfo)3 ApiException (com.haleconnect.api.user.v1.ApiException)2 UsersApi (com.haleconnect.api.user.v1.api.UsersApi)2 UserInfo (com.haleconnect.api.user.v1.model.UserInfo)2 HaleConnectException (eu.esdihumboldt.hale.io.haleconnect.HaleConnectException)2 HaleConnectUserInfo (eu.esdihumboldt.hale.io.haleconnect.HaleConnectUserInfo)2 Serializable (java.io.Serializable)2 QName (org.alfresco.service.namespace.QName)2 Session (com.developmentontheedge.be5.api.Session)1 LoginApi (com.haleconnect.api.user.v1.api.LoginApi)1 Credentials (com.haleconnect.api.user.v1.model.Credentials)1 Token (com.haleconnect.api.user.v1.model.Token)1 ZonedDateTime (java.time.ZonedDateTime)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpSession (javax.servlet.http.HttpSession)1 ContentInfo (org.alfresco.repo.event.v1.model.ContentInfo)1 Builder (org.alfresco.repo.event.v1.model.NodeResource.Builder)1