@Override public void validate(DiameterAvp avp) throws AvpNotAllowedException { Dictionary dictionary = DictionarySingleton.getDictionary(); if (dictionary.isConfigured() && dictionary.isEnabled()) { AvpRepresentation rep = dictionary.getAvp(avp.getCode(), avp.getVendorId()); // check for grouped? if (rep != null && rep.isGrouped()) { try { GroupedAvpImpl impl = (GroupedAvpImpl) avp; rep.validate(impl.getGenericData()); } catch (ClassCastException cce) { throw new AvpNotAllowedException("Failed to validate avp, its not grouped!", cce, avp.getCode(), avp.getVendorId()); } } } }
@Override public void validate(DiameterMessage msg) throws AvpNotAllowedException { Dictionary dictionary = DictionarySingleton.getDictionary(); if (dictionary.isConfigured() && dictionary.isEnabled()) { DiameterCommand com = msg.getCommand(); MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest()); if (rep != null) { DiameterMessageImpl impl = (DiameterMessageImpl) msg; try { rep.validate(impl.getGenericData(), ValidatorLevel.ALL); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId()); } } } }