The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Siebel::Integration::Com::PropSet - Abstraction of Siebel Property Set

SYNOPSIS

        use Siebel::Integration::Com;
        
        my $sa = Siebel::Integration::Com->new(
                        ConnectionType=>'Thick', 
                        UserName=>$inputs{user}, 
                        PassWord=>$inputs{pass}, 
                        CFG=>$inputs{cfg}, 
                        DataSource=>$inputs{DataSource}
                );
                                                                                                                                        
        my $PS = $sa->NewPropertySet();
        if($PS->Error ne ''){
                die print "Error creating Prop Set: " . $PS->Error;
        }
        my $ChildPS = $sa->NewPropertySet();
        if($ChildPS->Error ne ''){
                die print "Error creating Prop Set: " . $ChildPS->Error;
        }
        
        $PS->SetType('PropSetType');
        $PS->SetValue('PropSetValue');
        $PS->SetProperty('Prop1', "This is Prop1's value");
        $PS->SetProperty('Prop2', "This is Prop2's value");
        $ChildPS->SetProperty('ChildProp1', "This is ChildProp1's value");
        $ChildPS->SetProperty('ChildProp2', "This is ChildProp2's value");
        $PS->AddChild($ChildPS);
        
        #Print Prop Set details
        print "Parent Level PS has " . $PS->GetPropertyCount() . " properties\n";
        print "Parent Level PS has " . $PS->GetChildCount() . " child\n";
        print "Parent Level PS has a type of " . $PS->GetType() . "\n";
        print "Parent Level PS has a value of " . $PS->GetValue() . "\n";
        
        if(my $Prop = $PS->GetFirstProperty()){
                do{
                        print $Prop . '=>' . $PS->GetProperty($Prop) . "\n";
                }while($Prop = $PS->GetNextProperty());
        }else{
                print "No properties found, something is wrong.";
        }
        my $PSGetChild = $PS->GetChild(0);
        if($PSGetChild->Error ne ''){
                die print "Error GetChild at index 0: " . $PSGetChild->Error;
        }
        
        if(my $Prop = $PSGetChild->GetFirstProperty()){
                do{
                        print "\t" . $Prop . '=>' . $PSGetChild->GetProperty($Prop) . "\n";
                }while($Prop = $PSGetChild->GetNextProperty());
        }else{
                print "No properties found in child, something is wrong.";
        }
        
        #prints
                #Parent Level PS has 2 properties
                #Parent Level PS has 1 child
                #Parent Level PS has a type of PropSetType
                #Parent Level PS has a value of PropSetValue
                #Prop2=>This is Prop2's value
                #Prop1=>This is Prop1's value
                #               ChildProp1=>This is ChildProp1's value
                #               ChildProp2=>This is ChildProp2's value
        
        #a simpler way of dumping property sets is with these 2 methods. These methods will also get all children and grandchildren and so on
        print $PS->ToXML();
        
        print $PS->ToText();
        
        #remove a property by name
        $PS->RemoveProperty('Prop1');
        
        #remove a child PS by index
        $PS->RemoveChild(0);

DESCRIPTION

The Siebel::Integration::Com modules are designed to remove the different method calls and error checking between the COM Data Control and COM Data Server interfaces. Changing between the two interfaces only requires a change in the parameters to Siebel::Integration::Com->new() rather than a rewrite of all calls. Beyond just replicating the base functions of the interfaces it is hoped that additional methods will be added to these modules to extend the functionality provided by the Siebel COM framework.

All methods that have been exposed keep the same names so there is no additional learning curve, you can program in Perl using the same method names as eScript

Base Methods

PS->Error()
        Returns the error text for the last operation, returns '' if no error.
PS->GetPropertyCount()
        Returns the number of Properties
PS->GetFirstProperty()
        Returns the first properties name or ''
PS->GetNextProperty()
        Returns the next properties name or ''
PS->GetType()
        Returns the value of the type attribute of a property set or ''
PS->GetValue()
        Returns the value of the value attribute of a property set or ''
PS->GetProperty(PropName)
        Returns the value of the property, if property does not exist will return ''
