/** Update the ChannelInfo and its related profiles to the database. */ static void updateChannel(ChannelInfo channel) throws Throwable { try { IChannelManagerObj mgr = ServiceLookupHelper.getChannelManager(); mgr.updateChannelInfo(channel); mgr.updateCommInfo(channel.getTptCommInfo()); mgr.updatePackagingInfo(channel.getPackagingProfile()); mgr.updateSecurityInfo(channel.getSecurityProfile()); } catch (Throwable t) { Logger.warn("[DelegateHelper.updateChannel] Error ", t); throw new Exception("Unable to update Channel related information"); } }
/** * Delete Channels with the specified refId. * * @param refId The ReferenceId of the ChannelInfo and related profiles. */ private void deleteChannel(String refId) throws Throwable { DataFilterImpl filter = new DataFilterImpl(); filter.addSingleFilter(null, ChannelInfo.REF_ID, filter.getEqualOperator(), refId, false); // filter.addSingleFilter(filter.getAndConnector(), ChannelInfo.IS_MASTER, // filter.getEqualOperator(), Boolean.TRUE, false); /** @todo to verify whether can just delete like that or don't delete */ IChannelManagerObj mgr = ServiceLookupHelper.getChannelManager(); Collection results = mgr.getChannelInfo(filter); for (Iterator i = results.iterator(); i.hasNext(); ) { ChannelInfo channel = (ChannelInfo) i.next(); mgr.deleteChannelInfo((Long) channel.getKey()); mgr.deleteCommInfo((Long) channel.getTptCommInfo().getKey()); mgr.deletePackigingInfo((Long) channel.getPackagingProfile().getKey()); mgr.deleteSecurityInfo((Long) channel.getSecurityProfile().getKey()); } }