public EmpDiscipline addEmpDiscipline( EmpDiscipline prePersistedObj, ServiceContext serviceContext) { try { final EmpDiscipline o = super.addEmpDiscipline(prePersistedObj); // add permission resourceLocalService.addResources( o.getCompanyId(), o.getGroupId(), o.getUserId(), EmpDiscipline.class.getName(), o.getEmpDisciplineId(), false, true, true); // index new EmpDiscipline Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(EmpDiscipline.class); indexer.reindex(EmpDiscipline.class.getName(), o.getEmpDisciplineId()); final Emp emp = empLocalService.fetchEmp(o.getEmpId()); emp.setStatus(EmployeeStatus.DISCIPLINE.toString()); empLocalService.updateEmp(emp); return o; } catch (SystemException e) { LOGGER.info(e); } catch (SearchException e) { LOGGER.info(e); } catch (PortalException e) { LOGGER.info(e); } return null; }
public EmpDiscipline updateEmpDiscipline(EmpDiscipline empDiscipline) throws SystemException { try { EmpDiscipline o = super.updateEmpDiscipline(empDiscipline); // index new EmpDiscipline Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(EmpDiscipline.class); indexer.reindex(EmpDiscipline.class.getName(), o.getEmpDisciplineId()); return o; } catch (SearchException e) { LOGGER.info(e); } return null; }