com.esri.arcgis.geodatabase
Interface IAttributeRule

All Superinterfaces:
IRule, Serializable
All Known Implementing Classes:
AttributeRule

public interface IAttributeRule
extends IRule, Serializable

Provides access to members that return, modify and validate attribute rules.

Description

IAttributeRule interface is used to maintain information about attribute rules. Validation of attribute rules is a function of this interface. Setting/retrieving the domain name, fieldname, subtypecode of a particular attribute rule are members of this interface.

Remarks

IAttributeRule is for setting rules based on attributes for object classes. They describe the legal values for a field in an object class. For example, you might set an attribute rule that specifies wood poles can only be within a certain height range. You do this by establishing a range domain for pole heights and then using an attribute rule to apply this domain to a particular field in the pole object class, probably the height field.

When To Use

IAttributeRule is the interface on a AttributeRule object used to get and set the properties of an Attribute Rule. You can use the Validate function of the attribute rule object to validate a particular row against this attribute rule. The validate function returns a boolean value of TRUE if it is valid and FALSE if it was not.

Example:

//Create a SDE workspace
IWorkspaceFactory pFact = null;
pFact = new SdeWorkspaceFactory();
//Open the connection to an sde server
IWorkspace pWorkspace = null;
pWorkspace = pFact.openFromFile("d:/MyConnections/sdeserver_vtest.sde", 0);
//workspace of that connection
IFeatureWorkspace pFeatws = null;
pFeatws = new IFeatureWorkspaceroxy(pWorkspace);
//feature dataset of that feature workspace
IFeatureDataset pFeatds =null;
pFeatds = pFeatws.openFeatureDataset("vtest.utilities");
IFeatureClassContainer pFeatclscont = null;
pFeatclscont = new IFeatureClassContainerProxy(pFeatds);
IFeatureClass pFeatcls = null;
pFeatcls = pFeatclscont.classByName("vtest.poles");
//Create a new attribute rule object to hold the new attribute rule
IAttributeRule pAttributeRule= null;
pAttributeRule = new AttributeRule();

pAttributeRule.setCategory (1);
pAttributeRule.setDomainName ("Wood Pole Height Constraints");
pAttributeRule.setFieldName("height");
pAttributeRule.setHelpstring("Attribute rule for poles");
pAttributeRule.setSubtypeCode(200);
//Must create a rule object in order to add it to a feature class
IRule pRule = null;
pRule = newIRuleProxy(pAttributeRule);
IValidation pValidation = null;
pValidation = new IValidationProxy(pPFeatcls);
//Add the rule to the buildings featureclass
pValidation.addRule(pRule);

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Summary
 String getDomainName()
          The domain name associated with the attribute rule.
 String getFieldName()
          The field name associated with the attribute rule.
 int getSubtypeCode()
          The subtype code.
 void setDomainName(String name)
          The domain name associated with the attribute rule.
 void setFieldName(String name)
          The field name associated with the attribute rule.
 void setSubtypeCode(int value)
          The subtype code.
 boolean validate(IRow row, String[] errorMessage)
          Validates the rule.
 
Methods inherited from interface com.esri.arcgis.geodatabase.IRule
getCategory, getHelpstring, getID, getType, setCategory, setHelpstring, setID
 

Method Detail

getDomainName

String getDomainName()
                     throws IOException,
                            AutomationException
The domain name associated with the attribute rule.

Description

DomainName property returns the DomainName of the given Attribute rule.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setDomainName

void setDomainName(String name)
                   throws IOException,
                          AutomationException
The domain name associated with the attribute rule.

Description

DomainName property sets the domain name for the given attribute rule.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
name - The name (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFieldName

String getFieldName()
                    throws IOException,
                           AutomationException
The field name associated with the attribute rule.

Description

FieldName property returns the field name of the given attribute rule.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The name
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setFieldName

void setFieldName(String name)
                  throws IOException,
                         AutomationException
The field name associated with the attribute rule.

Description

FieldName property sets the field name that this rule is to apply to.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
name - The name (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSubtypeCode

int getSubtypeCode()
                   throws IOException,
                          AutomationException
The subtype code.

Description

SubtypeCode property retrieves the subtypecode that this rule will apply to.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The value
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSubtypeCode

void setSubtypeCode(int value)
                    throws IOException,
                           AutomationException
The subtype code.

Description

SubtypeCode sets the subtypecode that this rule will apply to.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
value - The value (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

validate

boolean validate(IRow row,
                 String[] errorMessage)
                 throws IOException,
                        AutomationException
Validates the rule.

Description

Validate function validates a row against this attribute rule, placing an error message if any is generated in the error message string parameter. Returns a boolean TRUE if row is valid and FALSE if not.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
row - A reference to a com.esri.arcgis.geodatabase.IRow (in)
errorMessage - The errorMessage (out: use single element array)
Returns:
The isValid
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.