com.sap.tc.cmi.model

Interface ICMIGenericModelClass

All Superinterfaces:
ICMIModelClass

public interface ICMIGenericModelClass
extends ICMIModelClass

Interface for a generic model class. Model classes that implement this interface are treated specially from the context. Instead of using reflection to access attributes, it uses getAttributeValue(String) and setAttributeValue(String, Object). This type can be called, extended or implemented by applications or frameworks using CMI.

Type Classification Type Classification:

This interface is part of the Common Model Interface and is intended to be implemented by applications.


Method Summary
 boolean addRelatedModelObject(String targetRoleName, ICMIModelClass o)
          adds o to the relation role targetRoleName according to the add method in the java.util.Collection interface.
 ICMIModelClassInfo associatedModelClassInfo()
          returns the metadata, i.e. an object of type ICMIModelClassInfo, corresponding to this model class.
 Object getAttributeValue(String name)
          Returns the value of the attribute with the given name as an Object.
 ICMIModelClass getRelatedModelObject(String targetRoleName)
          Returns null or the appropriate object of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality 1 or 0..1.
 Collection getRelatedModelObjects(String targetRoleName)
          Returns the appropriate collection of objects of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality * or 1..*.
 boolean removeRelatedModelObject(String targetRoleName, ICMIModelClass o)
          removes o from the relation role targetRoleName according to the remove method in the java.util.Collection interface.
 void setAttributeValue(String name, Object value)
          Sets the attribute to given value.
 void setRelatedModelObject(String targetRoleName, ICMIModelClass o)
          Sets the relation role targetRoleName of an x:0..1 or x:1 relation to object o of type ICMIModelClass.
 void setRelatedModelObjects(String targetRoleName, Collection col)
          sets the relation role targetRoleName of an x:* or x:1..* relation to the Collection col, which contains exclusively objects of type ICMIModelClass.
 
Methods inherited from interface com.sap.tc.cmi.model.ICMIModelClass
associatedModel
 

Method Detail

getAttributeValue

public Object getAttributeValue(String name)
Returns the value of the attribute with the given name as an Object. It is unspecified, if the attribute is copied, before it is returned, or not.

Throws:
IllegalArgumentException - if there is no attribute with the given name

setAttributeValue

public void setAttributeValue(String name,
                              Object value)
Sets the attribute to given value. It is unspecified, if value is copied, before it is set, or not.

Throws:
IllegalArgumentException - if there is no attribute with the given name

getRelatedModelObject

public ICMIModelClass getRelatedModelObject(String targetRoleName)
Returns null or the appropriate object of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality 1 or 0..1.

If the role is of cardinality 0..1, null can be returned.

If there is no relation with an the given target rolename, an java.lang.IllegalArgumentException is thrown.


setRelatedModelObject

public void setRelatedModelObject(String targetRoleName,
                                  ICMIModelClass o)
Sets the relation role targetRoleName of an x:0..1 or x:1 relation to object o of type ICMIModelClass.

If o is null and the cardinality of the relation role is 1, a java.lang.NullPointerException exception is thrown.

If this has no target relation role with the given targetRoleName, an java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception for any of the above reasons, no changes have been made of course.


getRelatedModelObjects

public Collection getRelatedModelObjects(String targetRoleName)
Returns the appropriate collection of objects of type ICMIModelClass according to the relation role in targetRoleName, which must have the cardinality * or 1..*.

The collection should be immutable.

If the role is of cardinality 0..*, the collection could be empty, but not null.

If there is no relation with the given target role name, an java.lang.IllegalArgumentException is thrown.

If the method throws an exception, no changes are made of course.


setRelatedModelObjects

public void setRelatedModelObjects(String targetRoleName,
                                   Collection col)
sets the relation role targetRoleName of an x:* or x:1..* relation to the Collection col, which contains exclusively objects of type ICMIModelClass.

If col is null, a java.lang.NullPointerException exception is thrown.

If col is empty and the cardinality of the relation role is 1..*, a java.lang.NullPointerException exception is thrown.

If this has no target relation role with the given targetRoleName, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


addRelatedModelObject

public boolean addRelatedModelObject(String targetRoleName,
                                     ICMIModelClass o)
adds o to the relation role targetRoleName according to the add method in the java.util.Collection interface.

If o is null, a java.lang.NullPointerException exception is thrown and no changes are made of course.

If this has no target relation role with the given targetRoleName and cardinality * or 1..*, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


removeRelatedModelObject

public boolean removeRelatedModelObject(String targetRoleName,
                                        ICMIModelClass o)
removes o from the relation role targetRoleName according to the remove method in the java.util.Collection interface.

If o is null or o was not in the collection, the method silently returns.

If o is the last element in the relation role, and the cardinality of the role is 1..*, a java.lang.IllegalArgumentException is thrown.

If this has no target relation role with the given targetRoleName and cardinality * or 1..*, a java.lang.IllegalArgumentException is thrown.

If the model class or the model are read only, or if the model implementation doesn't support this method, an java.lang.UnsupportedOperationException is thrown.

If the method throws an exception, no changes are made of course.


associatedModelClassInfo

public ICMIModelClassInfo associatedModelClassInfo()
returns the metadata, i.e. an object of type ICMIModelClassInfo, corresponding to this model class. Each implementation has to support this method and must not return null.

Specified by:
associatedModelClassInfo in interface ICMIModelClass
Returns:
ICMIModelClassInfo of this ModelClass


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. 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.