protected void doRemove(Serializable id) { try { AccessLimitPK pk = (AccessLimitPK) id; getController().revoke(AccessLimitData.getDataID(null, pk)); logger.info("revoked[AccessLimit(id=" + pk + ")]"); } catch (ControllerException e) { logger.error("failed to revoke instance.", e); } catch (DataNotFoundException e) { logger.error("failed to find data.", e); } }
/* * (non-Javadoc) * @see jp.go.nict.langrid.p2pgridbasis.dao#updateData(jp.go.nict.langrid.p2pgridbasis.data.Data) */ public synchronized boolean updateDataTarget(Data data) throws DataDaoException, UnmatchedDataTypeException { logger.debug("[AccessLimit] : " + data.getId()); if (data.getClass().equals(AccessLimitData.class) == false) { throw new UnmatchedDataTypeException( AccessLimitData.class.toString(), data.getClass().toString()); } boolean updated = false; if (data.getAttributes().getKeys().contains("IsDeleted") && data.getAttributes().getValue("IsDeleted").equals("true")) { try { logger.debug("Delete"); AccessLimitData accessLimitData = (AccessLimitData) data; AccessLimit limit = accessLimitData.getAccessLimit(); removeEntityListener(); dao.deleteAccessLimit( limit.getUserGridId(), limit.getUserId(), limit.getServiceGridId(), limit.getServiceId(), limit.getPeriod(), limit.getLimitType()); updated = true; setEntityListener(); getController().baseSummaryAdd(data); } catch (DataConvertException e) { throw new DataDaoException(e); } catch (ServiceNotFoundException e) { // // try { getController().baseSummaryAdd(data); } catch (ControllerException e1) { e1.printStackTrace(); } } catch (DaoException e) { throw new DataDaoException(e); } catch (ParseException e) { throw new DataDaoException(e); } catch (ControllerException e) { throw new DataDaoException(e); } return updated; } AccessLimit limit = null; try { AccessLimitData accessLimitData = (AccessLimitData) data; limit = accessLimitData.getAccessLimit(); logger.debug("New or UpDate"); removeEntityListener(); daoContext.beginTransaction(); daoContext.mergeEntity(limit); daoContext.commitTransaction(); setEntityListener(); getController().baseSummaryAdd(data); updated = true; } catch (ParseException e) { throw new DataDaoException(e); } catch (DaoException e) { throw new DataDaoException(e); } catch (DataConvertException e) { throw new DataDaoException(e); } catch (ControllerException e) { throw new DataDaoException(e); } return updated; }