Hello All,
What is the best practice to update the symbolic version using DFC.
sysobject.setString() / sysobject.mark() ?
which one is recommended ?
Hi,
My suggestion is to use mark() method to avoid checks and confusions with setString() as version label is a repeating attribute. For instance, a document has 4 versions and v3 is the current, we have to manipulate to get the current version and setString to that index by adding comma, instead we can simply use mark() and framework takes care of the current version resolution and setting the symbolic label as well.
-Siva
Correction : I want to remove all the symbolic version labels and add new one, As I can see while doing unmark I have to specify which one to remove, problem is i do not know, which symbolic version exist in objects so I can use in unmark and mark new one.
any suggestion .. how to get existing symbolic versions to remove from sysobject
I am running following code.
if(versionLabels.hasSymbolicVersionLabel())
{
for(int i=1;i<versionLabels.getVersionLabelCount();i++)
DfLogger.debug(PostProcessingUtil.class, "=== setSymbolicVersionLabel at i=== : position i"+i+":"+versionLabels.getVersionLabel(i), null, null);
String ctrVerLabel = versionLabels.getVersionLabel(i);
buldoserSysObject.unmark(ctrVerLabel);
buldoserSysObject.save();
}
//Set new Symbolic version
String newVersionlabels[] = strNewSymbolicVersion.split(",");
if (!buldoserSysObject.isCheckedOut())
buldoserSysObject.checkout();
for(int i=1;i<newVersionlabels.length ; i++)
DfLogger.debug(PostProcessingUtil.class, "=== setSymbolicVersionLabel New version at i=== : position i"+i+":"+newVersionlabels[i], null, null);
buldoserSysObject.mark(newVersionlabels[i]);
buldoserSysObject.checkin (false, "");
Throwing Exception on unmark only...
Add a check for CURRENT in your removal code,
for(int i=1;i<versionLabels.getVersionLabelCount();i++) { DfLogger.debug(PostProcessingUtil.class, "= setSymbolicVersionLabel at i= : position i"+i+":"+versionLabels.getVersionLabel(i), null, null); String ctrVerLabel = versionLabels.getVersionLabel(i); //Add a check for CURRENT label which is implicit and need not be removed if (!"CURRENT".equalsIgnoreCase(ctrVerLabel)) { buldoserSysObject.unmark(ctrVerLabel); buldoserSysObject.save(); }}
What I observed while doing unmark , sysobject.mark and sysobject.checkin() (requirement to checkout before using mark / adding symbolic version label)
It creates the another object in repository.. Any idea.. how can I avoid the same. I mean this procedure for unmark and mark creating extra object in repository.
If you want to checkin as same version, you need to trigger .save().
As Johnny suggested you can use save() or checkIn() the document in the same version to avoid creating new versions