com.sap.mdm.data
Interface RelationshipGroup

All Superinterfaces:
Cloneable, RepositoryItem

public interface RelationshipGroup
extends RepositoryItem

This interface represents group of relationships between the one anchor record and list of another records.

See Also:
Relationship, RelationshipProperties

Method Summary
 void addMember(RecordId recordId, int quantity, boolean isRequired, int position)
          Add a new relationship member
 void addMember(Relationship member, int position)
          Add a new relationship member
 boolean containsMember(RecordId recordId)
          Check if this relationship group contains member record with specified ID
 Record getAnchorRecord()
          Get anchor record
 RecordId getAnchorRecordId()
          Get ID of anchor record
 RelationshipId getId()
          Get ID of this relationship
 Relationship getMember(int position)
          Get member relationship on the specified position Is relevant only for 'Child' relationship.
 Relationship getMember(RecordId recordId)
          Get member relationship for the specified record
 Record getMemberRecord(RecordId recordId)
          Get related record with specified ID
 RecordId getMemberRecordId(int position)
          Get member record ID on the specified position Is relevant only for parent/child relationship.
 RecordId[] getMemberRecordIds()
          Get IDs for all records related to the anchor
 Relationship[] getMembers()
          Get all relationship members
 int getMembersCount()
          Get number of relationship members
 RelationshipProperties getMetadata()
          Get metadata of relationship
 int getPosition(RecordId recordId)
          Get position of the specified relationship member.
 int getQuantity(RecordId recordId)
          Get quantity of the specified relationship member
 int getType()
          Get type of this relationship group
 boolean isRequired(RecordId recordId)
          Specify if the specified relationship member is required
 Relationship removeMember(int position)
          Remove the relationship member at specified position Is relevant only for 'Child' relationship.
 Relationship removeMember(RecordId recordId)
          Remove the specified relationship member
 void setPosition(RecordId recordId, int position)
          Set position of the specified relationship member.
 void setQuantity(RecordId recordId, int quantity)
          Set quantity of the specified relationship member
 void setRequired(RecordId recordId, boolean isRequired)
          Set if the specified relationship member is required
 

Method Detail

getId

public RelationshipId getId()
Get ID of this relationship

Returns:
relationship ID

getType

public int getType()
Get type of this relationship group

Returns:
relationship type
See Also:
RelationshipProperties

getAnchorRecord

public Record getAnchorRecord()
Get anchor record

Returns:
anchor record or null if was not loaded

getAnchorRecordId

public RecordId getAnchorRecordId()
Get ID of anchor record

Returns:
anchor record ID

getMembersCount

public int getMembersCount()
Get number of relationship members

Returns:
number of members

getMembers

public Relationship[] getMembers()
Get all relationship members

Returns:
array of Relationship instances

getMemberRecordIds

public RecordId[] getMemberRecordIds()
Get IDs for all records related to the anchor

Returns:
array of IDs for related records

getMember

public Relationship getMember(int position)
                       throws IllegalArgumentException
Get member relationship on the specified position Is relevant only for 'Child' relationship.

Parameters:
position - the position
Returns:
relationship member. Returns null for 'Sibling' of 'Parent' relationship
Throws:
IllegalArgumentException - if wrong position is specified

getMember

public Relationship getMember(RecordId recordId)
                       throws IllegalArgumentException
Get member relationship for the specified record

Parameters:
recordId - record ID
Returns:
relationship member.
Throws:
IllegalArgumentException - if member not exist

getMemberRecordId

public RecordId getMemberRecordId(int position)
                           throws IllegalArgumentException
Get member record ID on the specified position Is relevant only for parent/child relationship.

Parameters:
position - the position
Returns:
membership record. Returns null for Sibling relationship
Throws:
IllegalArgumentException - if wrong position is specified

containsMember

public boolean containsMember(RecordId recordId)
Check if this relationship group contains member record with specified ID

Parameters:
recordId - ID of related record
Returns:
true if record with specified ID is the member of this group

getMemberRecord

public Record getMemberRecord(RecordId recordId)
                       throws IllegalArgumentException
Get related record with specified ID

Parameters:
recordId - ID of related record
Returns:
related record or null if was not loaded
Throws:
IllegalArgumentException - if member not exist

getQuantity

public int getQuantity(RecordId recordId)
                throws IllegalArgumentException
Get quantity of the specified relationship member

Parameters:
recordId - ID of related record
Returns:
quantity
Throws:
IllegalArgumentException - if member not exist

setQuantity

public void setQuantity(RecordId recordId,
                        int quantity)
                 throws IllegalArgumentException
Set quantity of the specified relationship member

Parameters:
recordId - ID of related record
quantity - quantity
Throws:
IllegalArgumentException - if the member doesn't exist

isRequired

public boolean isRequired(RecordId recordId)
                   throws IllegalArgumentException
Specify if the specified relationship member is required

Parameters:
recordId - ID of related record
Returns:
true if this relationship member is required, false otherwise
Throws:
IllegalArgumentException - if member not found

setRequired

public void setRequired(RecordId recordId,
                        boolean isRequired)
                 throws IllegalArgumentException
Set if the specified relationship member is required

Parameters:
recordId - ID of related record
isRequired - specify if this relationship member is required
Throws:
IllegalArgumentException - if member not exist

getPosition

public int getPosition(RecordId recordId)
                throws IllegalArgumentException
Get position of the specified relationship member. Is relevant only for child relationship.

Parameters:
recordId - ID of related record
Returns:
position of member. Returns -1 for 'Sibling' or 'Parent' relationship
Throws:
IllegalArgumentException - if member not found

setPosition

public void setPosition(RecordId recordId,
                        int position)
                 throws IllegalArgumentException
Set position of the specified relationship member. Is relevant only for 'Child' relationship.

Parameters:
recordId - ID of related record
position - new position of relationship member
Throws:
IllegalArgumentException - if member not exist

addMember

public void addMember(RecordId recordId,
                      int quantity,
                      boolean isRequired,
                      int position)
               throws IllegalArgumentException
Add a new relationship member

Parameters:
recordId - ID of related record
quantity - quantity
isRequired -
position - position of relationship member or -1 in order to add to the end (relevant only for 'Child' relationship that can have position, for all other cases this parameter does not play a role)
Throws:
IllegalArgumentException - if wrong position is specified

addMember

public void addMember(Relationship member,
                      int position)
               throws IllegalArgumentException
Add a new relationship member

Parameters:
member - relationship member
position - position of relationship member or -1 in order to add to the end (relevant only for 'Child' relationship that can have position, for all other cases this parameter does not play a role)
Throws:
IllegalArgumentException - if wrong position is specified

removeMember

public Relationship removeMember(RecordId recordId)
                          throws IllegalArgumentException
Remove the specified relationship member

Parameters:
recordId - ID of related record
Returns:
the relationship
Throws:
IllegalArgumentException - if member not exist

removeMember

public Relationship removeMember(int position)
                          throws IllegalArgumentException
Remove the relationship member at specified position Is relevant only for 'Child' relationship.

Parameters:
position - the position
Returns:
removed relationship member. Do nothing and return null for 'Sibling' or 'Parent' type
Throws:
IllegalArgumentException - if wrong position is specified

getMetadata

public RelationshipProperties getMetadata()
Get metadata of relationship

Returns:
RelationshipProperties or null if metadata was not loaded


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.