<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Require setting A and/or B in custom element</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=8332257" />
  <subtitle>Require setting A and/or B in custom element</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=8332257</id>
  <updated>2013-05-23T07:46:57Z</updated>
  <dc:date>2013-05-23T07:46:57Z</dc:date>
  <entry>
    <title>RE: Re: New Message from Matthew Reiter in Customer Voice Portal (CVP) - Ge</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8450073" />
    <author>
      <name>Matthew Reiter</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8450073</id>
    <updated>2012-11-09T14:48:09Z</updated>
    <published>2012-11-09T14:47:57Z</published>
    <summary type="html">The CVP 9.0(1) javadoc has now been posted to the [url=http://developer.cisco.com/web/cvp/documentation]documentation page[/url].</summary>
    <dc:creator>Matthew Reiter</dc:creator>
    <dc:date>2012-11-09T14:47:57Z</dc:date>
  </entry>
  <entry>
    <title>Re: New Message from Matthew Reiter in Customer Voice Portal (CVP) - Genera</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8398166" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8398166</id>
    <updated>2012-11-07T17:52:48Z</updated>
    <published>2012-11-07T17:52:48Z</published>
    <summary type="html">Thanks Matt!</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2012-11-07T17:52:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Asher Schweigart in Customer Voice Portal (CVP) - Gene</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8369490" />
    <author>
      <name>Matthew Reiter</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8369490</id>
    <updated>2012-11-07T00:13:43Z</updated>
    <published>2012-11-07T00:03:57Z</published>
    <summary type="html">I'm looking into getting the javadoc on [url=http://developer.cisco.com/web/cvp/documentation]http://developer.cisco.com/web/cvp/documentation[/url] updated, but until then I've attached the latest javadoc for CVP 9.0(1). The attached javadoc includes several classes that are missing on the DVD, including com.audium.server.voiceElement.SettingValidator.
 
I misremembered when custom validation was added - it was actually in CVP 8.5(1). The javadoc related to custom validation for CVP 9.0(1) should apply equally well to 8.5(1).</summary>
    <dc:creator>Matthew Reiter</dc:creator>
    <dc:date>2012-11-07T00:03:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Asher Schweigart in Customer Voice Portal (CVP) - Gene</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8358258" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8358258</id>
    <updated>2012-11-06T18:42:19Z</updated>
    <published>2012-11-06T18:42:19Z</published>
    <summary type="html">Hi Matt,
I just looked at the CVP 9 javadocs for VxmlServer and I don't see the SettingValidator there. Can you share more information or documentation on this?
Thanks</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2012-11-06T18:42:19Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Asher Schweigart in Customer Voice Portal (CVP) - Gene</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8343277" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8343277</id>
    <updated>2012-11-06T13:02:51Z</updated>
    <published>2012-11-06T13:02:51Z</published>
    <summary type="html">Hi Matt,
I don't see the Validator mentioned in the CVP 9 Programming Guide. Can you post the javadocs for CVP 9 on the documentation page of the CDN? The current javadocs there were posted in 2008. 
Thanks, Janine
 </summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2012-11-06T13:02:51Z</dc:date>
  </entry>
  <entry>
    <title>RE: Require setting A and/or B in custom element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8338665" />
    <author>
      <name>Janine Graves</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8338665</id>
    <updated>2012-11-06T08:04:38Z</updated>
    <published>2012-11-06T08:04:38Z</published>
    <summary type="html">Matt,
That's great. Where is this new feature documented? Is in the the CVP Programming Guide? Or the Studio Users Guide?
And are there other new features available in the custom java?
I would like to add it to my CVPD-Java training class.
Thanks, Janine</summary>
    <dc:creator>Janine Graves</dc:creator>
    <dc:date>2012-11-06T08:04:38Z</dc:date>
  </entry>
  <entry>
    <title>RE: New Message from Asher Schweigart in Customer Voice Portal (CVP) - Gene</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8331272" />
    <author>
      <name>Matthew Reiter</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8331272</id>
    <updated>2012-11-06T01:58:07Z</updated>
    <published>2012-11-06T01:50:45Z</published>
    <summary type="html">What you are trying to do can be accomplished in CVP 9 using a custom validator (older versions do not have this capability). The following code snippet should do what you want. The way it works is that Setting A is assigned a custom validator that will fail validation if both it and Setting B are left blank.
[code]public class CustomElement extends ElementBase implements ElementInterface {
    @Override
    public Setting[] getSettings() throws ElementException {
        Setting settingA = new Setting("settingA", "Setting A", "The first setting",
                Setting.OPTIONAL, Setting.SINGLE, Setting.SUBSTITUTION_ALLOWED, Setting.STRING);
        Setting settingB = new Setting("settingB", "Setting B", "The second setting",
                Setting.OPTIONAL, Setting.SINGLE, Setting.SUBSTITUTION_ALLOWED, Setting.STRING);
        
        // Validate that at least one of Setting A or Setting B has been set
        settingA.setCustomValidator(new OrValidator(settingB));
        
        return new Setting[] {settingA, settingB};
    }
    // The rest of the class has been omitted
}
class OrValidator implements SettingValidator
{
    private Setting otherSetting;
    
    public OrValidator(Setting otherSetting)
    {
        this.otherSetting = otherSetting;
    }
    
    /**
     * Validation method for OrValidator.
     * @param value The setting to validate.
     * @param setting Contains information about the setting being validated.
     * @param allSettingParams Contains information about all settings in the custom element, keyed by each setting's real name.
     * @return A list of error messages to display.
     */
    @Override
    public List&lt;String&gt; validate(String value, SettingParams params,
            Map&lt;String, SettingParams&gt; allSettingParams)
    {
        List&lt;String&gt; errors = new ArrayList&lt;String&gt;();
        
        SettingParams otherSettingParams = allSettingParams.get(otherSetting.getRealName());
        if (otherSettingParams != null &amp;&amp;
                StringUtils.isEmpty(otherSettingParams.getCurrentValue()) &amp;&amp;
                StringUtils.isEmpty(value))
        {
            errors.add("At least one of " + params.getDisplayName() + " or " +
                    otherSettingParams.getDisplayName() + " must be set.");
        }
        
        return errors;
    }
[/code]</summary>
    <dc:creator>Matthew Reiter</dc:creator>
    <dc:date>2012-11-06T01:50:45Z</dc:date>
  </entry>
  <entry>
    <title>Require setting A and/or B in custom element</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8332256" />
    <author>
      <name>Asher Schweigart</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=8332256</id>
    <updated>2012-11-06T00:34:24Z</updated>
    <published>2012-11-06T00:33:57Z</published>
    <summary type="html">I am writing a custom element, and I need to require setting A and/or B. IE, both can be set, or one can be set, but if neither are set, the project will not validate. 
 
Is there a way to set that in a custom element?</summary>
    <dc:creator>Asher Schweigart</dc:creator>
    <dc:date>2012-11-06T00:33:57Z</dc:date>
  </entry>
</feed>

