/** Retrieve all RoutingRule PKs */ public Collection<RoutingRulePOJOPK> getRoutingRulePKs(String regex) throws XtentisException { Collection<ObjectPOJOPK> routingRules = ObjectPOJO.findAllPKs(RoutingRulePOJO.class, regex); ArrayList<RoutingRulePOJOPK> l = new ArrayList<RoutingRulePOJOPK>(); for (ObjectPOJOPK currentRule : routingRules) { l.add(new RoutingRulePOJOPK(currentRule)); } return l; }
/** Remove a RoutingRule */ public RoutingRulePOJOPK removeRoutingRule(RoutingRulePOJOPK pk) throws XtentisException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Removing " + pk.getUniqueId()); } try { return new RoutingRulePOJOPK(ObjectPOJO.remove(RoutingRulePOJO.class, pk)); } catch (XtentisException e) { throw (e); } catch (Exception e) { String err = "Unable to remove the Routing Rule " + pk.toString() + ": " + e.getClass().getName() + ": " + e.getLocalizedMessage(); LOGGER.error(err, e); throw new XtentisException(err, e); } }
/** Get a RoutingRule - no exception is thrown: returns null if not found */ public RoutingRulePOJO existsRoutingRule(RoutingRulePOJOPK pk) throws XtentisException { try { return ObjectPOJO.load(RoutingRulePOJO.class, pk); } catch (XtentisException e) { return null; } catch (Exception e) { String info = "Could not check whether this Routing Rule \"" + pk.getUniqueId() + "\" exists: " + ": " + e.getClass().getName() + ": " + e.getLocalizedMessage(); if (LOGGER.isDebugEnabled()) { LOGGER.debug(info, e); } return null; } }
/** Get menu */ public RoutingRulePOJO getRoutingRule(RoutingRulePOJOPK pk) throws XtentisException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("getRoutingRule() "); } try { RoutingRulePOJO rule = ObjectPOJO.load(RoutingRulePOJO.class, pk); if (rule == null) { String err = "The Routing Rule " + pk.getUniqueId() + " does not exist."; LOGGER.error(err); throw new XtentisException(err); } return rule; } catch (Exception e) { String err = "Unable to get the Routing Rule " + pk.toString() + ": " + e.getClass().getName() + ": " + e.getLocalizedMessage(); LOGGER.error(err, e); throw new XtentisException(err, e); } }