version 1.53, 2002/08/19 17:43:23
|
version 1.54, 2002/08/20 17:39:37
|
|
|
void CIMClassRep::addProperty(const CIMProperty& x) | void CIMClassRep::addProperty(const CIMProperty& x) |
{ | { |
if (x.isUninitialized()) | if (x.isUninitialized()) |
throw UninitializedObject(); |
throw UninitializedObjectException(); |
| |
// Reject addition of duplicate property name: | // Reject addition of duplicate property name: |
| |
if (findProperty(x.getName()) != PEG_NOT_FOUND) | if (findProperty(x.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists("property \"" + x.getName() + "\""); |
throw AlreadyExistsException("property \"" + x.getName() + "\""); |
|
|
// Reject addition of references to non-associations: |
|
|
|
// ATTN-RK-20020815: This is the wrong place for this check, because |
|
// the ASSOCIATION qualifier could be removed later |
|
if (!isAssociation() && x.getValue().getType() == CIMTYPE_REFERENCE) |
|
throw AddedReferenceToClass(_reference.getClassName()); |
|
| |
// Set the class origin: | // Set the class origin: |
// ATTN: put this check in other places: | // ATTN: put this check in other places: |
|
|
void CIMClassRep::addMethod(const CIMMethod& x) | void CIMClassRep::addMethod(const CIMMethod& x) |
{ | { |
if (x.isUninitialized()) | if (x.isUninitialized()) |
throw UninitializedObject(); |
throw UninitializedObjectException(); |
| |
// Reject duplicate method names: | // Reject duplicate method names: |
| |
if (findMethod(x.getName()) != PEG_NOT_FOUND) | if (findMethod(x.getName()) != PEG_NOT_FOUND) |
throw AlreadyExists("method \"" + x.getName() + "\""); |
throw AlreadyExistsException("method \"" + x.getName() + "\""); |
| |
// Add the method: | // Add the method: |
| |
|
|
CIMMethod CIMClassRep::getMethod(Uint32 pos) | CIMMethod CIMClassRep::getMethod(Uint32 pos) |
{ | { |
if (pos >= _methods.size()) | if (pos >= _methods.size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
return _methods[pos]; | return _methods[pos]; |
} | } |
|
|
void CIMClassRep::removeMethod(Uint32 pos) | void CIMClassRep::removeMethod(Uint32 pos) |
{ | { |
if (pos >= _methods.size()) | if (pos >= _methods.size()) |
throw OutOfBounds(); |
throw IndexOutOfBoundsException(); |
| |
_methods.remove(pos); | _methods.remove(pos); |
} | } |
|
|
// set the class-origin: | // set the class-origin: |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
| |
|
Boolean isAssociationClass = isAssociation(); |
|
|
for (Uint32 i = 0, n = _properties.size(); i < n; i++) | for (Uint32 i = 0, n = _properties.size(); i < n; i++) |
{ | { |
CIMProperty& property = _properties[i]; | CIMProperty& property = _properties[i]; |
|
|
|
if (!isAssociationClass && |
|
property.getValue().getType() == CIMTYPE_REFERENCE) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, |
|
"Non-assocation class contains reference property"); |
|
} |
|
|
Uint32 pos = superClass.findProperty(property.getName()); | Uint32 pos = superClass.findProperty(property.getName()); |
| |
if (pos == PEG_NOT_FOUND) | if (pos == PEG_NOT_FOUND) |