I'm using the below code which is based on the example in the documentation using VersionControlService.
The code appears to work; in that when I debug and review in webtop the correct files get checked out and checked in. But the end result in web top is not what I would expect.
The tests I'm running are,
- I have two files TestCheckInMajorVersion and TestCheckInMinorVersion.
- I checkout/checkin each file using below code
- In WebTop, with the "Show Files" view selected (and the Version column added to the view) - I can see the original version of both files with a version of 1.0, CURRENT (see attached image)
- In WebTop, with the "Show All Objects and Versions" view selected (and the Version column added to the view) - I can see the original version of both files with a version of 1.0, CURRENT and the updated versions of 1.1, TEST IN CODE and 2.0 TEST IN CODE (see attached image)
My expectation is that at #3 above I should see the latest checked in version of the files.
I also had the expectation that the ObjectId would be maintained across versions of the files, this is not the case as a new ObjectId is created for the new version
Also when I call versionControlService.GetCurrent I get the original version not the latest checked in version.
My question, is this the correct behaviour with Documentum?
How do I make the checked in file the one returned from a GetCurrent call, when the GetCurrent call is using the ObjectPath as the identity?
public CheckInResponse CheckIn(CheckInRequest request)
{
string correlationID = request.HeaderDataContract.CorrelationID;
var response = new CheckInResponse
{
HeaderDataContract = request.HeaderDataContract,
StatusDataContract = StatusDataContract.CreateStatusDataContract(null, null, SuccessFlag.NOTSET),
CheckInResult = new CheckInResult { }
};
ObjectIdentitySet objIdSet = new ObjectIdentitySet();
ObjectIdentity objIdentity = new ObjectIdentity(DefaultRepository);
if (string.IsNullOrEmpty(request.CheckInInfo.ObjectID))
{
string objectPath = "/" + request.CheckInInfo.Cabinet + "/" + request.CheckInInfo.ObjectPath;
objIdentity.Value = new ObjectPath(objectPath);
}
else
{
objIdentity.Value = new ObjectId(request.CheckInInfo.ObjectID);
}
objIdSet.Identities.Add(objIdentity);
OperationOptions operationOptions = new OperationOptions();
var contentProfile = new ContentProfile(
FormatFilter.ANY, null, PageFilter.ANY, -1, PageModifierFilter.ANY, null);
operationOptions.ContentProfile = contentProfile;
// first CheckOut
DataPackage checkInDataPackage = versionControlService.Checkout(objIdSet, operationOptions);
DataObject checkInDataObject = checkInDataPackage.DataObjects[0];
checkInDataObject.Contents = null;
FileContent newContent = new FileContent();
newContent.LocalPath = request.CheckInInfo.FilePath;
newContent.RenditionType = RenditionType.PRIMARY;
newContent.Format = request.CheckInInfo.ObjectContentType;
checkInDataObject.Contents.Add(newContent);
bool retainLock = false;
var labels = new List<string>();
labels.Add("TEST IN CODE");
VersionStrategy versionStrategy = (request.CheckInInfo.CheckInAsMajorVersion) ?
VersionStrategy.NEXT_MAJOR : VersionStrategy.NEXT_MINOR;
DataPackage result = versionControlService.Checkin(checkInDataPackage, versionStrategy,
retainLock, labels, operationOptions);
response.CheckInResult.CheckedIn = true;
response.StatusDataContract.SuccessFlag = SuccessFlag.SUCCESS;
return response;
}