Hi ,
we have a requirement of unpublishing and then deleting the content from vcm of specific CTD type.we have wriiten a below java code for it which takes the vcm id of the ci as a parameter and unpublishes the content item.
private static void unpublishContent(String sSiteName, ContentInstance ci)throws Exception {
String jobName = "";
ObjectId jobId = null;
String jobDescription = "UnPublish";
DeploymentClient deploymentClient = null;
ManagedObjectVCMRef movr = null;
try {
Site site = Site.findByName(sSiteName);
System.out.println("DeleteWciti - site: " + site);
SiteRef oSiteRef = new SiteRef(site);
System.out.println("DeleteWciti - site: " + oSiteRef);
System.out.println("SiteName: " + sSiteName);
jobName = "UnPublish wciti ci";
System.out.println("jobName: " + jobName);
deploymentClient = new DeploymentClient(oSiteRef);
System.out.println("deploymentClient: " + deploymentClient);
System.out.println("creating job.");
movr = ci.getContentManagementId();
DeploymentJobDefinition jobDef = new DeploymentJobDefinition(jobName, JobType.UNPUBLISH);
ContentInstancePattern pattern = new ContentInstancePattern(movr);
jobDef.setContentPattern(pattern, false);
jobDef.setDescription(jobDescription);
JobReport jobReport = deploymentClient.createJob2(jobDef);
System.out.println("created job: " + jobId);
deploymentClient.launchJob(jobReport.getJobData().getId());
System.out.println("job launched.");
// deploymentClient.releaseJob(jobId);
} catch (Exception e) {
System.out.println("ERROR while creating Unpublish job; VCM ID = "
+ movr);
System.out.println("Exception Message: " + e.getMessage());
if ((null != deploymentClient) && (null != jobId)) {
deploymentClient.invalidateJob(jobId);
}
throw e;
}
}
Once the code is getting executed we also see that the jobs are getting successfully created and completed.But when we verify the delivery DB the content items are still exisiting.
We are using vcm 7.6.
Can any of me know what more needs to be done so that the content items are removed from delivery db also.
Thanks,
Soujanya