version 1.71.2.1, 2006/02/10 16:09:33
|
version 1.74, 2006/07/21 18:40:55
|
|
|
#include <Pegasus/Common/MessageLoader.h> //l10n | #include <Pegasus/Common/MessageLoader.h> //l10n |
#include "CIMNameUnchecked.h" | #include "CIMNameUnchecked.h" |
#include "StrLit.h" | #include "StrLit.h" |
|
#include "CIMInstanceRep.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
|
|
const CIMPropertyList& propertyList) const | const CIMPropertyList& propertyList) const |
{ | { |
| |
// Create the new instance |
// Create the new instance representation |
CIMInstance newInstance(_reference.getClassName()); |
CIMInstanceRep* newInstanceRep = new CIMInstanceRep( |
|
CIMObjectPath(String::EMPTY, |
|
CIMNamespaceName(), |
|
_reference.getClassName())); |
| |
// Copy qualifiers if required | // Copy qualifiers if required |
if (includeQualifiers) | if (includeQualifiers) |
{ | { |
for (Uint32 i = 0 ; i < getQualifierCount() ; i++) | for (Uint32 i = 0 ; i < getQualifierCount() ; i++) |
{ | { |
newInstance.addQualifier(getQualifier(i).clone()); |
newInstanceRep->_qualifiers.add(getQualifier(i).clone()); |
} | } |
} | } |
| |
|
newInstanceRep->_properties.reserveCapacity(_properties.size()); |
|
|
// Copy Properties | // Copy Properties |
for (Uint32 i = 0 ; i < _properties.size() ; i++) | for (Uint32 i = 0 ; i < _properties.size() ; i++) |
{ | { |
CIMConstProperty p = getProperty(i); |
CIMConstProperty cp = getProperty(i); |
CIMName name = p.getName(); |
CIMName name = cp.getName(); |
Array<CIMName> pl = propertyList.getPropertyNameArray(); | Array<CIMName> pl = propertyList.getPropertyNameArray(); |
if (propertyList.isNull() || Contains(pl, name)) | if (propertyList.isNull() || Contains(pl, name)) |
{ | { |
CIMProperty p = getProperty(i).clone(); |
CIMProperty p; |
if (!includeQualifiers && p.getQualifierCount() != 0) |
|
{ |
if (includeQualifiers) |
for (Uint32 j = 0 ; j < getQualifierCount() ; j++) |
|
{ | { |
p.removeQualifier(i - 1); |
p = getProperty(i).clone(); |
} | } |
|
else |
|
{ |
|
p = CIMProperty(cp.getName(), |
|
cp.getValue(), |
|
cp.getArraySize(), |
|
cp.getReferenceClassName(), |
|
cp.getClassOrigin()); |
} | } |
|
|
|
// Delete class origin attribute if required |
if (!includeClassOrigin) | if (!includeClassOrigin) |
{ | { |
p.setClassOrigin(CIMName()); | p.setClassOrigin(CIMName()); |
} | } |
newInstance.addProperty(p); |
|
| |
// Delete class origin attribute if required |
newInstanceRep->_properties.append(p); |
} | } |
} | } |
| |
|
// Create new CIMInstance from CIMInstanceRep |
|
CIMInstance newInstance(newInstanceRep); |
|
|
return(newInstance); | return(newInstance); |
} | } |
| |
|
|
| |
out << STRLIT(">\n"); | out << STRLIT(">\n"); |
| |
// Qualifiers: |
// Append Class Qualifiers: |
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
// Parameters: |
// Append Property definitions: |
| |
for (Uint32 i = 0, n = _properties.size(); i < n; i++) | for (Uint32 i = 0, n = _properties.size(); i < n; i++) |
XmlWriter::appendPropertyElement(out, _properties[i]); | XmlWriter::appendPropertyElement(out, _properties[i]); |
| |
// Methods: |
// Append Method definitions: |
| |
for (Uint32 i = 0, n = _methods.size(); i < n; i++) | for (Uint32 i = 0, n = _methods.size(); i < n; i++) |
XmlWriter::appendMethodElement(out, _methods[i]); | XmlWriter::appendMethodElement(out, _methods[i]); |
|
|
// Generate MOF if this property not propagated | // Generate MOF if this property not propagated |
// Note that the test is required only because | // Note that the test is required only because |
// there is an error in getclass that does not | // there is an error in getclass that does not |
// test the localOnly flag. |
// test the localOnly flag |
|
// The inital "false" indicates to format as property declaration. |
if (!_properties[i].getPropagated()) | if (!_properties[i].getPropagated()) |
MofWriter::appendPropertyElement(out, _properties[i]); |
MofWriter::appendPropertyElement(true, out, _properties[i]); |
} | } |
| |
// Format the Methods: for non-propagated methods | // Format the Methods: for non-propagated methods |