PS->PropertyExists(PropName)
        Returns 0 (false) or 1 (true)
PS->SetProperty(PropName, PropValue)
        Returns 1 for success or undef for failure. A failure will set PS->Error
PS->GetChildCount()
        Returns the number of child property sets
PS->GetChild(Index)
        Returns a new Siebel::Integration::Com::PropSet object containing the Siebel property set at the specified index
        Returns undef on failure and sets PS->Error
PS->AddChild(ChildPS)
        Takes a Siebel::Integration::Com::PropSet or a raw Siebel property set
        Returns the index of the child property set
        Returns undef on failure and sets PS->Error
PS->Copy()
        Returns a new Siebel::Integration::Com::PropSet object containing a duplicated Siebel propery set. 
        Returns undef on failure and sets PS->Error
PS->Reset()
        Clears all Siebel property set data from the object. 
        Returns 1 for success. 
        Returns undef on failure and sets PS->Error
PS->SetType(Value)
        Sets the value for the type attribute of a property set
        Returns 1 for success. 
        Returns undef on failure and sets PS->Error
PS->SetValue(Value)
        Sets the value for the value attribute of a property set
        Returns 1 for success. 
        Returns undef on failure and sets PS->Error
PS->InsertChildAt(ChildObject, Index)
        Inserts a child property set in a parent property set at a specific location
        Returns 1 on success
        Returns undef on failure and sets PS->Error
PS->RemoveChild(Index)
        Removes a child property set from a parent property set
        Returns 1 on success
        Returns undef on failure and sets PS->Error
PS->RemoveProperty(PropName)
        Removes a property from a property set
        Returns 1 on success
        Returns undef on failure and sets PS->Error
PS->ConnectionType
        The current connection type Thin or Thick
New(ConnectionType=>'Thin/Thick', SApp=>Siebel::Integration::Com)
        Only called internally from Siebel::Integration::Com NewPropertySet()
        Returns a Siebel::Integration::Com::PropSet
        Sets PS->Error if an error occurs

Extended Methods

PS->ToXML
        Returns the property set in XML
        Example result:
        <PropertySet type='PropSetType' value='PropSetValue'>
          <Prop2>This is Prop2's value</Prop2>
          <Prop1>This is Prop1's value</Prop1>
          <PropertySet0>
            <ChildProp1>This is ChildProp1's value</ChildProp1>
            <ChildProp2>This is ChildProp2's value</ChildProp2>
            <PropertySet0>
              <GChildProp2>This is GChildProp2's value</GChildProp2>
              <GChildProp3>This is GChildProp3's value</GChildProp3>
              <GChildProp4>This is GChildProp4's value</GChildProp4>
              <GChildProp1>This is GChildProp1's value</GChildProp1>
            </PropertySet0>
          </PropertySet0>
          <PropertySet1>
            <Child2Prop1>This is Child2Prop1's value</Child2Prop1>
            <Child2Prop2>This is Child2Prop2's value</Child2Prop2>
          </PropertySet1>
        </PropertySet>

        
PS->ToText
        Returns the property set as text
        Example result:
        
        Property Set Type => PropSetType
        Property Set Value => PropSetValue
        --------------------------------------------------
          Prop2=>This is Prop2's value
          Prop1=>This is Prop1's value
        --------------------------------------------------
            ChildProp1=>This is ChildProp1's value
            ChildProp2=>This is ChildProp2's value
        --------------------------------------------------
              GChildProp2=>This is GChildProp2's value
              GChildProp3=>This is GChildProp3's value
              GChildProp4=>This is GChildProp4's value
              GChildProp1=>This is GChildProp1's value
        --------------------------------------------------
            Child2Prop1=>This is Child2Prop1's value
            Child2Prop2=>This is Child2Prop2's value

REQUIREMENTS

See Siebel::Integration::Com

TESTING

See Siebel::Integration::Com

SEE ALSO

The documentation for Siebel::Integration::Com contains additional information

REFERENCES

Oracle Help Property Set Methods

AUTHOR

Kyle Mathers, <kyle.perl at mathersit.com>

COPYRIGHT

The same as Siebel::Integration::Com

VERSION

Version 0.02 March 2013