/** * Removes the association between the h r office and the h r holidaies. Also notifies the * appropriate model listeners and clears the mapping table finder cache. * * @param pk the primary key of the h r office * @param hrHolidaies the h r holidaies * @throws SystemException if a system exception occurred */ public void removeHRHolidaies(long pk, List<com.liferay.hr.model.HRHoliday> hrHolidaies) throws SystemException { try { for (com.liferay.hr.model.HRHoliday hrHoliday : hrHolidaies) { removeHRHoliday.remove(pk, hrHoliday.getPrimaryKey()); } } catch (Exception e) { throw processException(e); } finally { FinderCacheUtil.clearCache(HROfficeModelImpl.MAPPING_TABLE_HRHOLIDAYS_HROFFICES_NAME); } }
/** * Sets the h r holidaies associated with the h r office, removing and adding associations as * necessary. Also notifies the appropriate model listeners and clears the mapping table finder * cache. * * @param pk the primary key of the h r office * @param hrHolidaies the h r holidaies to be associated with the h r office * @throws SystemException if a system exception occurred */ public void setHRHolidaies(long pk, List<com.liferay.hr.model.HRHoliday> hrHolidaies) throws SystemException { try { long[] hrHolidayPKs = new long[hrHolidaies.size()]; for (int i = 0; i < hrHolidaies.size(); i++) { com.liferay.hr.model.HRHoliday hrHoliday = hrHolidaies.get(i); hrHolidayPKs[i] = hrHoliday.getPrimaryKey(); } setHRHolidaies(pk, hrHolidayPKs); } catch (Exception e) { throw processException(e); } finally { FinderCacheUtil.clearCache(HROfficeModelImpl.MAPPING_TABLE_HRHOLIDAYS_HROFFICES_NAME); } }
/** * Adds an association between the h r office and the h r holiday. Also notifies the appropriate * model listeners and clears the mapping table finder cache. * * @param pk the primary key of the h r office * @param hrHoliday the h r holiday * @throws SystemException if a system exception occurred */ public void addHRHoliday(long pk, com.liferay.hr.model.HRHoliday hrHoliday) throws SystemException { try { addHRHoliday.add(pk, hrHoliday.getPrimaryKey()); } catch (Exception e) { throw processException(e); } finally { FinderCacheUtil.clearCache(HROfficeModelImpl.MAPPING_TABLE_HRHOLIDAYS_HROFFICES_NAME); } }
/** * Sets the h r holidaies associated with the h r office, removing and adding associations as * necessary. Also notifies the appropriate model listeners and clears the mapping table finder * cache. * * @param pk the primary key of the h r office * @param hrHolidayPKs the primary keys of the h r holidaies to be associated with the h r office * @throws SystemException if a system exception occurred */ public void setHRHolidaies(long pk, long[] hrHolidayPKs) throws SystemException { try { Set<Long> hrHolidayPKSet = SetUtil.fromArray(hrHolidayPKs); List<com.liferay.hr.model.HRHoliday> hrHolidaies = getHRHolidaies(pk); for (com.liferay.hr.model.HRHoliday hrHoliday : hrHolidaies) { if (!hrHolidayPKSet.remove(hrHoliday.getPrimaryKey())) { removeHRHoliday.remove(pk, hrHoliday.getPrimaryKey()); } } for (Long hrHolidayPK : hrHolidayPKSet) { addHRHoliday.add(pk, hrHolidayPK); } } catch (Exception e) { throw processException(e); } finally { FinderCacheUtil.clearCache(HROfficeModelImpl.MAPPING_TABLE_HRHOLIDAYS_HROFFICES_NAME); } }
protected void clear(long hrOfficeId) throws SystemException { ModelListener<com.liferay.hr.model.HRHoliday>[] hrHolidayListeners = hrHolidayPersistence.getListeners(); List<com.liferay.hr.model.HRHoliday> hrHolidaies = null; if ((listeners.length > 0) || (hrHolidayListeners.length > 0)) { hrHolidaies = getHRHolidaies(hrOfficeId); for (com.liferay.hr.model.HRHoliday hrHoliday : hrHolidaies) { for (ModelListener<HROffice> listener : listeners) { listener.onBeforeRemoveAssociation( hrOfficeId, com.liferay.hr.model.HRHoliday.class.getName(), hrHoliday.getPrimaryKey()); } for (ModelListener<com.liferay.hr.model.HRHoliday> listener : hrHolidayListeners) { listener.onBeforeRemoveAssociation( hrHoliday.getPrimaryKey(), HROffice.class.getName(), hrOfficeId); } } } _sqlUpdate.update(new Object[] {new Long(hrOfficeId)}); if ((listeners.length > 0) || (hrHolidayListeners.length > 0)) { for (com.liferay.hr.model.HRHoliday hrHoliday : hrHolidaies) { for (ModelListener<HROffice> listener : listeners) { listener.onAfterRemoveAssociation( hrOfficeId, com.liferay.hr.model.HRHoliday.class.getName(), hrHoliday.getPrimaryKey()); } for (ModelListener<com.liferay.hr.model.HRHoliday> listener : hrHolidayListeners) { listener.onAfterRemoveAssociation( hrHoliday.getPrimaryKey(), HROffice.class.getName(), hrOfficeId); } } } }