private String getCreatorLogin(HttpServletRequest request) { UserData user = portalUserSource.getUserByRequest(request); return user.getLogin(); }
@Override public String toString() { return "UserData [login=" + login + ", getRealName()=" + getRealName() + "]"; } }
for (UserData user : users) { Properties properties = new Properties(); result.put(user.getLogin(), properties); if (user.getCompanyId() != null) { Set<Long> ids = ldapServerMappings.get(user.getCompanyId()); if (ids == null) { ids = new HashSet<Long>(); ldapServerMappings.put(user.getCompanyId(), ids); ids.addAll(getLdapServerIds(user.getCompanyId()));
@Override public UserAttribute findAttribute(final String key) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKey(key)); }
public void setRoleNames(Set<String> roleNames) { Set<String> existingRoles = new HashSet<String>(); for (Iterator<UserRole> it = getRoles().iterator(); it.hasNext(); ) { UserRole role = it.next(); if (!roleNames.contains(role.getName())) { it.remove(); } else { existingRoles.add(role.getName()); } } for (String name : roleNames) { if (!existingRoles.contains(name)) { addRoleName(name); } } }
@Override public UserData loadOrCreateUserByLogin(UserData ud) { Session session = getSession(); if (session.contains(ud)) { return ud; } if (ud.getId() != null) { return (UserData) session.get(UserData.class, ud.getId()); } else { List users = session.createCriteria(UserData.class).add(eq("login", ud.getLogin())).list(); if (users.isEmpty()) { session.saveOrUpdate(ud); return ud; } else { return (UserData) users.get(0); } } }
public long saveProcessInstance(ProcessInstance processInstance) { UserData creator = processInstance.getCreator(); if (creator != null) { if (creator.getId() != null) { processInstance.setCreator((UserData) session.get(UserData.class, creator.getId())); } else { List users = session.createCriteria(UserData.class) .add(eq("login", creator.getLogin())).list(); if (users.isEmpty()) { session.saveOrUpdate(creator); searchData.addSearchAttribute(new ProcessInstanceSearchAttribute("creator_login", creator.getLogin())); searchData.addSearchAttribute(new ProcessInstanceSearchAttribute("creator_email", creator.getEmail())); searchData.addSearchAttribute(new ProcessInstanceSearchAttribute("creator_realname", creator.getRealName()));
/** * @param user * @param roleNames */ public ActivitiBpmSession(UserData user, Collection<String> roleNames) { super(user, roleNames, ProcessToolContext.Util.getThreadProcessToolContext().getRegistry()); IdentityService is = getProcessEngine().getIdentityService(); User bpmUser = is.createUserQuery().userId(user.getLogin()).singleResult(); if (bpmUser == null) { bpmUser = is.newUser(user.getLogin()); bpmUser.setEmail(user.getEmail()); bpmUser.setFirstName(user.getRealName()); is.saveUser(bpmUser); } }
private ProcessLogInfo getProcessLogInfo(ProcessInstanceLog pl) { ProcessLogInfo plInfo = new ProcessLogInfo(); String userDescription = pl.getUser() != null ? nvl(pl.getUser().getRealName(), pl.getUser().getLogin()) : ""; if (pl.getUserSubstitute() != null) { String substituteDescription = nvl(pl.getUserSubstitute().getRealName(), pl.getUserSubstitute().getLogin()); plInfo.userDescription = substituteDescription + "(" + getMessage("awf.basewidgets.process-history.substituting") + " " + userDescription + ")"; } else { plInfo.userDescription = userDescription; } plInfo.entryDescription = nvl(pl.getAdditionalInfo(), pl.getLogValue()); plInfo.actionDescription = i18NSource.getMessage(pl.getEventI18NKey()); if (hasText(plInfo.getEntryDescription())) { plInfo.actionDescription = plInfo.actionDescription + " - " + getMessage(plInfo.entryDescription); } plInfo.performDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pl.getEntryDate().getTime()); plInfo.stateDescription = pl.getState() != null ? nvl(pl.getState().getDescription(), pl.getState().getName()) : ""; return plInfo; }
public static UserData convertLiferayUser(User user) throws SystemException { if (user == null) { return null; } UserData ud = new UserData(); ud.setEmail(user.getEmailAddress()); ud.setLogin(user.getScreenName()); ud.setFirstName(user.getFirstName()); ud.setLastName(user.getLastName()); ud.setJobTitle(user.getJobTitle()); ud.setCompanyId(user.getCompanyId()); ud.setLiferayUserId(user.getUserId()); for (Role role : user.getRoles()) { ud.addRoleName(role.getName(), role.getDescription()); } setGroupRoles(ud, user); return ud; }
public UserData getUserByEmail(String email) { return LiferayBridge.getLiferayUserByEmail(email, user.getCompanyId()); }
private MutableBpmTask collectTask(Task task, ProcessInstance pi, ProcessToolContext ctx) { MutableBpmTask t = new MutableBpmTask(); t.setProcessInstance(pi); t.setAssignee(task.getAssignee()); UserData ud = ctx.getUserDataDAO().loadUserByLogin(task.getAssignee()); if (ud == null) { ud = new UserData(); ud.setLogin(task.getAssignee()); } t.setOwner(ud); t.setTaskName(task.getName()); t.setInternalTaskId(task.getId()); t.setExecutionId(task.getExecutionId()); t.setCreateDate(task.getCreateTime()); t.setFinished(false); return t; }
InputStream is = bpmStream; ProcessToolBpmSession session = processToolContext.getProcessToolSessionFactory().createSession( new UserData("admin", "admin@aperteworkflow.org", "Admin"), Arrays.asList("ADMIN")); byte[] oldDefinition = session.getProcessLatestDefinition(cfg.getBpmDefinitionKey(), cfg.getProcessName()); if (oldDefinition != null) {
public void addRoleName(String name) { addRoleName(name, null); }
@Override public boolean apply(UserData input) { UserAttribute userAttribute = input.findAttribute(attribute.getKey()); return userAttribute != null && userAttribute.getValue().equals(attribute.getValue()); } });
String taskOwner = task.getAssignee(); String authorLogin = actionPerformer.getLogin(); String authorFullName = actionPerformer.getRealName(); processComment.setAuthorLogin(owner.getLogin()); processComment.setAuthorFullName(owner.getRealName()); processComment.setSubstituteLogin(authorLogin); processComment.setSubstituteFullName(authorFullName);
public UserData getUser(String login) { return LiferayBridge.getLiferayUser(login, user.getCompanyId()); }
@Override public UserAttribute findAttribute(final String key, final String value) { return findAttribute(getMainAttributes(), UserAttributePredicates.matchKeyValue(key, value)); }
@Override public UserData getAutoUser() { return new UserData(Formats.nvl(getSetting(AUTO_USER_LOGIN), "system"), Formats.nvl(getSetting(AUTO_USER_NAME), "System"), Formats.nvl(getSetting(AUTO_USER_EMAIL), "awf@bluesoft.net.pl")); }
private static void setGroupRoles(UserData ud, User user) { try { for (UserGroup userGroup : user.getUserGroups()) { List<Role> roles = RoleLocalServiceUtil.getGroupRoles(userGroup.getGroup().getGroupId()); for (Role role : roles) { ud.addRoleName(role.getName()); } } } catch (Exception e) { throw new LiferayBridgeException(e); } }