public String toString() { StringBuffer sb = new StringBuffer(); sb.append("name: ").append(this.getName()).append(", code: ").append(this.getCode()).append(", vendor: ").append(this.getVendorId()).append(", weak: ") .append(this.isWeak()).append(", grouped: ").append(this.isGrouped()).append(", type: ").append(this.getType()).append(", multiplicity: ") .append(this.getMultiplicityIndicator()); if (this.isGrouped()) { for (AvpRepresentation child : this.getChildren()) { String childStr = child.toString().replace("\n", "\n---"); sb.append("\n---" + childStr); } } return sb.toString(); }
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("name: ").append(this.getName()).append(", code: ").append(this.getCode()).append(", vendor: ").append(this.getVendorId()).append(", weak: ") .append(this.isWeak()).append(", grouped: ").append(this.isGrouped()).append(", type: ").append(this.getType()).append(", multiplicity: ") .append(this.getMultiplicityIndicator()); if (this.isGrouped()) { for (AvpRepresentation child : this.getChildren()) { String childStr = child.toString().replace("\n", "\n---"); sb.append("\n---" + childStr); } } return sb.toString(); }
public static void addAvp(Object parent, String avpName, AvpSet set, Object avp) { AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpName); if(rep != null) { addAvp(parent, rep.getCode(), rep.getVendorId(), set, avp); } else { throw new IllegalArgumentException("Unknown AVP with name '" + avpName + "'. Unable to add it."); } }
public static void addAvp(Object parent, String avpName, AvpSet set, Object avp) { AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpName); if(rep != null) { addAvp(parent, rep.getCode(), rep.getVendorId(), set, avp); } else { throw new IllegalArgumentException("Unknown AVP with name '" + avpName + "'. Unable to add it."); } }
public static Object getAvpAsCustom(int avpCode, long vendorId, AvpSet set, Class clazz) { try { Avp avp = set.getAvp(avpCode, vendorId); if (avp != null) { AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpCode, vendorId); Constructor c = null; c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); return c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData()); } } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Custom (Class '" + clazz.getName() + "').", e); } } return null; }
public static Object getAvpAsCustom(int avpCode, long vendorId, AvpSet set, Class clazz) { try { Avp avp = set.getAvp(avpCode, vendorId); if (avp != null) { AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpCode, vendorId); Constructor c = null; c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); return c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData()); } } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Custom (Class '" + clazz.getName() + "').", e); } } return null; }
protected Object getAvp(String avpName) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId()); } return null; }
protected Object getAvp(String avpName) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId()); } return null; }
public static Object getAvp(String avpName, AvpSet set) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId(), set); } return null; }
public static Object[] getAvpsAsCustom(int avpCode, long vendorId, AvpSet set, Class clazz) { try { AvpSet avpSet = set.getAvps(avpCode, vendorId); Object array = Array.newInstance(clazz, avpSet.size()); int i = 0; AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpCode, vendorId); Constructor c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); for(Avp avp : avpSet) { Array.set(array, i++, c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData())); } return (Object[]) array; } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Custom (Class '" + clazz.getName() + "').", e); } return (Object[]) Array.newInstance(clazz, 0); } }
public static Object[] getAvpsAsCustom(int avpCode, long vendorId, AvpSet set, Class clazz) { try { AvpSet avpSet = set.getAvps(avpCode, vendorId); Object array = Array.newInstance(clazz, avpSet.size()); int i = 0; AvpRepresentation rep = AvpDictionary.INSTANCE.getAvp(avpCode, vendorId); Constructor c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); for(Avp avp : avpSet) { Array.set(array, i++, c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData())); } return (Object[]) array; } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " and Vendor-Id " + vendorId + " as type Custom (Class '" + clazz.getName() + "').", e); } return (Object[]) Array.newInstance(clazz, 0); } }
public static Object[] getAvpsAsCustom(int avpCode, AvpSet set, Class clazz) { try { AvpSet avpSet = set.getAvps(avpCode); Object array = Array.newInstance(clazz, avpSet.size()); int i = 0; Constructor c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); AvpRepresentation rep = null; for(Avp avp : avpSet) { rep = AvpDictionary.INSTANCE.getAvp(avpCode, avp.getVendorId()); Array.set(array, i++, c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData())); } return (Object[]) array; } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type Custom (Class '" + clazz.getName() + "').", e); } return (Object[]) Array.newInstance(clazz, 0); } }
public static Object[] getAvpsAsCustom(int avpCode, AvpSet set, Class clazz) { try { AvpSet avpSet = set.getAvps(avpCode); Object array = Array.newInstance(clazz, avpSet.size()); int i = 0; Constructor c = clazz.getConstructor(int.class, long.class, int.class, int.class, byte[].class); AvpRepresentation rep = null; for(Avp avp : avpSet) { rep = AvpDictionary.INSTANCE.getAvp(avpCode, avp.getVendorId()); Array.set(array, i++, c.newInstance(rep.getCode(), rep.getVendorId(), rep.getRuleMandatoryAsInt(), rep.getRuleProtectedAsInt(), avp.getRawData())); } return (Object[]) array; } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to obtain AVP with code " + avpCode + " as type Custom (Class '" + clazz.getName() + "').", e); } return (Object[]) Array.newInstance(clazz, 0); } }
protected Object getAvp(String avpName) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId()); } return null; }
protected Object getAvp(String avpName) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId()); } return null; }
public static Object getAvp(String avpName, AvpSet set) { AvpRepresentation avpRep = AvpDictionary.INSTANCE.getAvp(avpName); if(avpRep != null) { return getAvp(avpRep.getCode(), avpRep.getVendorId(), set); } return null; }
public boolean isAllowed(int avpCode, long vendorId) { if (this.isGrouped()) { // make better get ? for (AvpRepresentation rep : this.children) { if (rep.getCode() == avpCode && rep.getVendorId() == vendorId) { return rep.isAllowed(); } else { continue; } } return true; } else { return false; } }
public boolean isAllowed(int avpCode, long vendorId) { if (this.isGrouped()) { // make better get ? for (AvpRepresentation rep : this.children) { if (rep.getCode() == avpCode && rep.getVendorId() == vendorId) { return rep.isAllowed(); } else { continue; } } return true; } else { return false; } }