public DataPackage UpdateRelinkFolder(ObjectIdentity docId, ObjectIdentity sourceFolderId, ObjectIdentity targetFolderId) { DataObject docDataObj = new DataObject(docId, "dm_document"); // add the source folder as a parent relationship of the document ReferenceRelationship removeRelationship = new ReferenceRelationship(); removeRelationship.TargetRole = Relationship.ROLE_PARENT; removeRelationship.Name = Relationship.RELATIONSHIP_FOLDER; removeRelationship.Target = sourceFolderId; docDataObj.Relationships.Add(removeRelationship); // specify that the folder is to be unlinked removeRelationship.IntentModifier = RelationshipIntentModifier.REMOVE; Console.WriteLine("Set to remove relationship from parent folder " + sourceFolderId.GetValueAsString()); // add the folder into which to link document ReferenceRelationship addRelationship = new ReferenceRelationship(); addRelationship.TargetRole = Relationship.ROLE_PARENT; addRelationship.Name = Relationship.RELATIONSHIP_FOLDER; addRelationship.Target = targetFolderId; docDataObj.Relationships.Add(addRelationship); Console.WriteLine("Set relationship to parent folder " + targetFolderId.GetValueAsString()); OperationOptions operationOptions = null; return(objectService.Update(new DataPackage(docDataObj), operationOptions)); }
public void TestShowLifecycle() { try { Console.WriteLine("\nTesting lifecycle info..."); sampleContentManager.CreateDemoObjects(); attachTestLifecycle(); ObjectIdentity objId = new ObjectIdentity(); objId.RepositoryName = DefaultRepository; objId.Value = new Qualification(SampleContentManager.gifImageQualString); lifecycleServiceDemo.ShowLifecycleInfo(objId); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public DataPackage UpdateRepeatProperty(ObjectIdentity objectIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); String[] moreDangers = { "snakes", "sharks" }; ArrayProperty <string> keywordProperty = new StringArrayProperty("keywords", moreDangers); Console.WriteLine("Appending additional strings 'snakes' and 'sharks' to object keywords."); ValueAction appendAction = new ValueAction(ValueActionType.INSERT, 0); ValueAction deleteAction = new ValueAction(ValueActionType.APPEND, 1); keywordProperty.SetValueActions(appendAction, deleteAction); PropertySet properties = new PropertySet(); properties.Set(keywordProperty); dataObject.Properties = properties; OperationOptions operationOptions = null; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
public DataPackage CreateDocumentInFolder(ObjectIdentity objectIdentity) { DataPackage dataPackage = new DataPackage(new DataObject(objectIdentity)); OperationOptions operationOptions = null; return(objectService.Create(dataPackage, operationOptions)); }
public DataObject RetrieveVdmInfo(ObjectIdentity objectIdentity, Boolean isSnapshot) { VdmRetrieveProfile retrieveProfile = new VdmRetrieveProfile(); retrieveProfile.IsShouldFollowAssembly = isSnapshot; retrieveProfile.Binding = "CURRENT"; OperationOptions options = new OperationOptions(); options.VdmRetrieveProfile = retrieveProfile; DataObject resultDO = virtualDocumentService.Retrieve(objectIdentity, options); List<Relationship> relationships = resultDO.Relationships; Console.WriteLine("Total relationships in virtual document = " + relationships.Count); int i = 0; foreach (Relationship r in relationships) { Console.WriteLine(); ReferenceRelationship refRel = (ReferenceRelationship)r; Console.WriteLine("Child node " + i++ + ": " + refRel.Target.GetValueAsString()); PropertySet nodeProperties = refRel.RelationshipProperties; List<Property> properties = nodeProperties.Properties; foreach (Property p in properties) { Console.Write(p.Name + ": "); Console.WriteLine(p.GetValueAsString()); } } return resultDO; }
public void TestGetWithUrl() { Console.WriteLine("\nTesting get content using URLs"); sampleContentManager.CreateDemoObjects(); try { ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString), this.DefaultRepository); FileInfo fi = objectServiceDemo.GetObjectWithUrl(objIdentity); if (fi.Equals(null)) { throw new Exception("Failed to get object content using URL."); } } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public DataPackage CMSUploadMethod(string dmsfolderpath, string localfilepath) { if (!File.Exists(localfilepath)) { throw new Exception("Test file: " + localfilepath + " does not exist"); } ObjectIdentity objIdentity = new ObjectIdentity(DefaultRepository); DataObject dataObject = new DataObject(objIdentity, "dm_document"); //eifx_deliverable_doc // ecs_correspondence PropertySet properties = dataObject.Properties; properties.Set("object_name", "MyImage" + System.DateTime.Now.Ticks); properties.Set("title", "MyImage"); properties.Set("a_content_type", "gif"); dataObject.Contents.Add(new FileContent(Path.GetFullPath(localfilepath), "gif")); ObjectPath objectPath = new ObjectPath(dmsfolderpath); ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository); ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship(); sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER; sampleFolderRelationship.Target = sampleFolderIdentity; sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT; dataObject.Relationships.Add(sampleFolderRelationship); OperationOptions operationOptions = null; DataPackage dataPackage = objectService.Create(new DataPackage(dataObject), operationOptions); string object_ = dataPackage.DataObjects[0].Identity.GetValueAsString(); return(dataPackage); }
public void TestUpdateContent() { Console.WriteLine("\nTesting update of object content."); try { sampleContentManager.CreateDemoObjects(); ObjectIdentity objID = new ObjectIdentity(); objID.RepositoryName = objectServiceDemo.DefaultRepository; objID.Value = new Qualification(SampleContentManager.gifImageQualString); string testContentPath = SampleContentManager.gifImage1FilePath; String absoluteFilePath = Path.GetFullPath(testContentPath); objectServiceDemo.UpdateContent(objID, absoluteFilePath); Console.WriteLine("Updated content of object " + objID.GetValueAsString() + " to " + absoluteFilePath); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
/// <summary> /// Caricamento dei valori delle properties relative allo stato checkout per il documento /// </summary> /// <param name="documentNumber"></param> /// <param name="isStampaRegistro"></param> /// <returns></returns> protected virtual PropertySet LoadCheckOutProperties(string documentNumber, bool isStampaRegistro) { ObjectIdentity identity = null; if (isStampaRegistro) { identity = Dfs4DocsPa.getDocumentoStampaRegistroIdentityByDocNumber(documentNumber); } else { identity = Dfs4DocsPa.getDocumentoIdentityByDocNumber(documentNumber); } List <string> filters = new List <string>(); filters.Add("r_object_id"); filters.Add("object_name"); filters.Add("r_lock_owner"); filters.Add("r_lock_date"); filters.Add(TypeDocumento.CHECKOUT_LOCAL_FILE_PATH); filters.Add(TypeDocumento.CHECKOUT_MACHINE_NAME); if (!isStampaRegistro) { // Caricamento informazioni di checkout specifiche per documenti non di tipo stampa registro filters.Add(TypeDocumento.TIPO_PROTOCOLLO); } IObjectService service = this.GetServiceInstance <IObjectService>(true); DataObject dataObject = DfsHelper.getAllPropsAndFolders(service, identity, filters, false); return(dataObject.Properties); }
public DataPackage Checkout(ObjectIdentity objIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); OperationOptions operationOptions = null; DataPackage resultDp; resultDp = versionControlService.Checkout(objIdSet, operationOptions); Console.WriteLine("Checkout successful"); List <VersionInfo> vInfo = versionControlService.GetVersionInfo(objIdSet); VersionInfo versionInfo = vInfo[0]; Console.WriteLine("Printing version info for " + versionInfo.Identity); Console.WriteLine("IsCurrent is " + versionInfo.IsCurrent); Console.WriteLine("Version is " + versionInfo.Version); Console.WriteLine("Symbolic labels are: "); foreach (String label in versionInfo.SymbolicLabels) { Console.WriteLine(label); } versionControlService.CancelCheckout(objIdSet); Console.WriteLine("Checkout cancelled"); return(resultDp); }
public CheckoutInfo CheckoutInfo(ObjectIdentity objIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); List <CheckoutInfo> objList; OperationOptions operationOptions = null; versionControlService.Checkout(objIdSet, operationOptions); objList = versionControlService.GetCheckoutInfo(objIdSet); CheckoutInfo checkoutInfo = objList[0]; if (checkoutInfo.IsCheckedOut) { Console.WriteLine("Object " + checkoutInfo.Identity + " is checked out."); Console.WriteLine("Lock owner is " + checkoutInfo.UserName); } else { Console.WriteLine("Object " + checkoutInfo.Identity + " is not checked out."); } versionControlService.CancelCheckout(objIdSet); return(checkoutInfo); }
public void TestCheckoutInfo() { Console.WriteLine("\nRunning version control checkout info sample."); try { sampleContentManager.CreateDemoObjects(); sampleContentManager.VersionSampleObjects(); ObjectIdentity objIdentity = new ObjectIdentity(); objIdentity.RepositoryName = versionControlServiceDemo.DefaultRepository; objIdentity.Value = new ObjectPath(SampleContentManager.gifImage1ObjPath); versionControlServiceDemo.CheckoutInfo(objIdentity); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public void TestCheckoutNonCurrent() { Console.WriteLine("\nRunning version control checkout of non-current version sample."); try { sampleContentManager.CreateDemoObjects(); sampleContentManager.VersionSampleObjects(); ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(nonCurrentQual), versionControlServiceDemo.DefaultRepository); DataPackage dp = versionControlServiceDemo.Checkout(objIdentity); DataObject dO = dp.DataObjects[0]; } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public void TestCancelCheckout() { Console.WriteLine("\nRunning version control cancel checkout sample."); try { sampleContentManager.CreateDemoObjects(); sampleContentManager.VersionSampleObjects(); ObjectIdentity objIdentity = new ObjectIdentity(); objIdentity.RepositoryName = versionControlServiceDemo.DefaultRepository; objIdentity.Value = new ObjectPath(SampleContentManager.gifImage1ObjPath); versionControlServiceDemo.CancelCheckout(objIdentity); } catch (FaultException<SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public DataPackage Checkout(ObjectIdentity objIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); OperationOptions operationOptions = null; DataPackage resultDp; resultDp = versionControlService.Checkout(objIdSet, operationOptions); Console.WriteLine("Checkout successful"); List<VersionInfo> vInfo = versionControlService.GetVersionInfo(objIdSet); VersionInfo versionInfo = vInfo[0]; Console.WriteLine("Printing version info for " + versionInfo.Identity); Console.WriteLine("IsCurrent is " + versionInfo.IsCurrent); Console.WriteLine("Version is " + versionInfo.Version); Console.WriteLine("Symbolic labels are: "); foreach (String label in versionInfo.SymbolicLabels) { Console.WriteLine(label); } versionControlService.CancelCheckout(objIdSet); Console.WriteLine("Checkout cancelled"); return resultDp; }
public CheckoutInfo CheckoutInfo(ObjectIdentity objIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); List<CheckoutInfo> objList; OperationOptions operationOptions = null; versionControlService.Checkout(objIdSet, operationOptions); objList = versionControlService.GetCheckoutInfo(objIdSet); CheckoutInfo checkoutInfo = objList[0]; if (checkoutInfo.IsCheckedOut) { Console.WriteLine("Object " + checkoutInfo.Identity + " is checked out."); Console.WriteLine("Lock owner is " + checkoutInfo.UserName); } else { Console.WriteLine("Object " + checkoutInfo.Identity + " is not checked out."); } versionControlService.CancelCheckout(objIdSet); return checkoutInfo; }
public void TestGetObjectFilterRelationParentOnly() { Console.WriteLine("\nTesting get object using filter to get only parent relationships."); sampleContentManager.CreateDemoObjects(); ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString), objectServiceDemo.DefaultRepository); try { DataObject dataObject = objectServiceDemo.GetObjectFilterRelationsParentOnly(objIdentity); Console.WriteLine("Got object with relationships" + objIdentity.GetValueAsString()); ReferenceRelationship parentFolderReference = (ReferenceRelationship)dataObject.Relationships[0]; Console.WriteLine("Related folder is " + parentFolderReference.Target.GetValueAsString()); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
void OnCollisionEnter2D(Collision2D coll) { Transform target = coll.collider.transform; ObjectIdentity oi = target.GetComponent <ObjectIdentity> (); if (oi && paralyzeTargets.Contains(oi.objType)) { // paralyze the target switch (oi.objType) { case ObjectType.Virus: { ControlStatus cs = target.GetComponent <ControlStatus> (); if (cs && cs.controller != Controller.None) { VirusActions va = coll.transform.GetComponent <VirusActions> (); if (va) { va.Paralyze(paralyzeTime); } } break; } } } }
public void TestGetObjectDefaultsObjPath() { Console.WriteLine("\nTesting object get with default settings using a path as ObjectIdentity."); sampleContentManager.CreateDemoObjects(); ObjectPath objectPath = new ObjectPath(SampleContentManager.sourcePath); ObjectIdentity objIdentity = new ObjectIdentity(objectPath, objectServiceDemo.DefaultRepository); try { DataObject dataObject = objectServiceDemo.GetObjectWithDefaults(objIdentity); Console.WriteLine("Got object " + objIdentity.GetValueAsString()); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
/// <summary> /// Tries pairing a tracklet (if it contains a detection in the time range of the image). /// </summary> /// <param name="t">Tracklet.</param> /// <param name="Separation">Maximum distance to consider, in arcseconds.</param> public void TryPair(Tracklet t, double Separation) { Separation *= Math.PI / 180 / 3600; if (!t.TryFetchProperty(out ObjectIdentity obid)) { obid = new ObjectIdentity(); } bool NamesPresent = false; foreach (ImageDetection imd in t.Detections) { if (Math.Abs((imd.Time.Time - ShotTime).TotalSeconds) < Exposure.TotalSeconds) { List <SkybotObject> Objects = ObjTree.Query(imd.Barycenter.EP.RA, imd.Barycenter.EP.Dec, Separation); foreach (SkybotObject so in Objects) { obid.AddName(so.Name, so.PermanentDesignation, so.Position ^ imd.Barycenter.EP); Unpaired.Remove(so); NamesPresent = true; } } } if (NamesPresent) { t.SetResetProperty(obid); } }
public void TestUpdatePropertiesFetched() { Console.WriteLine("\nTesting update of object properties first fetched from the repository."); try { sampleContentManager.CreateDemoObjects(); ObjectIdentity objID = new ObjectIdentity(); objID.RepositoryName = objectServiceDemo.DefaultRepository; objID.Value = new Qualification(SampleContentManager.gifImageQualString); string newTitle = "updated title " + System.DateTime.Now.Ticks.ToString(); string newSubject = "update subject " + System.DateTime.Now.Ticks.ToString(); string[] newKeywords = { "lions", "tigers", "bears", "sharks" }; DataPackage dp = objectServiceDemo.UpdateFetchedObjectProperties(objID, newTitle, newSubject, newKeywords); DataObject dataObject = dp.DataObjects[0]; String titleVal = dataObject.Properties.Get("title").GetValueAsString(); String subjectVal = dataObject.Properties.Get("subject").GetValueAsString(); Console.WriteLine("Updated properties, title is '" + titleVal + "' subject is '" + subjectVal + "'"); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
/// <summary> /// Verifica credenziali utente /// </summary> /// <param name="userName"></param> protected virtual bool VerifyCredentials(string userName, string authenticationToken, out DocsPaVO.utente.UserLogin.LoginResult loginResult) { bool retValue = false; loginResult = UserLogin.LoginResult.APPLICATION_ERROR; try { ObjectIdentity identity = Dfs4DocsPa.getUserHomeFolderIdentity(userName); IObjectService objectService = DctmServiceFactory.GetServiceInstance <IObjectService>(authenticationToken); logger.Debug("Inizio richiamo authenticationToken"); DataPackage dataPackage = objectService.Get(new ObjectIdentitySet(identity), null); logger.Debug("Fine chiamata authenticationToken"); retValue = (dataPackage != null); } /* * catch (Emc.Documentum.FS.Runtime.AuthenticationException exAuth) * { * //AuthenticationException - Exception in com.emc.documentum.fs.rt * //Exception which is raised when authentication errors occur * loginResult = DocsPaVO.utente.UserLogin.LoginResult.UNKNOWN_DTCM_USER; * retValue = false; * * logger.Debug(string.Format("Credenziali utente DTCM non valide: '{0}'", userName)); * } */ catch (Emc.Documentum.FS.Runtime.ServiceInvocationException exServiceInvocation) { //AuthenticationException - Exception in com.emc.documentum.fs.rt //Exception which is raised when authentication errors occur loginResult = DocsPaVO.utente.UserLogin.LoginResult.DTCM_SERVICE_NO_CONTACT; retValue = false; logger.Debug(string.Format("Errore nel tentativo di contattare i servizi DOCUMENTUM: '{0}'", userName)); } /* * catch (Emc.Documentum.FS.Runtime.ServiceException exService) * { * //AuthenticationException - Exception in com.emc.documentum.fs.rt * //Exception which is raised when authentication errors occur * loginResult = DocsPaVO.utente.UserLogin.LoginResult.DTCM_SERVICE_NO_CONTACT; * retValue = false; * * logger.Debug(string.Format("Errore nel tentativo di contattare i servizi DTCM: '{0}'", userName)); * } */ catch (Exception ex) { //AuthenticationException - Exception in com.emc.documentum.fs.rt //Exception which is raised when authentication errors occur loginResult = DocsPaVO.utente.UserLogin.LoginResult.UNKNOWN_USER; retValue = false; logger.DebugFormat("Credenziali utente non DCTM valide: '{0}' msg {1} stk {2}", userName, ex.Message, ex.StackTrace); } return(retValue); }
public void TestGetWithPermissions() { Console.WriteLine("\nTesting get object with permissions."); try { sampleContentManager.CreateDemoObjects(); ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString), objectServiceDemo.DefaultRepository); DataObject dataObject = objectServiceDemo.GetWithPermissions(objIdentity); Console.WriteLine("Got object with permissions " + dataObject.Identity.GetValueAsString()); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public DataObject CreateSnapshotDemo(String vdmQualString, String snapshotName, String sourcePath) { // create ObjectIdentity of existing virtual document ObjectIdentity testVdmId = new ObjectIdentity(); testVdmId.RepositoryName = DefaultRepository; testVdmId.Value = new Qualification(vdmQualString); // create a new DataObject to use for the snapshot ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository); DataObject snapshotDO = new DataObject(emptyIdentity); snapshotDO.Type = "dm_document"; PropertySet parentProperties = new PropertySet(); parentProperties.Set("object_name", snapshotName); snapshotDO.Properties = parentProperties; // link into a folder ObjectPath objectPath = new ObjectPath(sourcePath); ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository); ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship(); sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER; sampleFolderRelationship.Target = sampleFolderIdentity; sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT; snapshotDO.Relationships.Add(sampleFolderRelationship); // options are reserved for future use so just pass null OperationOptions options = null; return(virtualDocumentService.CreateSnapshot(testVdmId, snapshotDO, options)); }
public DataPackage CreateWithContentModifyContext(String filePath) { if (!File.Exists(filePath)) { throw new Exception("Test file: " + filePath + " does not exist"); } ContentTransferProfile transferProfile = new ContentTransferProfile(); transferProfile.TransferMode = ContentTransferMode.BASE64; Console.WriteLine("Modified service context: changed content transfer mode to BASE64 and Geolocation to 'Pleasanton'"); transferProfile.Geolocation = "Pleasanton"; DemoServiceContext.SetProfile(transferProfile); ObjectIdentity objIdentity = new ObjectIdentity(DefaultRepository); DataObject dataObject = new DataObject(objIdentity, "dm_document"); PropertySet properties = dataObject.Properties; properties.Set("object_name", "MyImage"); properties.Set("title", "MyImage"); properties.Set("a_content_type", "gif"); dataObject.Contents.Add(new FileContent(Path.GetFullPath(filePath), "gif")); OperationOptions operationOptions = null; return(objectService.Create(new DataPackage(dataObject), operationOptions)); }
public void ObjServiceMove(String sourceObjectPathString, String targetLocPathString, String sourceLocPathString) { // identify the object to move ObjectPath objPath = new ObjectPath(sourceObjectPathString); ObjectIdentity docToCopy = new ObjectIdentity(); docToCopy.Value = objPath; docToCopy.RepositoryName = DefaultRepository; // identify the folder to move from ObjectPath fromFolderPath = new ObjectPath(); fromFolderPath.Path = sourceLocPathString; ObjectIdentity fromFolderIdentity = new ObjectIdentity(); fromFolderIdentity.Value = fromFolderPath; fromFolderIdentity.RepositoryName = DefaultRepository; ObjectLocation fromLocation = new ObjectLocation(); fromLocation.Identity = fromFolderIdentity; // identify the folder to move to ObjectPath folderPath = new ObjectPath(targetLocPathString); ObjectIdentity toFolderIdentity = new ObjectIdentity(); toFolderIdentity.Value = folderPath; toFolderIdentity.RepositoryName = DefaultRepository; ObjectLocation toLocation = new ObjectLocation(); toLocation.Identity = toFolderIdentity; OperationOptions operationOptions = null; objectService.Move(new ObjectIdentitySet(docToCopy), fromLocation, toLocation, new DataPackage(), operationOptions); }
public DataObject CreateAndLinkToFolder(String folderPath) { // create a contentless document to link into folder String objectName = "linkedDocument" + System.DateTime.Now.Ticks; Console.WriteLine("Constructed document " + objectName); String repositoryName = DefaultRepository; ObjectIdentity sampleObjId = new ObjectIdentity(repositoryName); DataObject sampleDataObject = new DataObject(sampleObjId, "dm_document"); sampleDataObject.Properties.Set("object_name", objectName); // add the folder to link to as a ReferenceRelationship ObjectPath objectPath = new ObjectPath(folderPath); ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository); ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship(); sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER; sampleFolderRelationship.Target = sampleFolderIdentity; sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT; sampleDataObject.Relationships.Add(sampleFolderRelationship); // create a new document linked into parent folder OperationOptions operationOptions = null; DataPackage dataPackage = new DataPackage(sampleDataObject); DataPackage resultPackage = objectService.Create(dataPackage, operationOptions); DataObject resultDataObject = resultPackage.DataObjects[0]; return(resultDataObject); }
public DataObject RetrieveVdmInfo(ObjectIdentity objectIdentity, Boolean isSnapshot) { VdmRetrieveProfile retrieveProfile = new VdmRetrieveProfile(); retrieveProfile.IsShouldFollowAssembly = isSnapshot; retrieveProfile.Binding = "CURRENT"; OperationOptions options = new OperationOptions(); options.VdmRetrieveProfile = retrieveProfile; DataObject resultDO = virtualDocumentService.Retrieve(objectIdentity, options); List <Relationship> relationships = resultDO.Relationships; Console.WriteLine("Total relationships in virtual document = " + relationships.Count); int i = 0; foreach (Relationship r in relationships) { Console.WriteLine(); ReferenceRelationship refRel = (ReferenceRelationship)r; Console.WriteLine("Child node " + i++ + ": " + refRel.Target.GetValueAsString()); PropertySet nodeProperties = refRel.RelationshipProperties; List <Property> properties = nodeProperties.Properties; foreach (Property p in properties) { Console.Write(p.Name + ": "); Console.WriteLine(p.GetValueAsString()); } } return(resultDO); }
public DataPackage UpdateFetchedObjectProperties(ObjectIdentity objectIdentity, String newTitle, String newSubject, String[] newKeywords) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); OperationOptions operationOptions = null; DataPackage dP = objectService.Get(new ObjectIdentitySet(objectIdentity), operationOptions); DataObject dataObject = dP.DataObjects[0]; PropertySet properties = new PropertySet(); properties.Set("title", newTitle); properties.Set("subject", newSubject); properties.Set("keywords", newKeywords); dataObject.Properties = properties; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
public void DetachLifecycle(ObjectIdentity objectIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(objectIdentity); OperationOptions operationOptions = null; lifecycleService.Detach(objIdSet, operationOptions); }
private void GetWithContent(string geoLoc, ContentTransferMode trMode) { sampleContentManager.CreateDemoObjects(); if (geoLoc.Equals("") || geoLoc.Equals(null)) { geoLoc = "Pleasanton"; } if (trMode.Equals(null)) { trMode = ContentTransferMode.MTOM; } try { ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString), objectServiceDemo.DefaultRepository); DataObject dataObject = objectServiceDemo.GetWithContent(objIdentity, geoLoc, trMode); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public void TestUpdateRepeatProperty() { Console.WriteLine("\nTesting update of repeating property."); try { sampleContentManager.CreateDemoObjects(); ObjectIdentity docID = new ObjectIdentity(); docID.RepositoryName = objectServiceDemo.DefaultRepository; docID.Value = new Qualification(SampleContentManager.gifImageQualString); objectServiceDemo.UpdateRepeatProperty(docID); Console.WriteLine("Updated keywords property of " + docID.GetValueAsString()); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
private void createTestVirtualDocument() { // create a new DataObject to use as the parent node ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository); DataObject parentDO = new DataObject(emptyIdentity); parentDO.Type = "dm_document"; PropertySet parentProperties = new PropertySet(); parentProperties.Set("object_name", SampleContentManager.testVdmObjectName); parentDO.Properties = parentProperties; // link into a folder ObjectPath objectPath = new ObjectPath(SampleContentManager.sourcePath); ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository); ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship(); sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER; sampleFolderRelationship.Target = sampleFolderIdentity; sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT; parentDO.Relationships.Add(sampleFolderRelationship); // get id of document to use for first child node ObjectIdentity child0Id = new ObjectIdentity(); child0Id.RepositoryName = DefaultRepository; child0Id.Value = new Qualification(SampleContentManager.gifImageQualString); // get id of document to use for second child node ObjectIdentity child1Id = new ObjectIdentity(); child1Id.RepositoryName = DefaultRepository; child1Id.Value = new Qualification(SampleContentManager.gifImage1QualString); ObjectIdentitySet childNodes = new ObjectIdentitySet(); childNodes.AddIdentity(child0Id); childNodes.AddIdentity(child1Id); virtualDocumentServiceDemo.AddChildNodes(parentDO, childNodes); }
public void TestUpdateRelinkFolder() { Console.WriteLine("\nTesting unlinking an object from one folder and linking to another."); try { sampleContentManager.CreateDemoObjects(); ObjectIdentity documentId = sampleContentManager.GetSampleObjectId(SampleContentManager.gifImageObjectName); ObjectPath sourceFolderPath = new ObjectPath(SampleContentManager.sourcePath); ObjectPath targetFolderPath = new ObjectPath(SampleContentManager.targetPath); ObjectIdentity sourceFolderId = new ObjectIdentity(sourceFolderPath, objectServiceDemo.DefaultRepository); ObjectIdentity targetFolderId = new ObjectIdentity(targetFolderPath, objectServiceDemo.DefaultRepository); objectServiceDemo.UpdateRelinkFolder(documentId, sourceFolderId, targetFolderId); Console.WriteLine("Relinked object " + documentId.GetValueAsString() + " to folder " + targetFolderPath); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public void TestCreateFolderAndLinkedDoc() { Console.WriteLine("\nTesting creation of new folder and document linked to it."); try { DataPackage resultDataPackage = objectServiceDemo.CreateFolderAndLinkedDoc(); DataObject resultDataObject = resultDataPackage.DataObjects[0]; // get the parent relationship to the folder object ReferenceRelationship refRelationship = (ReferenceRelationship)resultDataObject.Relationships[0]; String folderId = refRelationship.Target.Value.ToString(); ObjectIdentity folderIdentity = new ObjectIdentity(new ObjectId(folderId), DefaultRepository); Console.WriteLine("Created document " + resultDataObject.Identity.GetValueAsString() + " in folder " + folderId); // add the folder identity to the collection of stuff to delete after running the sample sampleContentManager.AddCreatedObjects(folderIdentity); } catch (FaultException <SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteCreatedObjects(); } }
public void ObjServiceCopy(String sourceObjectPathString, String targetLocPathString) { // identify the object to copy ObjectPath objPath = new ObjectPath(sourceObjectPathString); ObjectIdentity docToCopy = new ObjectIdentity(); docToCopy.Value = objPath; docToCopy.RepositoryName = DefaultRepository; // identify the folder to copy to ObjectPath folderPath = new ObjectPath(targetLocPathString); ObjectIdentity toFolderIdentity = new ObjectIdentity(); toFolderIdentity.Value = folderPath; toFolderIdentity.RepositoryName = DefaultRepository; ObjectLocation toLocation = new ObjectLocation(); toLocation.Identity = toFolderIdentity; OperationOptions operationOptions = null; objectService.Copy(new ObjectIdentitySet(docToCopy), toLocation, new DataPackage(), operationOptions); }
private void setSampleFolderRelationship() { ObjectPath objectPath = new ObjectPath(sourcePath); ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, serviceDemo.DefaultRepository); sampleFolderRelationship = new ReferenceRelationship(); sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER; sampleFolderRelationship.Target = sampleFolderIdentity; sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT; }
public void PromoteLifecycle(ObjectIdentity objectIdentity) { LifecycleOperation lifecycleOperation = new LifecycleOperation(); lifecycleOperation.Name = LifecycleOperation.PROMOTE; lifecycleOperation.Label = "Promote"; lifecycleOperation.ObjectId = objectIdentity; List<LifecycleOperation> lcOperationsList = new List<LifecycleOperation>(); lcOperationsList.Add(lifecycleOperation); OperationOptions operationOptions = null; lifecycleService.Execute(lcOperationsList, operationOptions); }
public void DemoteLifecycleToBase(ObjectIdentity objectIdentity) { LifecycleOperation lifecycleOperation = new LifecycleOperation(); lifecycleOperation.Name = LifecycleOperation.DEMOTE; lifecycleOperation.Label = "Demote"; lifecycleOperation.ObjectId = objectIdentity; LifecycleExecutionProfile lcExecProfile = new LifecycleExecutionProfile(); lcExecProfile.ResetToBase = true; OperationOptions operationOptions = new OperationOptions(); operationOptions.Profiles.Add(lcExecProfile); List<LifecycleOperation> lcOperationsList = new List<LifecycleOperation>(); lcOperationsList.Add(lifecycleOperation); lifecycleService.Execute(lcOperationsList, operationOptions); }
public void AttachLifecycle(ObjectIdentity objId, ObjectIdentity policyId, String aliasSetName) { AttachLifecycleInfo attachLcInfo = new AttachLifecycleInfo(); // this must be the name of an alias set listed in // the alias_set_ids attribute of the dm_policy (lifecycle) object // if null or empty the content server will set the policy scope attachLcInfo.PolicyScope = aliasSetName; attachLcInfo.PolicyId = policyId; attachLcInfo.ObjectId = objId; OperationOptions operationOptions = null; List<AttachLifecycleInfo> attachLcInfoList = new List<AttachLifecycleInfo>(); attachLcInfoList.Add(attachLcInfo); lifecycleService.Attach(attachLcInfoList, operationOptions); }
public DataPackage Checkin(ObjectIdentity objIdentity, String newContentPath) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); OperationOptions operationOptions = new OperationOptions(); ContentProfile contentProfile = new ContentProfile(FormatFilter.ANY, null, PageFilter.ANY, -1, PageModifierFilter.ANY, null); operationOptions.ContentProfile = contentProfile; DataPackage checkinPackage = versionControlService.Checkout(objIdSet, operationOptions); DataObject checkinObj = checkinPackage.DataObjects[0]; checkinObj.Contents = null; FileContent newContent = new FileContent(); newContent.LocalPath = newContentPath; newContent.RenditionType = RenditionType.PRIMARY; newContent.Format = "gif"; checkinObj.Contents.Add(newContent); bool retainLock = false; List<String> labels = new List<String>(); labels.Add("test_version"); DataPackage resultDp; try { resultDp = versionControlService.Checkin(checkinPackage, VersionStrategy.NEXT_MINOR, retainLock, labels, operationOptions); } catch (Exception e) { Console.WriteLine(e.StackTrace); throw new Exception(e.Message); } return resultDp; }
public void DeleteTestCabinet(String repository) { if (!isDataCleanedUp) { Console.WriteLine("Test cabinet, folders, and sample images will not be deleted because SampleContentManager.isDataCleanedUp = false"); return; } DeleteProfile deleteProfile = new DeleteProfile(); deleteProfile.IsDeepDeleteFolders = true; deleteProfile.IsDeepDeleteChildrenInFolders = true; OperationOptions operationOptions = new OperationOptions(); operationOptions.DeleteProfile = deleteProfile; ObjectPath objectPath = new ObjectPath(testCabinetPath); ObjectIdentity sampleCabinetIdentity = new ObjectIdentity(objectPath, repository); ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.AddIdentity(sampleCabinetIdentity); objectService.Delete(objIdSet, operationOptions); Console.WriteLine("Deleted test cabinet " + testCabinetPath + " on " + repository); }
public void ShowLifecycleInfo(ObjectIdentity objectIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(objectIdentity); List<LifecycleInfo> lcInfoList = lifecycleService.GetLifecycle(objIdSet, null); LifecycleInfo lcInfo = lcInfoList[0]; // if no lifecycle is attached, the policyId will have the null id if (lcInfo.PolicyId.GetValueAsString().Equals("0000000000000000")) { Console.WriteLine("No lifecycle attached to object."); } else { Console.WriteLine("Lifecycle name is " + lcInfo.PolicyName); Console.WriteLine("Current state is " + lcInfo.StateName); Console.WriteLine("Available operations are:"); foreach (LifecycleOperation lcOperation in lcInfo.EnabledOperations) { Console.WriteLine(" " + lcOperation.Name); } } }
public void ShowObjectIdentity() { String repName = "MyRepositoryName"; ObjectIdentity[] objectIdentities = new ObjectIdentity[4]; // repository only is required to represent an object that has not been created objectIdentities[0] = new ObjectIdentity(repName); // show each form of unique identifier ObjectId objId = new ObjectId("090007d280075180"); objectIdentities[1] = new ObjectIdentity(objId, repName); Qualification qualification = new Qualification("dm_document where r_object_id = '090007d280075180'"); objectIdentities[2] = new ObjectIdentity(qualification, repName); ObjectPath objPath = new ObjectPath("/testCabinet/testFolder/testDoc"); objectIdentities[3] = new ObjectIdentity(objPath, repName); foreach (ObjectIdentity identity in objectIdentities) { Console.WriteLine(identity.GetValueAsString()); } }
public ProcessInfo processInfo(ObjectIdentity processId) { try { ProcessInfo processInfo = workflowService.GetProcessInfo(processId); Console.WriteLine("Process template " + processId.GetValueAsString()); Console.WriteLine("Name is " + processInfo.ProcessInstanceName); Console.WriteLine("isAliasAssignmentRequired == " + processInfo.IsAliasAssignmentRequired()); Console.WriteLine("isPerformerAssignmentRequired == " + processInfo.IsPerformerAssignmentRequired()); return processInfo; } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); throw new Exception(e.Message); } }
public void ShowObjectIdentitySet() { String repName = "MyRepositoryName"; ObjectIdentitySet objIdSet = new ObjectIdentitySet(); ObjectIdentity[] objectIdentities = new ObjectIdentity[4]; // add some ObjectIdentity instances ObjectId objId = new ObjectId("090007d280075180"); objIdSet.AddIdentity(new ObjectIdentity(objId, repName)); Qualification qualification = new Qualification("dm_document where object_name = 'bl_upwind.gif'"); objIdSet.AddIdentity(new ObjectIdentity(qualification, repName)); ObjectPath objPath = new ObjectPath("/testCabinet/testFolder/testDoc"); objIdSet.AddIdentity(new ObjectIdentity(objPath, repName)); // walk through and see what we have IEnumerator<ObjectIdentity> identityEnumerator = objIdSet.Identities.GetEnumerator(); while (identityEnumerator.MoveNext()) { Console.WriteLine("Object Identity: " + identityEnumerator.Current); } }
public void TestCheckoutInfoNonCurrent() { Console.WriteLine("\nRunning version control non-current version info sample."); try { sampleContentManager.CreateDemoObjects(); sampleContentManager.VersionSampleObjects(); ObjectIdentity objIdentity = new ObjectIdentity(new Qualification(nonCurrentQual), versionControlServiceDemo.DefaultRepository); versionControlServiceDemo.CheckoutInfo(objIdentity); } catch (FaultException<SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
private void attachTestLifecycle() { ObjectIdentity objId = new ObjectIdentity(); objId.RepositoryName = DefaultRepository; objId.Value = new Qualification(SampleContentManager.gifImageQualString); ObjectIdentity policyId = new ObjectIdentity(); policyId.RepositoryName = DefaultRepository; String lifecycleQualString = "dm_policy where object_name='BusinessPolicy1' and owner_name='" + sampleContentManager.GetUserNameFromRepository() + "'"; policyId.Value = new Qualification(lifecycleQualString); lifecycleServiceDemo.AttachLifecycle(objId, policyId, null); Console.WriteLine("Completed attach of lifecycle."); Console.WriteLine("Lifecycle: " + lifecycleQualString); Console.WriteLine("Attached to document: " + SampleContentManager.gifImageQualString); }
public void TestShowLifecycle() { try { Console.WriteLine("\nTesting lifecycle info..."); sampleContentManager.CreateDemoObjects(); attachTestLifecycle(); ObjectIdentity objId = new ObjectIdentity(); objId.RepositoryName = DefaultRepository; objId.Value = new Qualification(SampleContentManager.gifImageQualString); lifecycleServiceDemo.ShowLifecycleInfo(objId); } catch (FaultException<SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }
public DataPackage UpdateRepeatProperty(ObjectIdentity objectIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); String[] moreDangers = { "snakes", "sharks" }; ArrayProperty<string> keywordProperty = new StringArrayProperty("keywords", moreDangers); Console.WriteLine("Appending additional strings 'snakes' and 'sharks' to object keywords."); ValueAction appendAction = new ValueAction(ValueActionType.INSERT, 0); ValueAction deleteAction = new ValueAction(ValueActionType.APPEND, 1); keywordProperty.SetValueActions(appendAction, deleteAction); PropertySet properties = new PropertySet(); properties.Set(keywordProperty); dataObject.Properties = properties; OperationOptions operationOptions = null; return objectService.Update(new DataPackage(dataObject), operationOptions); }
public void ObjServiceCopyAcrossRepositories(String sourceObjectPathString, String targetLocPathString) { // identify the object to copy ObjectPath objPath = new ObjectPath(sourceObjectPathString); ObjectIdentity docToCopy = new ObjectIdentity(); docToCopy.Value = objPath; docToCopy.RepositoryName = DefaultRepository; // identify the folder to copy to ObjectPath folderPath = new ObjectPath(); folderPath.Path = targetLocPathString; ObjectIdentity toFolderIdentity = new ObjectIdentity(); toFolderIdentity.Value = folderPath; toFolderIdentity.RepositoryName = SecondaryRepository; ObjectLocation toLocation = new ObjectLocation(); toLocation.Identity = toFolderIdentity; OperationOptions operationOptions = null; objectService.Copy(new ObjectIdentitySet(docToCopy), toLocation, null, operationOptions); }
public FileInfo GetObjectWithUrl(ObjectIdentity objIdentity) { objIdentity.RepositoryName = this.DefaultRepository; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List<ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objIdentity); List<ObjectContentSet> urlList = objectService.GetObjectContentUrls(objectIdSet); ObjectContentSet objectContentSet = (ObjectContentSet)urlList[0]; UrlContent urlContent = (UrlContent)objectContentSet.Contents[0]; if (urlContent.CanGetAsFile()) { // downloads the file using the ACS URL FileInfo file = urlContent.GetAsFile(); Console.WriteLine("File exists: " + file.Exists); Console.WriteLine("File full name: " + file.FullName); return file; } return null; }
public DataObject GetFilterContentNone(ObjectIdentity objectIdentity) { ContentProfile contentProfile = new ContentProfile(); contentProfile.FormatFilter = FormatFilter.NONE; OperationOptions operationOptions = new OperationOptions(); operationOptions.ContentProfile = contentProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List<ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }
public DataObject GetFilterContentSpecific(String qualificationString) { ContentProfile contentProfile = new ContentProfile(); contentProfile.FormatFilter = FormatFilter.SPECIFIED; contentProfile.Format = "gif"; contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER; OperationOptions operationOptions = new OperationOptions(); operationOptions.ContentProfile = contentProfile; ObjectIdentity objectIdentity = new ObjectIdentity (new Qualification(qualificationString), DefaultRepository); ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity); DataPackage dataPackage = null; dataPackage = objectService.Get(objectIdSet, operationOptions); DataObject dataObject = dataPackage.DataObjects[0]; Content resultContent = dataObject.Contents[0]; String contentClassName = resultContent.GetType().FullName; Console.WriteLine("Returned content as type " + contentClassName); if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent")) { UrlContent urlContent = (UrlContent)resultContent; Console.WriteLine("Content ACS URL is: " + (urlContent.Url)); } if (resultContent.CanGetAsFile()) { FileInfo fileInfo = resultContent.GetAsFile(); Console.WriteLine("Returned content format is " + resultContent.Format); Console.WriteLine("Got content as file " + fileInfo.FullName); } return dataObject; }
public DataPackage UpdateFetchedObjectProperties(ObjectIdentity objectIdentity, String newTitle, String newSubject, String[] newKeywords) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); OperationOptions operationOptions = null; DataPackage dP = objectService.Get(new ObjectIdentitySet(objectIdentity), operationOptions); DataObject dataObject = dP.DataObjects[0]; PropertySet properties = new PropertySet(); properties.Set("title", newTitle); properties.Set("subject", newSubject); properties.Set("keywords", newKeywords); dataObject.Properties = properties; return objectService.Update(new DataPackage(dataObject), operationOptions); }
public DataPackage UpdateRelinkFolder(ObjectIdentity docId, ObjectIdentity sourceFolderId, ObjectIdentity targetFolderId) { DataObject docDataObj = new DataObject(docId, "dm_document"); // add the source folder as a parent relationship of the document ReferenceRelationship removeRelationship = new ReferenceRelationship(); removeRelationship.TargetRole = Relationship.ROLE_PARENT; removeRelationship.Name = Relationship.RELATIONSHIP_FOLDER; removeRelationship.Target = sourceFolderId; docDataObj.Relationships.Add(removeRelationship); // specify that the folder is to be unlinked removeRelationship.IntentModifier = RelationshipIntentModifier.REMOVE; Console.WriteLine("Set to remove relationship from parent folder " + sourceFolderId.GetValueAsString()); // add the folder into which to link document ReferenceRelationship addRelationship = new ReferenceRelationship(); addRelationship.TargetRole = Relationship.ROLE_PARENT; addRelationship.Name = Relationship.RELATIONSHIP_FOLDER; addRelationship.Target = targetFolderId; docDataObj.Relationships.Add(addRelationship); Console.WriteLine("Set relationship to parent folder " + targetFolderId.GetValueAsString()); OperationOptions operationOptions = null; return objectService.Update(new DataPackage(docDataObj), operationOptions); }
public void UpdateProperties(ObjectIdentity objectIdentity, String newPropVal) { DataObject dataObject = new DataObject(objectIdentity, "dm_document"); dataObject.Properties.Set("subject", newPropVal); OperationOptions operationOptions = null; objectService.Update(new DataPackage(dataObject), operationOptions); }
public void UpdateContent(ObjectIdentity objectIdentity, String newContentPath) { DataObject dataObject = new DataObject(objectIdentity, "dm_document"); dataObject.Contents.Add(new FileContent(newContentPath, "gif")); OperationOptions operationOptions = null; objectService.Update(new DataPackage(dataObject), operationOptions); }
public void ConstructDataObject(String repositoryName, String objName, String objTitle) { ObjectIdentity objIdentity = new ObjectIdentity(repositoryName); DataObject dataObject = new DataObject(objIdentity, "dm_document"); PropertySet properties = dataObject.Properties; properties.Set("object_name", objName); properties.Set("title", objTitle); properties.Set("a_content_type", "gif"); dataObject.Contents.Add(new FileContent("c:/temp/MyImage.gif", "gif")); DataPackage dataPackage = new DataPackage(dataObject); }
public void TestRetrieveVdmInfo() { Console.WriteLine("\nTesting retrieve virtual document info..."); try { sampleContentManager.CreateDemoObjects(); createTestVirtualDocument(); // create ObjectIdentity of existing virtual document ObjectIdentity testVdmId = new ObjectIdentity(); testVdmId.RepositoryName = DefaultRepository; Qualification qual = new Qualification(SampleContentManager.testVdmQualString); qual.ObjectType = "dm_document"; testVdmId.Value = qual; virtualDocumentServiceDemo.RetrieveVdmInfo(testVdmId, false); } catch (FaultException<SerializableException> ex) { Console.WriteLine(String.Format("Got FaultException[{0}] with message: {1}\n", ex.Detail, ex.Message)); } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } finally { sampleContentManager.DeleteTestCabinet(); } }