Platform SDK Java 8.5 API Reference

com.genesyslab.platform.applicationblocks.com.capacityrules
Class CapacityRuleHelper

java.lang.Object
  extended by com.genesyslab.platform.applicationblocks.com.capacityrules.CapacityRuleHelper

public class CapacityRuleHelper
extends java.lang.Object

Helper class to retrieve CapacityRule data from CfgScript object.

Example of using helper-class:

 ConfServerProtocol protocol = new ConfServerProtocol(new Endpoint(host, port));
 protocol.setClientApplicationType(appType);
 protocol.setClientName("default");
 protocol.setUserName(userName);
 protocol.setUserPassword(userPassword);
 IConfService service = (IConfService)ConfServiceFactory.createConfService(protocol);
 service.getProtocol().open();
 CfgScriptQuery query = new CfgScriptQuery(service);
 CfgScript script = (CfgScript)service.retrieveObject(query);
 CapacityRuleHelper helper = CapacityRuleHelper.create(script);
 Document doc = helper.getXMLPresentation();
 
 // edit xml document here
 
 helper.setXMLPresentation(doc);
 helper.getCfgScript().save();
 service.getProtocol().close();
 ConfServiceFactory.releaseConfService(service);
 


Method Summary
static CapacityRuleHelper create(CfgScript script)
          Creates instance of CapacityRuleHelper class.
 boolean equalsBinaries(byte[] capacityRulesBinary)
          Compares current capacity rule binary presentation with another binaries presentation for equality (ignoring item order).
static boolean equalsBinaries(byte[] capacityRulesBinary1, byte[] capacityRulesBinary2)
          Compares two capacity rules binary presentations for equality (ignoring item order).
static byte[] getBinaryFromXML(org.w3c.dom.Document doc)
          Gets optimized capacity rule binary representation according to passed xml presentation of capacity rule.
static byte[] getBinaryFromXML(java.lang.String xml)
          Gets optimized capacity rule binary representation according to passed xml presentation of capacity rule.
 byte[] getBinaryPresentation()
          Gets binary presentation of CapacityRule in CfgScript object.
 CfgScript getCfgScript()
          Gets COM AB CfgScript object instance.
 ValidationResult getValidationResult()
          Gets a result of internal validation of capacity rule.
 org.w3c.dom.Document getXMLPresentation()
          Gets XML presentation of CapacityRule in CfgScript object.
 java.lang.String getXMLStringData()
          Gets XML data as string.
 boolean isEmpty()
          Gets flag indicates that script does not have any data of capacity rule.
 boolean isEnabledValidation()
          Gets flag that indicate if enabled or disabled internal validation of capacity rule.
 boolean matchBinaries(byte[] capacityRulesBinary)
          Compares current capacity rule binary presentation with another binaries presentation for equivalence (ignoring item order).
static boolean matchBinaries(byte[] capacityRulesBinary1, byte[] capacityRulesBinary2)
          Compares two capacity rules binary presentations for equivalence (ignoring item order) according to their's truth tables.
 void setEnabledValidation(boolean enabledValidation)
          Set to true before assign new XML-presentation to validate results.
 void setXMLPresentation(org.w3c.dom.Document doc)
          Sets XML presentation of CapacityRule in CfgScript object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isEmpty

public boolean isEmpty()
Gets flag indicates that script does not have any data of capacity rule.

Returns:
flag indicates that script does not have any data of capacity rule.

isEnabledValidation

public boolean isEnabledValidation()
Gets flag that indicate if enabled or disabled internal validation of capacity rule.
Note:Enabled the flag reduce performance.

Returns:
flag that indicate if enabled or disabled internal validation of capacity rule.

setEnabledValidation

public void setEnabledValidation(boolean enabledValidation)
Set to true before assign new XML-presentation to validate results.

Parameters:
enabledValidation - flag that indicate if enabled or disabled internal validation of capacity rule.

getValidationResult

public ValidationResult getValidationResult()
Gets a result of internal validation of capacity rule.

Returns:
result of internal validation of capacity rule.

matchBinaries

public static boolean matchBinaries(byte[] capacityRulesBinary1,
                                    byte[] capacityRulesBinary2)
                             throws CapacityRuleException
Compares two capacity rules binary presentations for equivalence (ignoring item order) according to their's truth tables.

