private Builder(String groupKeyCode, String dept) { setGroupKeyCode(groupKeyCode); setDept(dept); }
public String getBusinessKeyString() { return getGroupKeyCode() + "|" + getDept(); }
public static Builder create(String groupKeyCode, String dept) { return new Builder(groupKeyCode, dept); }
public static Builder create(DepartmentContract contract) { if (contract == null) { throw new IllegalArgumentException("contract was null"); } Builder builder = create(contract.getGroupKeyCode(), contract.getDept()); builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey())); builder.setHrDeptId(contract.getHrDeptId()); builder.setDescription(contract.getDescription()); builder.setChart(contract.getChart()); builder.setOrg(contract.getOrg()); builder.setPayrollApproval(contract.isPayrollApproval()); builder.setVersionNumber(contract.getVersionNumber()); builder.setObjectId(contract.getObjectId()); builder.setActive(contract.isActive()); builder.setId(contract.getId()); builder.setCreateTime(contract.getCreateTime()); builder.setEffectiveLocalDate(contract.getEffectiveLocalDate()); builder.setUserPrincipalId(contract.getUserPrincipalId()); return builder; }
private Department(Builder builder) { this.hrDeptId = builder.getHrDeptId(); this.dept = builder.getDept(); this.groupKeyCode = builder.getGroupKeyCode(); this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build(); this.description = builder.getDescription(); this.chart = builder.getChart(); this.org = builder.getOrg(); this.payrollApproval = builder.isPayrollApproval(); this.versionNumber = builder.getVersionNumber(); this.objectId = builder.getObjectId(); this.active = builder.isActive(); this.id = builder.getId(); this.createTime = builder.getCreateTime(); this.effectiveLocalDate = builder.getEffectiveLocalDate(); this.userPrincipalId = builder.getUserPrincipalId(); }
@Override protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); if ( (dataObject instanceof PositionBo) || (dataObject instanceof PositionContract) || (dataObject instanceof Position)) { PositionBo positionObj = (PositionBo) dataObject; if (positionObj != null) { Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(positionObj.getPrimaryDepartment(), positionObj.getGroupKeyCode(), positionObj.getEffectiveLocalDate()); if (departmentObj != null) { attributes.put(KPMERoleMemberAttribute.INSTITUION.getRoleMemberAttributeName(), departmentObj.getGroupKey().getInstitutionCode()); attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), departmentObj.getDept()); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), departmentObj.getGroupKey().getLocationId()); attributes.put(KPMERoleMemberAttribute.ORGANIZATION.getRoleMemberAttributeName(), departmentObj.getOrg()); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), departmentObj.getGroupKeyCode()); } else { attributes.put(KPMERoleMemberAttribute.INSTITUION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.ORGANIZATION.getRoleMemberAttributeName(), "%"); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), "%"); } } } }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof TimeCollectionRule) { TimeCollectionRule timeCollectionRuleObj = (TimeCollectionRule) dataObject; if (timeCollectionRuleObj != null) { department = timeCollectionRuleObj.getDept(); groupKeyCode = timeCollectionRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, timeCollectionRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
protected boolean validatPrimaryDepartmentExistence(PositionBo aPosition) { Department dept = HrServiceLocator.getDepartmentService().getDepartment(aPosition.getPrimaryDepartment(), aPosition.getGroupKeyCode(), aPosition.getEffectiveLocalDate()); if (dept == null) { this.putFieldError("dataObject.primaryDepartment","error.existence", "Primary Department '" + aPosition.getPrimaryDepartment() + "'"); return false; } return true; }
@Override public void addFacts(Facts.Builder factsBuilder, Object factObject, String contextId, String namespace) { addObjectMembersAsFacts(factsBuilder, factObject, contextId, namespace); factsBuilder.addFact(new Term("payrollProcessorApproval"), Boolean.FALSE); if (factObject != null && factObject instanceof Assignable) { Assignable assignable = (Assignable)factObject; factsBuilder.addFact(Assignable.ASSIGNABLE_TERM_NAME, assignable); Set<String> workAreas = new HashSet<String>(); Set<String> depts = new HashSet<String>(); for (Assignment a : assignable.getAssignments()) { workAreas.add(String.valueOf(a.getWorkArea())); depts.add(a.getDept()); Department department = HrServiceLocator.getDepartmentService().getDepartment(a.getDept(), a.getGroupKeyCode(), a.getEffectiveLocalDate()); if (department != null && department.isPayrollApproval()) { factsBuilder.addFact(new Term("payrollProcessorApproval"), Boolean.TRUE); } } if (CollectionUtils.isNotEmpty(depts)) { factsBuilder.addFact("department", depts); } if (CollectionUtils.isNotEmpty(workAreas)) { factsBuilder.addFact("workarea", workAreas); } } } }
private WorkArea(Builder builder) { this.userPrincipalId = builder.getUserPrincipalId(); this.defaultOvertimeEarnCodeObj = builder.getDefaultOvertimeEarnCodeObj() == null ? null : builder.getDefaultOvertimeEarnCodeObj().build(); this.department = builder.getDepartment() == null ? null : builder.getDepartment().build(); //this.tasks = ModelObjectUtils.buildImmutableCopy(builder.getTasks()); this.tkWorkAreaId = builder.getTkWorkAreaId(); this.description = builder.getDescription(); this.hrsDistributionF = builder.isHrsDistributionF(); this.overtimeEditRole = builder.getOvertimeEditRole(); this.ovtEarnCode = builder.isOvtEarnCode(); this.adminDescr = builder.getAdminDescr(); this.defaultOvertimeEarnCode = builder.getDefaultOvertimeEarnCode(); this.dept = builder.getDept(); this.workArea = builder.getWorkArea(); this.versionNumber = builder.getVersionNumber(); this.objectId = builder.getObjectId(); this.active = builder.isActive(); this.id = builder.getId(); this.createTime = builder.getCreateTime(); this.effectiveLocalDate = builder.getEffectiveLocalDate(); this.groupKeyCode = builder.getGroupKeyCode(); this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build(); }
public Department build() { return new Department(this); }
public static Builder create(WorkAreaContract contract) { if (contract == null) { throw new IllegalArgumentException("contract was null"); } Builder builder = create(contract.getWorkArea()); builder.setUserPrincipalId(contract.getUserPrincipalId()); builder.setDefaultOvertimeEarnCodeObj(contract.getDefaultOvertimeEarnCodeObj() == null ? null : EarnCode.Builder.create(contract.getDefaultOvertimeEarnCodeObj())); builder.setDepartment(contract.getDepartment() == null ? null : Department.Builder.create(contract.getDepartment())); //builder.setTasks(contract.getTasks() == null ? Collections.<Task.Builder>emptyList() : ModelObjectUtils.transform(contract.getTasks(), toTaskBuilder)); builder.setTkWorkAreaId(contract.getTkWorkAreaId()); builder.setDescription(contract.getDescription()); builder.setHrsDistributionF(contract.isHrsDistributionF()); builder.setOvertimeEditRole(contract.getOvertimeEditRole()); builder.setOvtEarnCode(contract.isOvtEarnCode()); builder.setAdminDescr(contract.getAdminDescr()); builder.setDefaultOvertimeEarnCode(contract.getDefaultOvertimeEarnCode()); builder.setDept(contract.getDept()); builder.setVersionNumber(contract.getVersionNumber()); builder.setObjectId(contract.getObjectId()); builder.setActive(contract.isActive()); builder.setId(contract.getId()); builder.setCreateTime(contract.getCreateTime()); builder.setEffectiveLocalDate(contract.getEffectiveLocalDate()); builder.setGroupKeyCode(contract.getGroupKeyCode()); builder.setGroupKey(contract.getGroupKey() == null ? null : HrGroupKey.Builder.create(contract.getGroupKey())); return builder; }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof ClockLocationRule) { ClockLocationRule clockLocationRuleObj = (ClockLocationRule) dataObject; if (clockLocationRuleObj != null) { department = clockLocationRuleObj.getDept(); groupKeyCode = clockLocationRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, clockLocationRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
private boolean validateAdditionalDepartmentList(PositionDepartmentBo pd, PositionBo aPosition) { //Will only be validated if effective local date in position is not null if(aPosition.getEffectiveLocalDate()!=null && pd != null){ Department department = HrServiceLocator.getDepartmentService().getDepartment(pd.getDepartment(), pd.getGroupKeyCode(), aPosition.getEffectiveLocalDate()); if(department == null){ GlobalVariables.getMessageMap().putError("newCollectionLines['document.newMaintainableObject.dataObject.departmentList'].department", "error.existence", "Position Department '" + pd.getDepartment() + "'"); return false; } } return true; }
private EarnCodeSecurity(Builder builder) { this.salaryGroupObj = builder.getSalaryGroupObj() == null ? null : builder.getSalaryGroupObj().build(); this.departmentObj = builder.getDepartmentObj() == null ? null : builder.getDepartmentObj().build(); this.employee = builder.isEmployee(); this.approver = builder.isApprover(); this.payrollProcessor = builder.isPayrollProcessor(); this.earnCodeObj = builder.getEarnCodeObj() == null ? null : builder.getEarnCodeObj().build(); this.earnCodeType = builder.getEarnCodeType(); this.dept = builder.getDept(); this.hrSalGroup = builder.getHrSalGroup(); this.earnCode = builder.getEarnCode(); this.jobObj = builder.getJobObj() == null ? null : builder.getJobObj().build(); this.hrEarnCodeSecurityId = builder.getHrEarnCodeSecurityId(); this.versionNumber = builder.getVersionNumber(); this.objectId = builder.getObjectId(); this.active = builder.isActive(); this.id = builder.getId(); this.effectiveLocalDate = builder.getEffectiveLocalDate(); this.createTime = builder.getCreateTime(); this.userPrincipalId = builder.getUserPrincipalId(); this.groupKeyCode = builder.getGroupKeyCode(); this.groupKey = builder.getGroupKey() == null ? null : builder.getGroupKey().build(); }
protected void addRoleQualification(Object dataObject, Map<String, String> attributes) { super.addRoleQualification(dataObject, attributes); String department = StringUtils.EMPTY; String location = StringUtils.EMPTY; String groupKeyCode = StringUtils.EMPTY; if (dataObject instanceof DeptLunchRule) { DeptLunchRule departmentLunchRuleObj = (DeptLunchRule) dataObject; if (departmentLunchRuleObj != null) { department = departmentLunchRuleObj.getDept(); groupKeyCode = departmentLunchRuleObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, departmentLunchRuleObj.getEffectiveLocalDate()); if (departmentObj != null) { location = departmentObj.getGroupKey().getLocationId(); } } } attributes.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); attributes.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); attributes.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); }
private boolean validateAdditionalDepartments(PositionBo aPosition) { List<PositionDepartmentBo> posDeptList = aPosition.getDepartmentList(); boolean flag = false; int i=0; for (PositionDepartmentBo pd : posDeptList) { if(pd.getGroupKeyCode().equals(aPosition.getGroupKeyCode())){ if(aPosition.getEffectiveLocalDate()!=null){ Department department = HrServiceLocator.getDepartmentService().getDepartment(pd.getDepartment(), pd.getGroupKeyCode(), aPosition.getEffectiveLocalDate()); if(department == null){ this.putFieldError("document.newMaintainableObject.dataObject.departmentList[" + i + "].groupKeyCode", "error.existence", "Position Department '" + pd.getDepartment() + "'"); return false; } } }else{ flag = false; this.putFieldError("document.newMaintainableObject.dataObject.departmentList[" + i + "].groupKeyCode","error.existence", "Position Department '" + pd.getDepartment() + "'"); return flag; } i++; } return true; }
protected List<ClockLogBo> filterLookupResults(List<ClockLogBo> rawResults, String userPrincipalId) { List<ClockLogBo> results = new ArrayList<ClockLogBo>(); for (ClockLogBo clockLogObj : rawResults) { String department = clockLogObj.getDept(); String groupKeyCode = clockLogObj.getGroupKeyCode(); Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, clockLogObj.getClockDateTime().toLocalDate()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, userPrincipalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKeyCode); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); if (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(userPrincipalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>(), roleQualification)) { results.add(clockLogObj); } } return results; }
@Override public boolean userHasTimeSysLocationAdminRoles(String principalId,TimeBlockContract aTimeBlock) { DateTime asOfDate = LocalDate.now().toDateTimeAtStartOfDay(); // system admin or TimeSysAdmin has full permissions when they are not working on their own timesheet, no need to check earnCodeSecurity in this case if(HrServiceLocator.getKPMEGroupService().isMemberOfSystemAdministratorGroup(principalId, asOfDate ) || HrServiceLocator.getKPMERoleService().principalHasRole(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_SYSTEM_ADMINISTRATOR.getRoleName(), asOfDate)) { return true; } // use job to find the department, then use the location from Department to get the location roles JobContract aJob = HrServiceLocator.getJobService().getJob(aTimeBlock.getPrincipalId(), aTimeBlock.getJobNumber(), aTimeBlock.getEndDateTime().toLocalDate()); if(aJob != null) { Department aDept = HrServiceLocator.getDepartmentService().getDepartment(aJob.getDept(), aJob.getGroupKeyCode(), aJob.getEffectiveLocalDate()); if(aDept != null) { // TimeLocationAdmin if(HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(principalId, KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_ADMINISTRATOR.getRoleName(), aDept.getGroupKey().getLocationId(), asOfDate)) return true; } } return false; }
private boolean isAdministratorForPerson(String principalId, LocalDate aDate) { List<Job> jobs = HrServiceLocator.getJobService().getJobs(principalId, aDate); for (Job job : jobs) { String department = job != null ? job.getDept() : null; String groupKeyCode = job != null ? job.getGroupKeyCode() : null; Department departmentObj = HrServiceLocator.getDepartmentService().getDepartment(department, groupKeyCode, LocalDate.now()); String location = departmentObj != null ? departmentObj.getGroupKey().getLocationId() : null; if (HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_DEPARTMENT_ADMINISTRATOR.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInDepartment(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_DEPARTMENT_ADMINISTRATOR.getRoleName(), department, groupKeyCode, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_TK.getNamespaceCode(), KPMERole.TIME_LOCATION_ADMINISTRATOR.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay()) || HrServiceLocator.getKPMERoleService().principalHasRoleInLocation(GlobalVariables.getUserSession().getPrincipalId(), KPMENamespace.KPME_LM.getNamespaceCode(), KPMERole.LEAVE_LOCATION_ADMINISTRATOR.getRoleName(), location, LocalDate.now().toDateTimeAtStartOfDay())) { return true; } } return false; }