The Atg.DotNet.WebService API is a mechanism that you can use to serialize and deserialize RepositoryItem content. The primary role of this API is to:

By understanding the RepositoryItem API, Atg.DotNetWebService.RepositoryItem is able to convert into objects any content that uses the RepositoryItem API for its underlying data type. You can use this API for any Web Services that access RepositoryItems.

The Atg.DotNet.WebService is made up of the following classes:

Note: Rather than use this API, you could generate an XML schema representation of the RepositoryItem and use that serialize/deserialize content. The advantage of using an XML schema is that you can control the properties you use, meaning you can easily exclude certain properties from your schema. You may find the disadvantages, namely the limitations in property types and values that this method supports, reason to use the provided API instead. For instructions on how to use an XML schema for serialization/deserialization, see the Creating a Serializer and Deserializer.

About the Atg.DotNet.WebService API

Collectively, these classes provide you with the ability to serialize and deserialize RepositoryItems and to configure both processes. Although this discussion specifically describes the serialization process, the same principles apply to both processes.

When you want to deserialize content from a Web Service, for example, you use the response sent by a Web Service resulting from your initial Web Service call. The response, formatted in XML, holds a string object that represents RepositoryItems. Once you make the call to the API to deserialize the string, the deserializer parses the string into a RepositoryItem object.

Not all content in the string is emitted by the serializer. By default, only content specified as “dirty,” meaning a different value for it exists in the Oracle Commerce Platform and the external system .NET communicates with, is serialized. Once an item has been serialized, there’s parity across systems so all properties on that item are marked as “clean.” You can alter the default dirty/clean designation in the following ways:

During deserialization, content that represents RepositoryItem properties is parsed based on a few rules. All properties are converted back to the native data type, assuming that data type is available in .NET. The following data types do not exist in .NET and so values for these types are converted as follows:

For the most part, Atg.DotNet.WebService determines format output type by relying on prior processing. For example, if it had deserialized a particular RepositoryItem, such a Growth fund, then assuming no new properties are added, when the Growth fund is serialized, Atg.DotNet.WebService.RepositoryItem is aware of each property’s destination data type. However, in all other circumstances, you should explicitly include the XML data type for the property. In short, under these circumstances include data types:

Note: In order to use the classes in this interface, make sure that the Oracle Commerce Platform atg/repository/xml/RepositoryXMLTools component has the encodeRepositoryIdAsAttr property set to true. This is the default setting.

RepositoryItem Class

The Atg.DotNet.WebService.RepositoryItem class is designed to manage XML serialization and deserialization for easy interoperability with the .NET Web Services framework.

To serialize or deserialize a RepositoryItem, you need only to pass in the RepositoryName and RepositoryId. When you are working with content for the first time, you also need to call setPropertyType to instruct the deserializer/serializer to use a specific output data type.

Class Element

Description

properties

Dirty
Determines the overall dirtiness of an object by specifying whether all properties are clean (false) or one of more properties are dirty (true).

ItemDescriptorName
Name of the item descriptor associated with the object’s RepositoryItem.

Properties
List of properties for this RepositoryItem.

RepositoryId
ID provided to the object’s RepositoryItem representation.

RepositoryName
Name of the repository that the RepositoryItem is part of.

constructors

RepositoryItem()
Constructs a new, empty RepositoryItem object. When you serialize or deserialize a property with a value that is a pointer to a RepositoryItem, be sure to supply it a RepositoryName, RepositoryId, and ItemDescriptorName when you invoke the setRepositoryItem method.

RepositoryItem(string)
Constructs a new RepositoryItem in the Oracle Commerce Platform, populating it with values parsed from the XML instance of the Web Service call. The XML instance is a by-product from the Web Service call generation.

methods

clearPropertyValues
Clears all property values for a given RepositoryItem. Before using RepositoryItemSerializer.deserialize, it’s a good idea to use this method to clear all previous values.

isPropertyDirty
Determines whether a given property value is dirty (true) or clean (false).

setPropertyDirty
Designates a given property as dirty.

getPropertyValue
Returns the value provided for a property in the Oracle Commerce Platform. If the property does not exist, an error of type ATGWS.NoSuchPropertyException is thrown.

setPropertyValue
Sets a value for a property in the Oracle Commerce Platform.

getPropertyType
Returns the property’s XML data type.

setPropertyType
Specifies the XML data type for the property value.

serialize
Creates a string representation of an XML document for the RepositoryItem.

Property Class

This class represents a given property’s name and value.

Class Element

Description

properties

Dirty
Determines whether a given property is dirty (true) or clean (false). If you indicate that a property value should change by invoking the RepsoitoryItem setPropertyValue call, this property is set to true. Once a response is returned from the setPropertyValue call, this property is set to false.

XmlType
XML data type that will be used to represent the property’s value.

constructor

Property()
Constructs an empty object representing a property.

methods

getName
Returns the name of the property.

getValue
Returns the value of the property.

setValue
Sets a new value to the property.

RepositoryItemRef Class

This class represents a reference to another RepositoryItem.

Class Element

Description

properties

RepositoryName
Name of the repository of which the referenced RepositoryItem is a part.

ItemDescriptorName
Name of the item descriptor used by the referenced RepositoryItem .

RepositoryId
ID for the referenced RepositoryItem .

method

setRepositoryItem
Initializes the ItemRef to refer to the provided RepositoryItem.

Complex Type Class

This class permits you to serialize/deserialize properties that use complex types by specifying an output data type explicitly.

Class Element

Description

properties

TypeName
Data type for the RepositoryItem property.

Properties
Name of any properties that are either deserialized from or serialized into the complex type.

constructor

ComplexType()
Constructs an empty object to represent all properties of a complex data type.

methods

getPropertyValue
Retrieves values from the Oracle Commerce Platform for the specified properties. If the property does not exist, an error of type ATGWS.NoSuchPropertyException is thrown.

setPropertyValue
Sets a property to a value supplied as an input.

getPropertyType
Returns the XML data type for the property value.

setPropertyType
Specifies the XML data type for the property value.

NoSuchPropertyException Class

This class generates an exception each time a getProperty or getPropertyValue method tries to interact with a property that has not been specified for the designated RepositoryItem.

Class Element

Description

property

PropertyName
Name of the property that you are trying to work with.

constructor

NoSuchPropertyException
Constructs the exception.

RepositoryItemSerializer Class

This class conducts serialization/deserialization and permits you to decide if you want all or only dirty properties to be updated.

Class Element

Description

constructors

RepositoryItemSerializer()
Constructs a serializer instance.

RepositoryItemSerializer(RepositoryItem)
Constructs an object holding serialized content.

methods

deserialize (string)
Deserializes an XML-formatted string into a new RepositoryItem.

deserialize (string, boolean)
Deserializes an XML document string into a RepositoryItem. Additional arguments true or false indicate whether values for only dirty properties (true) or all properties (false) should be deserialized.

serialize (string)
Serializes a RepositoryItem into an XML-formatted string document.

serialize (boolean)
Serializes a RepositoryItem into an XML document. Additional arguments true and false indicate whether values for only dirty properties (true) or all properties (false) should be deserialized.

RepositoryItemSerializationException Class

This class creates an exception object when errors occur during serialization or deserialization.

Class Element

Description

constructor

RepositoryItemSerializationException()
Constructs an empty exception object.


Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices