private void SetMediaUrlPolicy(GenericOptions options) { if (!options.ContainsParam(MEDIA_URL_POLICY)) { options.SetQuery(MEDIA_URL_POLICY, "all"); } }
private void SetModifier(GenericOptions options, string modifier) { if (!String.IsNullOrEmpty(modifier)) { options.SetQuery("modifier", modifier); } }
/// <summary> /// Checkin a new document as branch version /// </summary> /// <param name="newDoc"></param> /// <param name="options"></param> /// <returns></returns> public Document CheckinBranch(Document newDoc, GenericOptions options) { return(Client.Post <Document>( GetFullLinks(), LinkRelations.CHECKIN_BRANCH_VERSION.Rel, newDoc, options)); }
/// <summary> /// Checkin a new document as next minor version /// </summary> /// <param name="newDoc"></param> /// <param name="options"></param> /// <returns></returns> public Document CheckinMinor(Document newDoc, GenericOptions options) { return(Client.Post <Document>( GetFullLinks(), LinkRelations.CHECKIN_NEXT_MINOR.Rel, newDoc, options)); }
/// <summary> /// Link this object to a new folder /// </summary> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns></returns> public FolderLink LinkToFolder(Folder newObj, GenericOptions options) { return(Client.Post <Folder, FolderLink>( GetFullLinks(), LinkRelations.PARENT_LINKS.Rel, newObj, options)); }
/// <summary> /// Update a user /// </summary> /// <typeparam name="T"></typeparam> /// <param name="newUser"></param> /// <param name="options"></param> /// <returns></returns> public T Update <T>(T newUser, GenericOptions options) where T : User { return(Client.Post <T>( GetFullLinks(), LinkRelations.EDIT.Rel, newUser, options)); }
/// <summary> /// Create a PersistentObject resource under this folder /// </summary> /// <typeparam name="T"></typeparam> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns>Returns Type object</returns> public T CreateSubObject <T>(T newObj, GenericOptions options) where T : PersistentObject { return(Client.Post <T>( GetFullLinks(), LinkRelations.OBJECTS.Rel, newObj, options)); }
/// <summary> /// Link a PersistentObject resource to this folder /// </summary> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns>Returns Folder link </returns> public FolderLink LinkFrom(Document newObj, GenericOptions options) { return(Client.Post <Document, FolderLink>( GetFullLinks(), LinkRelations.CHILD_LINKS.Rel, newObj, options)); }
/// <summary> /// Create a folder resource under this folder /// </summary> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns>Returns Folder object</returns> public Folder CreateSubFolder(Folder newObj, GenericOptions options) { return(Client.Post <Folder>( GetFullLinks(), LinkRelations.FOLDERS.Rel, newObj, options)); }
/// <summary> /// Move current folder link's target folder to a new folder location /// </summary> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns></returns> public FolderLink MoveTo(Folder newObj, GenericOptions options) { return(Client.Put <Folder, FolderLink>( this.Links, LinkRelations.SELF.Rel, newObj, options)); }
/// <summary> /// Create a document resource under this folder /// </summary> /// <param name="newObj"></param> /// <param name="options"></param> /// <returns>Returns RestDocument object</returns> public Document CreateSubDocument(Document newObj, GenericOptions options) { return(Client.Post <Document>( GetFullLinks(), LinkRelations.DOCUMENTS.Rel, newObj, options)); }
/// <summary> /// Create a new content (rendition) for this document /// </summary> /// <param name="contentStream"></param> /// <param name="mimeType"></param> /// <param name="options"></param> /// <returns></returns> public ContentMeta CreateContent(Stream contentStream, string mimeType, GenericOptions options) { return(Client.Post <ContentMeta>( GetFullLinks(), LinkRelations.CONTENTS.Rel, contentStream, mimeType, options)); }
/// <summary> /// /// </summary> /// <param name="doc"></param> /// <param name="file"></param> /// <returns>RestDocument</returns> public Document ImportDocumentAsNewVersion(Document doc, FileInfo file) { GenericOptions checkinOptions = new GenericOptions(); checkinOptions.SetQuery("format", ObjectUtil.getDocumentumFormatForFile(file.Name)); checkinOptions.SetQuery("page", 0); checkinOptions.SetQuery("primary", true); checkinOptions.SetQuery("version-label", "ImportAsNewVersion"); return(ImportDocumentAsNewVersion(doc, file.OpenRead(), ObjectUtil.getMimeTypeFromFileName(file.Name), checkinOptions)); }
public Func <Equipment, bool> ValidateMatchingGroup(string group, GenericOptions genericOptions) { switch (genericOptions) { case (GenericOptions.Any): return(item => item.Stats.Any(x => x.Affix.Group == group)); case (GenericOptions.None): return(item => item.Stats.All(x => x.Affix.Group != group)); } throw new InvalidOperationException("Invalid matching group validation"); }
public void NewSessionRequest_ForGenericDriver_ShouldContainExpectedCapabilities() { GenericOptions genericOptions = new GenericOptions(); SessionRequest sessionRequest = new SessionRequest(null, genericOptions); Assert.AreEqual(1, sessionRequest.Capabilities.Count); Assert.IsTrue(sessionRequest.Capabilities.ContainsKey("PlatformName")); sessionRequest.Capabilities.TryGetValue("PlatformName", out object actualPlatformName); Assert.AreEqual("ANY", actualPlatformName.ToString()); }
protected void CreateRendition(int page, bool isPrimary) { List <string> idsWithRenditions = new List <string>(); List <DocumentTracker> newList = new List <DocumentTracker>(Tracker); double moveCount = Math.Ceiling(newList.Count * .30); for (int a = 0; a < moveCount; a++) { DocumentTracker aDoc = ObjectUtil.getRandomObjectFromList <DocumentTracker>(newList); // Make sure we do not use this again newList.Remove(aDoc); String objectId = aDoc.DocumentId; Document doc = CurrentRepository.GetSysObjectById <Document>(objectId); //getDocumentByQualification( //String.Format("dm_document where r_object_id = '{0}'", objectId), null); FileInfo file = ObjectUtil.getRandomFileFromDirectory(importFilesDirectory); String mimeType = ObjectUtil.getMimeTypeFromFileName(file.Name); // Upload the content as a new rendition GenericOptions rendOptions = new GenericOptions(); String format = ObjectUtil.getDocumentumFormatForFile(file.Extension); rendOptions.SetQuery("format", format); rendOptions.SetQuery("page", page); // If you want to allow multiple renditions of the same format, the modifier must be set, this makes the rendition unique in the list // the "modifier" is more like a label/tag for the rendition in the list. rendOptions.SetQuery("modifier", "Test"); // With primary false, will be added as a rendition rendOptions.SetQuery("primary", isPrimary); ContentMeta renditionMeta = doc.CreateContent(file.OpenRead(), mimeType, rendOptions); Feed <ContentMeta> contents = doc.GetContents <ContentMeta>(new FeedGetOptions { Inline = true }); List <Entry <ContentMeta> > entries = (List <Entry <ContentMeta> >)contents.Entries; WriteOutput("\t\t[AddRendition] - Rendition Added for RestDocument ID: " + doc.GetPropertyValue("r_object_id") + ":" + doc.GetPropertyValue("object_name")); foreach (Entry <ContentMeta> entry in entries) { ContentMeta rendition = entry.Content; WriteOutput("\t\t\tRendition Format: " + rendition.GetPropertyValue("full_format") + " Modifier: " + rendition.GetRepeatingString("page_modifier", 0)); //((Object[])rendition.getAttributeValue("page_modifier"))[0].ToString()); } idsWithRenditions.Add(objectId); } IDsWithRenditions = idsWithRenditions; }
public Command(GenericOptions options) { if (options.outputFile == null) { this.outfile = options.inputFile; } else { this.outfile = options.outputFile; } this.infile = options.inputFile; var readOnly = this.infile != this.outfile; this.module = this.read_module(this.infile, readOnly); }
//Autogenerated code. End of implementation [Command_RefdesReport] //Autogenerated code. Begin of implementation [GetState_DocGrouping] public void GetState_DocGrouping(IServerDocumentView argContext, ref string argParameters, ref bool argEnabled, ref bool argChecked, ref bool argVisible, ref string argCaption, ref string argImageFile) { switch (argParameters) { case "Project": argChecked = new GenericOptions().GroupEnabled(TDocumentsBarGrouping.dbgByProject); break; case "Type": argChecked = new GenericOptions().GroupEnabled(TDocumentsBarGrouping.dbgByDocKind); break; case "Disabled": argChecked = new GenericOptions().GroupEnabled(TDocumentsBarGrouping.dbgNone); break; default: break; } }
public D2Document ImportNewD2Document(FileInfo file, string documentName, string repositoryPath, D2Configuration d2config) { //if (!repositoryPath.StartsWith("/")) throw new Exception("Repository path " + repositoryPath + " is not valid." // + " The path must be a fully qualified path"); //Folder importFolder = getOrCreateFolderByPath(repositoryPath); //if (importFolder == null) throw new Exception("Unable to fetch or create folder by path: " + repositoryPath); D2Document newDocument = new D2Document(); newDocument.SetPropertyValue("object_name", documentName); newDocument.SetPropertyValue("r_object_type", "dm_document"); if (d2config != null) { newDocument.Configuration = d2config; } GenericOptions importOptions = new GenericOptions(); importOptions.SetQuery("format", ObjectUtil.getDocumentumFormatForFile(file.Extension)); D2Document created = ImportD2DocumentWithContent(newDocument, file.OpenRead(), ObjectUtil.getMimeTypeFromFileName(file.Name), importOptions); return(created); }
/// <summary> /// Imports an email into the system /// </summary> /// <param name="file"></param> /// <param name="documentName"></param> /// <param name="repositoryPath"></param> /// <returns>EmailPackage</returns> public EmailPackage ImportEmail(FileInfo file, string documentName, string repositoryPath) { if (!repositoryPath.StartsWith("/")) { throw new Exception("Repository path " + repositoryPath + " is not valid." + " The path must be a fully qualified path"); } Folder importFolder = GetOrCreateFolderByPath(repositoryPath); if (importFolder == null) { throw new Exception("Unable to fetch or create folder by path: " + repositoryPath); } Document newDocument = NewDocument(documentName, DocumentType); GenericOptions importOptions = new GenericOptions(); importOptions.SetQuery("format", ObjectUtil.getDocumentumFormatForFile(file.Extension)); EmailPackage email = importFolder.ImportEmail(newDocument, file.OpenRead(), ObjectUtil.getMimeTypeFromFileName(file.Name), importOptions); return(email); }
/// <summary> /// Called by CreateTempDocs in order to create parent/child folders and randomly move documents to parent/child folders. /// </summary> /// <param name="tracker"></param> protected void MoveToFolders() { //WriteOutput("Getting the holding folder for documents prior to Parent/Child movement..."); Folder tempFolder = CurrentRepository.GetFolderByQualification("dm_folder where any r_folder_path = '" + tempPath + "'", new FeedGetOptions { Inline = true, Links = true }); WriteOutput("\tMoveing Documents from folder: " + tempFolder.GetPropertyValue("object_name")); foreach (DocumentTracker trackerDoc in Tracker) { String parentFolderId = trackerDoc.ParentId; String childId = trackerDoc.ChildId; //WriteOutput("Getting the Parent/Child movement folder..."); String movePath = ProcessBasePath + trackerDoc.getPath(); // Our parentFolder/child tracker for doing record declaration later addSupportingDoc(movePath); Folder destinationDir = CurrentRepository.GetOrCreateFolderByPath(movePath); Document docToCopy = CurrentRepository.GetSysObjectById <Document>(trackerDoc.DocumentId); // getDocumentByQualification("dm_document where r_object_id = '" //+ trackerDoc.DocumentId + "'", new FeedGetOptions { Inline = true, Links = true }); // To copy the document, we need to get a reference object CheckDuplicates(docToCopy, ProcessBasePath + trackerDoc.getPath()); Document copiedDoc = destinationDir.CreateSubObject <Document>(docToCopy.CreateCopyObject <Document>(), null); WriteOutput("\t[CopyDocument] - Moveed RestDocument: " + copiedDoc.GetPropertyValue("object_name") + " ID:" + trackerDoc.DocumentId + " to " + ProcessBasePath + trackerDoc.getPath()); // Update the trackerDocumentId to the newly copied document trackerDoc.DocumentId = copiedDoc.GetPropertyValue("r_object_id").ToString(); } // Delete our temp folder GenericOptions options = new GenericOptions(); options.SetQuery("del-non-empty", true); options.SetQuery("del-all-links", true); tempFolder.Delete(options); WriteOutput("[DeleteFolderAndContents] - Deleted the holding folder and documents"); }
public Func <Equipment, bool> ValidateItemClass(HashSet <string> itemClasses, GenericOptions genericOptions) { return((item) => { switch (genericOptions) { case (GenericOptions.Any): return itemClasses.Contains(item.ItemBase.ItemClass); case (GenericOptions.None): return !itemClasses.Contains(item.ItemBase.ItemClass); } throw new InvalidOperationException("Invalid matching item class validation"); }); }
/// <summary> /// /// </summary> /// <param name="genericOption"></param> private void DisplayGenericOptionForm(GenericOptions genericOption) { fGenericSelection oFormGS = new fGenericSelection(); List <CListBoxWrapper> allSelected; switch (genericOption) { case GenericOptions.ExecutionModel: allSelected = oFormGS.DisplayForm("Select Execution Model", typeof(IExecutionModel), _internalConfig.selectedExecutionModel, false); if (allSelected.Count > 0) { _internalConfig.selectedExecutionModel = allSelected[0]; } break; case GenericOptions.ExecutionTimeGenerator: allSelected = oFormGS.DisplayForm("Select Execution Time Generator", typeof(IExecutionTimeGenerator), _internalConfig.selectedExecutionTimeGenerator , false); if (allSelected.Count > 0) { _internalConfig.selectedExecutionTimeGenerator = allSelected[0]; } break; case GenericOptions.PeriodGenerator: allSelected = oFormGS.DisplayForm("Select Period Generator", typeof(IPeriodGenerator), _internalConfig.selectedPeriodGenerator, false); if (allSelected.Count > 0) { _internalConfig.selectedPeriodGenerator = allSelected[0]; } break; case GenericOptions.TaskSetGenerator: allSelected = oFormGS.DisplayForm("Select Task Set Generator", typeof(ITaskSetGenerator), _internalConfig.selectedTaskSetGenerator, false); if (allSelected.Count > 0) { _internalConfig.selectedTaskSetGenerator = allSelected[0]; } break; case GenericOptions.ReleaseOffsetGenerator: allSelected = oFormGS.DisplayForm("Select Release Offset Generator", typeof(IReleaseOffsetGenerator), _internalConfig.selectedReleaseOffsetGenerator, false); if (allSelected.Count > 0) { _internalConfig.selectedReleaseOffsetGenerator = allSelected[0]; } break; case GenericOptions.ExecutionTraceWriter: allSelected = oFormGS.DisplayForm("Select Execution Trace Writer", typeof(IDiscreteExecutionTraceWriter), _internalConfig.selectedExecutionTraceWriter, false); if (allSelected.Count > 0) { _internalConfig.selectedExecutionTraceWriter = allSelected[0]; } break; default: break; } }
public BaseCommand(GenericOptions genericOptions) : this() { Files = GetFiles(genericOptions.Folders, genericOptions.ExcludeFolders, genericOptions.Exts, genericOptions.ScopedFolders, genericOptions.Recursive).ToArray(); Stats.TotalFiles = Files.Length; Options = genericOptions; }
public SearchCommand(GenericOptions genericOptions) : base(genericOptions) { }
/// <summary> /// Delete the persistent object resource /// </summary> /// <param name="options"></param> public void Delete(GenericOptions options) { Client.Delete(SelfLink(), options == null ? null : options.ToQueryList()); }
/// <summary> /// /// </summary> /// <param name="repositoryUri"></param> /// <param name="newObj"></param> /// <param name="otherPartStream"></param> /// <param name="otherPartMime"></param> /// <param name="options"></param> /// <returns></returns> public EmailPackage ImportEmail(Document newObj, Stream otherPartStream, string otherPartMime, GenericOptions options) { Dictionary <Stream, string> otherParts = new Dictionary <Stream, string>(); otherParts.Add(otherPartStream, otherPartMime); options.SetQuery("folderId", this.GetPropertyValue("r_object_id")); Feed <Document> feed = Client.Post <Document, Feed <Document> >( Client.RepositoryBaseUri + LinkRelations.EMAILIMPORT, newObj, otherParts, options); return(ObjectUtil.getFeedAsEmailPackage(feed)); }
public D2Document ImportD2DocumentWithContent(D2Document newObj, Stream otherPartStream, string otherPartMime, GenericOptions options) { Dictionary <Stream, string> otherParts = new Dictionary <Stream, string>(); otherParts.Add(otherPartStream, otherPartMime); return(Client.Post <D2Document>( this.Links, LinkRelations.OBJECT_CREATION.Rel, newObj, otherParts, options)); }
/// <summary> /// Import a contentful document with content stream under this folder /// </summary> /// <param name="newObj"></param> /// <param name="otherPartStream"></param> /// <param name="otherPartMime"></param> /// <param name="options"></param> /// <returns>Returns RestDocument object</returns> public Document ImportDocumentWithContent(Document newObj, Stream otherPartStream, string otherPartMime, GenericOptions options) { Dictionary <Stream, string> otherParts = new Dictionary <Stream, string>(); otherParts.Add(otherPartStream, otherPartMime); return(Client.Post <Document>( GetFullLinks(), LinkRelations.DOCUMENTS.Rel, newObj, otherParts, options)); }
private void Temp() { if (CurrentRepository.isD2Rest()) { /* Get D2 Configs */ D2Configurations d2configs = CurrentRepository.GetD2Configurations(null); /* Get the Search Configurations from D2 Config */ SearchConfigurations searchConfigs = d2configs.getSearchConfigurations(); int i = 0; for (i = 0; i < searchConfigs.Entries.Count; i++) { /* For Each Search configuration, get the entry link */ SearchConfigLink scl = searchConfigs.Entries[i]; //Console.WriteLine("SearchConfigTitle=" + scl.title + ", SearchConfigId=" + scl.id + " LinkSrc: " + scl.content.Src); /* Ouput SearchConfiguration information for each SearchConfigLink */ SearchConfiguration sc = searchConfigs.getSearchConfiguration(scl.content.Src); //Console.WriteLine(sc.ToString()); } /* Get the Profile Configurations from D2 Config */ ProfileConfigurations profileConfigs = d2configs.getProfileConfigurations(); i = 0; // for (i=0; i < profileConfigs.Entries.Count; i++) //{ /* For each profile configuraton get the entry link */ ProfileConfigLink pcl = profileConfigs.Entries[i]; //Console.WriteLine("\n\nProfileConfigTitle=" + pcl.title + ", ProfileConfigId=" + pcl.id + " LinkSrc: " + pcl.content.Src); /* Output ProfileConfiguration information for each ProfileConfigLink */ ProfileConfiguration pc = profileConfigs.getProfileConfiguration(pcl.content.Src); //Console.WriteLine(pc.ToString()); D2Document d2doc = new D2Document(); d2doc.SetPropertyValue("object_name", "D2-ConfigTst-" + DateTime.Now.Ticks); d2doc.SetPropertyValue("primary_bus_owner", "Rest"); d2doc.SetPropertyValue("template_developers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("comm_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("business_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("compliance_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("brand_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("legal_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("ada_reviewers", new String[] { "dmadmin" }); d2doc.SetPropertyValue("template_admins", new String[] { "dmadmin" }); d2doc.SetPropertyValue("form_type", "ACT"); d2doc.SetPropertyValue("form_subtype", "Alternate Loan Notice"); d2doc.SetPropertyValue("document_subject", "Automatic payment"); d2doc.SetPropertyValue("requester", "dmadmin"); d2doc.SetPropertyValue("r_object_type", "wf_form_template"); d2doc.SetPropertyValue("r_is_virtual_doc", Convert.ToInt32(true)); d2doc.SetPropertyValue("import_archive", false); d2doc.SetPropertyValue("a_status", "Revise"); d2doc.SetPropertyValue("merge_needed", true); d2doc.SetPropertyValue("system_ver_available", true); D2Configuration d2config = new D2Configuration(); d2config.LifeCycle = "WF Template Lifecycle"; d2config.StartVersion = 0.5d; // This was an attempt to figure out what the properties_string/properties_xml properties that d2-config has. It was a fail // so will have to wait for documentation to update to reflect what these do. //d2config.PropertiesString = "title=BLAHBLAHBLAH"; d2doc.Configuration = d2config; GenericOptions importOptions = new GenericOptions(); importOptions.SetQuery("format", ObjectUtil.getDocumentumFormatForFile("RestDotNetFramework.docx")); d2doc = CurrentRepository.ImportD2DocumentWithContent(d2doc, new FileInfo(@"C:\SamplesToImport\RestDotNetFramework.docx") .OpenRead(), ObjectUtil.getMimeTypeFromFileName("RestDotNetFramework.docx"), importOptions); if (d2doc != null) { Console.WriteLine("\n\nNew D2Document: \n" + d2doc.ToString()); } else { Console.WriteLine("Creation failed!"); } Console.WriteLine("=================================================================================="); Console.WriteLine("TaskList Basic Info:"); Feed <D2Task> taskFeed = CurrentRepository.GetD2TaskList(); List <D2Task> tasks = ObjectUtil.getFeedAsList(taskFeed); int taskNum = 0; foreach (D2Task task in tasks) { taskNum++; Console.WriteLine("TASK #" + taskNum + "-------------------------------------------------"); Console.WriteLine("\tTaskSubject: " + task.TaskSubject + " TaskInstructions: " + task.TaskInstructions); Console.WriteLine("\tForward Tasks: "); foreach (String key in task.TaskRequirements.ForwardTasks.Keys) { Console.WriteLine("\t\t" + "TaskName: " + key + " TaskId" + task.TaskRequirements.ForwardTasks[key]); } } Console.ReadLine(); } }