Parameters:
capacityRulesBinary1 - a binary presentation of 1st capacity rule
capacityRulesBinary2 - a binary presentation of 2nd capacity rule
Returns:
true if both capacity rules is equivalent else return false.
Throws:
CapacityRuleException - if occurs some problem in the binaries parsing.
java.lang.IllegalArgumentException - if any argument is null.

matchBinaries

public boolean matchBinaries(byte[] capacityRulesBinary)
                      throws CapacityRuleException
Compares current capacity rule binary presentation with another binaries presentation for equivalence (ignoring item order). according to their's truth tables.

Parameters:
capacityRulesBinary - a binary presentation of other capacity rule
Returns:
true if this capacity rule is equivalent to another binary presentation of capacity rule.
Throws:
CapacityRuleException - if occurs some problem in the binary parsing.
java.lang.IllegalArgumentException - if the argument is null.
java.lang.IllegalStateException - if the current binary presentation is is null.

equalsBinaries

public static boolean equalsBinaries(byte[] capacityRulesBinary1,
                                     byte[] capacityRulesBinary2)
                              throws CapacityRuleException
Compares two capacity rules binary presentations for equality (ignoring item order).

Parameters:
capacityRulesBinary1 - a binary presentation of 1st capacity rule
capacityRulesBinary2 - a binary presentation of 2nd capacity rule
Returns:
true if both capacity rules is equals else return false.
Throws:
CapacityRuleException - if occurs some problem in the binaries parsing.
java.lang.IllegalArgumentException - if any argument is null.

equalsBinaries

public boolean equalsBinaries(byte[] capacityRulesBinary)
                       throws CapacityRuleException
Compares current capacity rule binary presentation with another binaries presentation for equality (ignoring item order).

Parameters:
capacityRulesBinary - a binary presentation of other capacity rule
Returns:
true if this capacity rule is equals to another binary presentation of capacity rule.
Throws:
CapacityRuleException - if occurs some problem in the binary parsing.
java.lang.IllegalArgumentException - if the argument is null.
java.lang.IllegalStateException - if the current binary presentation is is null.

getBinaryFromXML

public static byte[] getBinaryFromXML(org.w3c.dom.Document doc)
                               throws CapacityRuleException
Gets optimized capacity rule binary representation according to passed xml presentation of capacity rule.

Parameters:
doc - document presentation of capacity rule.
Returns:
binary binary representation of optimized capacity rule.
Throws:
CapacityRuleException - when occurs some problem in XML parsing.

getBinaryFromXML

public static byte[] getBinaryFromXML(java.lang.String xml)
                               throws CapacityRuleException
Gets optimized capacity rule binary representation according to passed xml presentation of capacity rule.

Parameters:
xml - XML presentation of capacity rule.
Returns:
binary binary representation of optimized capacity rule.
Throws:
CapacityRuleException - when occurs some problem in XML parsing.

create

public static CapacityRuleHelper create(CfgScript script)
                                 throws ConfigException
Creates instance of CapacityRuleHelper class. Verifies script object and retrieves data.

Parameters:
script - instance of CfgScript object.
Returns:
instance of this helper class.
Throws:
ConfigException - if script has invalid format.
java.lang.IllegalArgumentException - if script is null or script type isn't CFGCapacityRule.

getXMLPresentation

public org.w3c.dom.Document getXMLPresentation()
Gets XML presentation of CapacityRule in CfgScript object.

Returns:
document presentation of CapacityRule.

setXMLPresentation

public void setXMLPresentation(org.w3c.dom.Document doc)
                        throws CapacityRuleException
Sets XML presentation of CapacityRule in CfgScript object. During setting new XML the new binary data will be created.

Parameters:
doc - Document presentation of CapacityRule. Set null value to delete the rule data.
Throws:
CapacityRuleException - See exception message to identify of problem.

getXMLStringData

public java.lang.String getXMLStringData()
Gets XML data as string.

Returns:
XML data as string

getBinaryPresentation

public byte[] getBinaryPresentation()
Gets binary presentation of CapacityRule in CfgScript object.

Returns:
binary presentation of CapacityRule in CfgScript object.

getCfgScript

public CfgScript getCfgScript()
Gets COM AB CfgScript object instance.

Returns:
COM AB CfgScript object instance.

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.