public String buildBusinessCategory(final GroupDO group) { return ID_PREFIX + group.getId(); }
@Transient public Integer getGroupId() { if (this.group == null) { return null; } return this.group.getId(); }
@Override public String getIdValue(final GroupDO choice) { return String.valueOf(choice.getId()); }
@Transient public Integer getProjektManagerGroupId() { return projektManagerGroup != null ? projektManagerGroup.getId() : null; }
@Transient public Integer getGroupId() { return this.group != null ? group.getId() : null; }
@Override public String getGroupIds(final Collection<GroupDO> groups) { final StringBuffer buf = new StringBuffer(); boolean first = true; for (final GroupDO group : groups) { if (group.getId() != null) { first = StringHelper.append(buf, first, String.valueOf(group.getId()), ","); } } return buf.toString(); }
public void populateItem(final Item<ICellPopulator<GroupDO>> item, final String componentId, final IModel<GroupDO> rowModel) { final GroupDO group = rowModel.getObject(); appendCssClasses(item, group.getId(), group.isDeleted()); } };
private List<Integer> addGroups(final PFUserDO user, final ProjectForgeGroup... groups) { final List<Integer> groupsToAssign = new ArrayList<Integer>(); final GroupDO group = getTenantRegistry().getUserGroupCache().getGroup(ProjectForgeGroup.PROJECT_MANAGER); groupsToAssign.add(group.getId()); return groupsToAssign; }
@SuppressWarnings("unchecked") @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public GroupTaskAccessDO getEntry(final TaskDO task, final GroupDO group) { Validate.notNull(task); Validate.notNull(task.getId()); Validate.notNull(group); Validate.notNull(group.getId()); final List<GroupTaskAccessDO> list = (List<GroupTaskAccessDO>) getHibernateTemplate().find( "from GroupTaskAccessDO a where a.task.id = ? and a.group.id = ?", new Object[] { task.getId(), group.getId() }); if (list != null && list.size() == 1) { final GroupTaskAccessDO access = list.get(0); checkLoggedInUserSelectAccess(access); return access; } return null; }
@Override public AbstractSecuredBasePage afterSaveOrUpdate() { if (selectProperty != null) { ((ISelectCallerPage) returnToPage).select(selectProperty, getData().getId()); } return super.afterSaveOrUpdate(); }
public Integer getGroupId(final String groupName) { return initTestDB.getGroup(groupName).getId(); }
@Override public void convertInput() { final GroupDO group = getConverter(getType()).convertToObject(getInput(), getLocale()); setConvertedInput(group); if (group != null && (currentGoup == null || group.getId() != currentGoup.getId())) { getRecentCustomers().append(group.getName()); } currentGoup = group; }
@Override public void setObject(final GroupDO object) { if (object == null) { getSearchFilter().setGroupId(null); } else { getSearchFilter().setGroupId(object.getId()); } } }, parentPage, "groupId");
private void getReadOnlyAccessGroupIds(final Set<Integer> groupIds, final SkillDO skill) { if (StringUtils.isNotBlank(skill.getReadOnlyAccessGroupIds()) == true) { final Collection<GroupDO> groups = groupService .getSortedGroups(skill.getReadOnlyAccessGroupIds()); if (groups != null) { for (final GroupDO group : groups) { groupIds.add(group.getId()); } } } if (skill.getParent() == null) { return; } getReadOnlyAccessGroupIds(groupIds, skill.getParent()); }
private void getFullAccessGroupIds(final Set<Integer> groupIds, final SkillDO skill) { if (StringUtils.isNotBlank(skill.getFullAccessGroupIds()) == true) { final Collection<GroupDO> groups = groupService .getSortedGroups(skill.getFullAccessGroupIds()); if (groups != null) { for (final GroupDO group : groups) { groupIds.add(group.getId()); } } } if (skill.getParent() == null) { return; } getFullAccessGroupIds(groupIds, skill.getParent()); }
private void getTrainingAccessGroupIds(final Set<Integer> groupIds, final SkillDO skill) { if (StringUtils.isNotBlank(skill.getTrainingAccessGroupIds()) == true) { final Collection<GroupDO> groups = groupService .getSortedGroups(skill.getTrainingAccessGroupIds()); if (groups != null) { for (final GroupDO group : groups) { groupIds.add(group.getId()); } } } if (skill.getParent() == null) { return; } getTrainingAccessGroupIds(groupIds, skill.getParent()); } }
private void assertGroupSet(final Collection<GroupDO> actualGroupSet, final int... expectedIds) { if (expectedIds == null || expectedIds.length == 0) { assertTrue(CollectionUtils.isEmpty(actualGroupSet)); return; } assertEquals(expectedIds.length, actualGroupSet.size()); final Set<Integer> actualIdSet = new HashSet<Integer>(); for (final GroupDO actualGroup : actualGroupSet) { actualIdSet.add(actualGroup.getId()); } for (final int expectedId : expectedIds) { assertTrue(actualIdSet.contains(expectedId)); } } }
@Override public void validate(final IValidatable<Object> validatable) { @SuppressWarnings("unchecked") final ArrayList<GroupDO> groups = (ArrayList<GroupDO>) validatable.getValue(); final Collection<Integer> curUserGroupIds = userDao.getAssignedGroups(ThreadLocalUserContext.getUser()); boolean isInUserGroups = false; for (final GroupDO group : groups) { if (curUserGroupIds.contains(group.getId()) == true) { isInUserGroups = true; break; } } if (isInUserGroups == false) { final ValidationError validationError = new ValidationError() .addKey("plugins.skillmatrix.skilltraining.error.nousergroup"); validatable.error(validationError); } }
/** * Convert expectedGroupNames in list of expected group ids: {2,4,7} Asserts that all group ids in groupssString are * expected and vice versa. * * @param expectedGroupNames * @param groupsString csv of groups, e. g. {2,4,7} */ void assertGroupIds(final String[] expectedGroupNames, final String groupsString) { if (expectedGroupNames == null) { assertTrue(StringUtils.isEmpty(groupsString)); } final String[] expectedGroups = new String[expectedGroupNames.length]; for (int i = 0; i < expectedGroupNames.length; i++) { expectedGroups[i] = getGroup(expectedGroupNames[i]).getId().toString(); } assertIds(expectedGroups, groupsString); }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void test3CheckUnmodifiableGroupNames() { GroupDO adminGroup = getGroup(ProjectForgeGroup.ADMIN_GROUP.getName()); final Integer id = adminGroup.getId(); adminGroup.setName("Changed admin group"); groupDao.internalSave(adminGroup); adminGroup = groupDao.internalGetById(id); assertEquals("Group's name shouldn't be allowed to change.", ProjectForgeGroup.ADMIN_GROUP.getName(), adminGroup.getName()); } }