/** * Get worker for given id * * @param id * @return * @throws Exception */ public org.mlink.iwm.bean.SkillType getItem(Long id) throws Exception { org.mlink.iwm.bean.SkillType form = new org.mlink.iwm.bean.SkillType(); PolicySF psf = ServiceLocator.getPolicySFLocal(); SkillType skillType = (SkillType) psf.get(SkillType.class, id); CopyUtils.copyProperties(form, skillType); return form; }
public String deleteItem(Long skillTypeId) throws Exception { String rtn = ITEM_DELETED_MSG; PolicySF psf = ServiceLocator.getPolicySFLocal(); List<Skill> skills = (List<Skill>) psf.getWorkerSkillGivenSkillType(skillTypeId); SkillType skillType = psf.get(SkillType.class, skillTypeId); // archive if any skill-worker present else delete if (!skills.isEmpty()) { psf.removeWorkerSkillGivenSkillType(skillTypeId); skillType.setArchivedDate(new java.util.Date()); psf.update(skillType); } else { psf.remove(skillType); } LookupMgr.reloadCDLV(SkillTypeRef.class); return rtn; }