Writing properties

You can set a new value for a property by using the property-specific set method to set the property value in the proxy object. (Properties that do not have a set method cannot be set using the ClearCase® CM server API.) When specifying new values in a set method, the values are stored in the proxy. The values are not written to the actual resource in its repository until the client application calls a do method such as the doWriteProperties method on the proxy object.

You must call a do method such as doWriteProperties method to update the underlying resource in the product repository. The method writes the updated properties in the proxy to the product resource all as one transaction. Failures do not occur when property values are set in the proxy, but can occur when the do method is called. At that time, an exception might be thrown.

The following example appends some text to the Comment property of a resource:
PropertyRequest requestComment = 
   new PropertyRequest (Resource.COMMENT );
Location location = myProvider.location(...);
Resource myResource = myProvider.resource(location);
myResource = myResource.doReadProperties(requestComment);
String comment = myResource.getComment();
myResource.setComment(comment + "addition to comment");
myResource.doWriteProperties(null);
The doWriteProperties() method takes a PropertyRequest parameter.
It is not necessary to call doReadProperties() before calling doWriteProperties() if you know what property value to write without having read the current value. In the following example, the a label type is being modified to make sure it has shared mastership enabled.
CcLabelType myLbtype = myCcProvider.ccLabelType("MYLABEL@\myvob");
myLbtype.setProperty(CcLabelType.HAS_SHARED_MASTERSHIP, true);
myLbtype.doWriteProperties(null);

See Location syntax for more information.