public Result validate(ConfigContextEvent cce) {
Result result = super.validate(cce); // Before doing custom validation do basic validation
String choice = cce.getChoice();
try {
if (choice.equals(StaticTest.ADD) || choice.equals(StaticTest.VALIDATE)) {
final SipListener sl = (SipListener) cce.getObject();
Config c = (Config) ((SipService) cce.getClassObject()).parent();
String addr = sl.getExternalSipAddress();
String port = sl.getExternalSipPort();
if (sl.getType().equals("internal")) {
if (addr != null || port != null) {
result.failed(_strMgr.getString("ExternalIsFalse"));
}
}
}
if (choice.equals(StaticTest.UPDATE)) {
if(ServerTags.EXTERNAL_SIP_ADDRESS.equals(cce.getName()) || ServerTags.EXTERNAL_SIP_PORT.equals(cce.getName())) {
final SipListener sl = (SipListener) cce.getClassObject();
final Config c = (Config) ((SipService) sl.parent()).parent();
if (sl.getType().equals("internal")) {
result.failed(_strMgr.getString("ExternalIsFalse"));
}
}
}
} catch (Exception e) {