Exemplo n.º 1
0
        public void TestGetFilterPropertiesExclude()
        {
            Console.WriteLine("\nTesting get object using property exclude setting.");
            sampleContentManager.CreateDemoObjects();
            ObjectIdentity objIdentity =
                new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString),
                                   objectServiceDemo.DefaultRepository);

            try
            {
                DataObject dataObject = objectServiceDemo.GetObjectFilterPropertiesExclude(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();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
            }
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        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();
            }
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 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();
     }
 }
Exemplo n.º 8
0
        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 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);
            }
        }
Exemplo n.º 10
0
 public void TestCreatePath()
 {
     Console.WriteLine("\nTesting creation of new path in repository.");
     try
     {
         String folderPath = SampleContentManager.testCabinetPath + "/testCreatePathFolder";
         Console.WriteLine("Calling CreateFolderInCabinet sample method.");
         ObjectIdentity objectIdentity = objectServiceDemo.CreateFolderInCabinet(folderPath);
         Console.WriteLine("Created path: " + objectIdentity.GetValueAsString() + ", " + SampleContentManager.testCabinetPath);
     }
     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 TestGetFilterPropertiesExclude()
 {
     Console.WriteLine("\nTesting get object using property exclude setting.");
     sampleContentManager.CreateDemoObjects();
     ObjectIdentity objIdentity =
         new ObjectIdentity(new Qualification(SampleContentManager.gifImageQualString),
                            objectServiceDemo.DefaultRepository);
     try
     {
         DataObject dataObject = objectServiceDemo.GetObjectFilterPropertiesExclude(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();
     }
 }
 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();
     }
 }
        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();
            }
        }
 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();
     }
 }
Exemplo n.º 15
0
 /*
  *  Adds an ObjectIdentity to createdObjectIdentities
  *  Builds a list of objects to clean up after a test
  * */
 public void AddCreatedObjects(ObjectIdentity objectIdentity)
 {
     createdObjectIdentities.AddIdentity(objectIdentity);
     Console.WriteLine("Added " + objectIdentity.GetValueAsString() + " to collection of sample data.");
 }
 /*
  *  Adds an ObjectIdentity to createdObjectIdentities
  *  Builds a list of objects to clean up after a test
  * */
 public void AddCreatedObjects(ObjectIdentity objectIdentity)
 {
     createdObjectIdentities.AddIdentity(objectIdentity);
     Console.WriteLine("Added " + objectIdentity.GetValueAsString() + " to collection of sample data.");
 }
Exemplo n.º 17
0
        public void startProcess(String processId,
                                 String processName,
                                 String supervisor,
                                 ObjectId wfAttachment,
                                 List <ObjectId> docIds,
                                 String noteText,
                                 String userName,
                                 String groupName,
                                 String queueName)
        {
            // get the template ProcessInfo
            ObjectId    objId = new ObjectId(processId);
            ProcessInfo info  = workflowService
                                .GetProcessInfo(new ObjectIdentity(objId, DefaultRepository));

            // set specific info for this workflow
            info.Supervisor          = supervisor;
            info.ProcessInstanceName = processName + new DateTime();

            // workflow attachment
            info.AddWorkflowAttachment("dm_sysobject", wfAttachment);

            // packages
            List <ProcessPackageInfo> pkgList = info.Packages;

            foreach (ProcessPackageInfo pkg in pkgList)
            {
                pkg.AddDocuments(docIds);
                pkg.AddNote("note for " + pkg.PackageName + " " + noteText, true);
            }

            // alias
            if (info.IsAliasAssignmentRequired())
            {
                List <ProcessAliasAssignmentInfo> aliasList
                    = info.AliasAssignments;
                foreach (ProcessAliasAssignmentInfo aliasInfo in aliasList)
                {
                    String aliasName        = aliasInfo.AliasName;
                    String aliasDescription = aliasInfo.AliasDescription;
                    int    category         = aliasInfo.AliasCategory;
                    if (category == 1) // User
                    {
                        aliasInfo.AliasValue = userName;
                    }
                    else if (category == 2 || category == 3) // group, user or group
                    {
                        aliasInfo.AliasValue = groupName;
                    }

                    Console.WriteLine("Set alias: "
                                      + aliasName
                                      + ", description: "
                                      + aliasDescription
                                      + ", category: "
                                      + category
                                      + " to "
                                      + aliasInfo.AliasValue);
                }
            }

            // Performer.
            if (info.IsPerformerAssignmentRequired())
            {
                List <ProcessPerformerAssignmentInfo> perfList
                    = info.PerformerAssignments;
                foreach (ProcessPerformerAssignmentInfo perfInfo in perfList)
                {
                    int           category = perfInfo.Category;
                    int           perfType = perfInfo.PerformerType;
                    String        name     = "";
                    List <String> nameList = new List <String>();
                    if (category == 0) // User
                    {
                        name = userName;
                    }
                    else if (category == 1 || category == 2) // Group, user or group
                    {
                        name = groupName;
                    }
                    else if (category == 4)     // work queue
                    {
                        name = queueName;
                    }
                    nameList.Add(name);
                    perfInfo.Performers = nameList;

                    Console.WriteLine("Set performer perfType: " + perfType +
                                      ", category: " + category + " to " + name);
                }
            }

            ObjectIdentity wf = workflowService.StartProcess(info);

            Console.WriteLine("started workflow: " + wf.GetValueAsString());
        }
 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();
     }
 }
        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);
        }