|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sage.orion.sdata.servlet.accpac.JiBXConfigurationAbstractResource
com.sage.orion.sdata.servlet.accpac.ReferencedResource
public final class ReferencedResource
The ReferencedResource
class defines how a Resource
references some other Resource
. This is in terms of what SData
calls a "reference" relationship, and is sometimes known as a 'foreign'
relationship.
The class is intended for use by the JiBX parser during the parsing of the
configuration files. As such it will be constructed and populated during the
parsing phase, and the configuration errors will then be retrieved. Only then
will it be queried. This means that the setters can only be called during the
parsing phase, and any getter, including JiBXConfigurationAbstractResource.getConfigurationErrors()
,
ends that phase.
The class is used in two different ways (perhaps at the same time). It is used to provide "lookup fields" and it is used to provide "related resources".
In both cases the ReferencedResource will have a name, available via the
getName()
getter. Also in both cases the
getReferencedKeyFields()
method returns which fields in this resource
map to the primary key of the referenced resource.
When used for lookup fields the getLookupFields()
returns the
information to allow the caller to map fields of the related resource to
mirroring fields in this resource.
When used for "related resources" the getProperty()
method returns the
name of the property in this resource which corresponds to the referenced
resource. In this case the getDescription()
provides a description
for the property, for use as a label.
Constructor Summary | |
---|---|
ReferencedResource()
|
Method Summary | |
---|---|
void |
addLookupField(LookupField field)
adds the given field to the list of lookup fields. |
void |
addReferencedKeyField(ReferencedKeyField field)
adds the given field to the list of lookup fields. |
java.lang.String |
getDescription()
returns the description of the referenced resource, the value that can be used as a label for the property in schemas. |
java.util.Collection<? extends java.lang.String> |
getLookupFieldNames()
returns a collection view of all the exposed SData names of the lookup fields in this referenced resource. |
java.util.Collection<LookupField> |
getLookupFields()
returns an unmodifiable view of the lookup fields defined for the referenced resource |
java.lang.String |
getName()
returns the name of the referenced resource. |
java.lang.String |
getProperty()
gets the 'property', the name that this referenced resource has in the resource referring to it. |
java.util.List<ReferencedKeyField> |
getReferencedKeyFields()
returns an unmodifiable view of the referenced key fields defined for the referenced resource. |
boolean |
isForRelatedResource()
returns whether this instance is configured to support a related resource. |
boolean |
keyUsesField(java.lang.String name)
gets whether the given field name is in the key to a related resource |
boolean |
keyUsesFields(java.util.Set<java.lang.String> fieldNames)
checks to see if this reference uses any of the specified fields. |
protected void |
onEndBuilding()
change from building mode into querying mode. |
void |
setDescription(java.lang.String description)
sets the description of the referenced resource, the value that can be used as a label for the property in schemas. |
void |
setName(java.lang.String name)
sets the name of the referenced resource. |
void |
setProperty(java.lang.String property)
sets the property, the name that this referenced resource has in the resource referring to it. |
Methods inherited from class com.sage.orion.sdata.servlet.accpac.JiBXConfigurationAbstractResource |
---|
addConfigurationError, endBuilding, ensureStillBuilding, getConfigurationErrors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReferencedResource()
Method Detail |
---|
public void addLookupField(LookupField field)
This list is returned by getLookupFields()
.
field
- the non-null field to addpublic void addReferencedKeyField(ReferencedKeyField field)
This list is returned by getReferencedKeyFields()
.
field
- the non-null field to addpublic java.util.Collection<LookupField> getLookupFields()
public java.lang.String getName()
This is the same as provided to setName(String)
, except trimmed.
public boolean keyUsesFields(java.util.Set<java.lang.String> fieldNames)
fieldNames
- the names of the fields to check for. The set will not be
modified.
keyUsesField(String)
public boolean keyUsesField(java.lang.String name)
name
- the internal name of the field which might be in the key
true
if the named field is in the keyReferencedKeyField.getViewFieldName()
,
keyUsesFields(Set)
public java.util.List<ReferencedKeyField> getReferencedKeyFields()
These fields map in the order defined to the key fields of the related resource.
public void setName(java.lang.String name)
name
- the name of the referenced resource. This must be non-null and
non-empty (after trimming)protected void onEndBuilding()
onEndBuilding
in class JiBXConfigurationAbstractResource
public java.util.Collection<? extends java.lang.String> getLookupFieldNames()
public java.lang.String getProperty()
isForRelatedResource()
public boolean isForRelatedResource()
when this is true getProperty()
will return a non-null value.
true
if this instance can be used to support related
resourcespublic void setProperty(java.lang.String property)
property
- the property to set, which may be null or non-blank, but must
not be blankgetDescription()
,
getProperty()
,
isForRelatedResource()
public java.lang.String getDescription()
This is equal to the trimmed version of the value passed to
setDescription(String)
, and will be null if a null value was
passed.
getDescription()
,
getProperty()
public void setDescription(java.lang.String description)
Setting the description when the property is not set results in a configuration error.
description
- the description to set, which may be null or blank.getDescription()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |