public DataObject AddChildNodes(DataObject parentObject, ObjectIdentitySet childIdentities) { List<ObjectIdentity> idList = childIdentities.Identities; List<VdmChildrenActionInfo> caInfoList = new List<VdmChildrenActionInfo>(); foreach (ObjectIdentity objIdentity in idList) { VirtualDocumentNode vdmNode = new VirtualDocumentNode(); vdmNode.Identity = objIdentity; VirtualDocumentInfo vdmInfo = new VirtualDocumentInfo(); vdmInfo.Binding = VirtualDocumentInfo.BINDING_LATE; vdmInfo.CopyBehavior = CopyBehaviorMode.COPY; vdmInfo.OverrideLateBinding = false; vdmNode.Policy = vdmInfo; VdmChildrenActionInfo caInfo = new VdmChildrenActionInfo(); caInfo.Action = VdmChildrenAction.APPEND; caInfo.Node = vdmNode; caInfoList.Add(caInfo); } VdmUpdateProfile vdmUpdateProfile = new VdmUpdateProfile(); List<String> versionLabels = new List<String>(); versionLabels.Add("testVersionLabel"); // make sure to add the CURRENT label if you // want the virtual document to be CURRENT versionLabels.Add("CURRENT"); vdmUpdateProfile.Labels = versionLabels; OperationOptions options = new OperationOptions(); options.VdmUpdateProfile = vdmUpdateProfile; return virtualDocumentService.Update(parentObject, caInfoList, options); }
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 static IList <ConnectorObject> SearchToList(SearchApiOp search, ObjectClass oclass, Filter filter, OperationOptions options) { ToListResultsHandler handler = new ToListResultsHandler(); search.Search(oclass, filter, handler.ResultsHandler, options); return(handler.Objects); }
public MoveFileOperation( IFileTask man, OperationOptions options) { _man = NamedNullException.Assert(man, nameof(man)); NamedNullException.Assert(options, nameof(options)); NotTrueException.Assert(options.DoMove, nameof(options.DoMove)); StringNullOrEmptyException.Assert(options.MovePath, nameof(options.MovePath)); _options = options; }
/// <inheritdoc/> public Task DeleteAsync <T>(IDocumentInfo <T> item, CancellationToken ct, OperationOptions options) { if (item == null) { throw new ArgumentNullException(nameof(item)); } return(DeleteAsync(item.Id, ct, new OperationOptions { PartitionKey = item.PartitionKey }, item.Etag)); }
/// <summary> /// Performs a raw, unfiltered search at the SPI level, /// eliminating duplicates from the result set. /// </summary> /// <param name="search">The search SPI</param> /// <param name="oclass">The object class - passed through to /// connector so it may be null if the connecor /// allowing it to be null. (This is convenient for /// unit tests, but will not be the case in general)</param> /// <param name="filter">The filter to search on</param> /// <param name="options">The options - may be null - will /// be cast to an empty OperationOptions</param> /// <returns>The list of results.</returns> public static IList <ConnectorObject> SearchToList <T>(SearchOp <T> search, ObjectClass oclass, Filter filter, OperationOptions options) where T : class { ToListResultsHandler handler = new ToListResultsHandler(); Search(search, oclass, filter, handler.ResultsHandler, options); return(handler.Objects); }
public DataObject GetCurrentDemo(ObjectIdentity objIdentity) { ObjectIdentitySet objIdSet = new ObjectIdentitySet(); objIdSet.Identities.Add(objIdentity); OperationOptions operationOptions = null; DataPackage resultDataPackage = versionControlService.GetCurrent(objIdSet, operationOptions); return(resultDataPackage.DataObjects[0]); }
/// <summary> /// Implementation of SearchOp.ExecuteQuery /// </summary> /// <param name="oclass">Object class</param> /// <param name="query">Query to execute</param> /// <param name="handler">Results handler</param> /// <param name="options">Operation options</param> public override void ExecuteQuery( ObjectClass oclass, string query, ResultsHandler handler, OperationOptions options) { ExchangeUtility.NullCheck(oclass, "oclass", this.configuration); // we handle accounts only if (!oclass.Is(ObjectClass.ACCOUNT_NAME)) { base.ExecuteQuery(oclass, query, handler, options); return; } ICollection <string> attsToGet = null; if (options != null && options.AttributesToGet != null) { attsToGet = CollectionUtil.NewList(options.AttributesToGet); } // delegate to get the exchange attributes if requested ResultsHandler filter = delegate(ConnectorObject cobject) { ConnectorObject filtered = ExchangeUtility.ReplaceAttributes( cobject, attsToGet, AttMapFromAD); filtered = this.AddExchangeAttributes(oclass, filtered, attsToGet); return(handler(filtered)); }; ResultsHandler handler2use = handler; OperationOptions options2use = options; if (options != null && options.AttributesToGet != null) { if (attsToGet.Contains(AttDatabase) || attsToGet.Contains(AttExternalMail) || attsToGet.Contains(AttRecipientType)) { // replace Exchange attributes with AD names var newAttsToGet = ExchangeUtility.FilterReplace(attsToGet, AttMap2AD); // we have to remove recipient type, as it is unknown to AD newAttsToGet.Remove(AttRecipientType); // build new op options var builder = new OperationOptionsBuilder(options); string[] attributesToGet = new string[newAttsToGet.Count]; newAttsToGet.CopyTo(attributesToGet, 0); builder.AttributesToGet = attributesToGet; options2use = builder.Build(); handler2use = filter; } } base.ExecuteQuery(oclass, query, handler2use, options2use); }
/// <inheritdoc/> public Task <IDocumentInfo <T> > FindAsync <T>(string id, CancellationToken ct, OperationOptions options) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(nameof(id)); } lock (_data) { _data.TryGetValue(id, out var item); return(Task.FromResult(item as IDocumentInfo <T>)); } }
public virtual Uid ResolveUsername(ObjectClass objectClass, string userName, OperationOptions options) { if (ObjectClass.ACCOUNT.Equals(objectClass)) { return(new Uid(userName)); } Trace.TraceWarning("ResolveUsername of type {0} is not supported", _configuration.ConnectorMessages.Format(objectClass.GetDisplayNameKey(), objectClass.GetObjectClassValue())); throw new NotSupportedException("ResolveUsername of type" + objectClass.GetObjectClassValue() + " is not supported"); }
public static void startLogic(String repository, String userName, String password) { IServiceContext context = createContext(repository, userName, password); //comment block 'new service' Console.Out.WriteLine("Creating new IObjectService instance..."); //create a service factory and instatiate the IObjectService ServiceFactory sf = ServiceFactory.Instance; IObjectService objectService = sf.GetRemoteService <IObjectService>(context); //comment block 'build' Console.Out.WriteLine("Creating new ObjectIdentiy instance..."); //build object identity ObjectIdentity docIdent = new ObjectIdentity(); docIdent.RepositoryName = repository; Console.Out.WriteLine("Creating new DataObject instance..."); //build data object, seed with object identity DataObject dataObj = new DataObject(docIdent, "dm_document"); Console.Out.WriteLine("Creating new PropertySet instance..."); //build property set String objName = "lab03_test"; PropertySet propertySet = new PropertySet(); propertySet.Set("object_name", objName); //seed data object with property set dataObj.Properties = propertySet; Console.Out.WriteLine("Creating new DataPackage instance..."); //build data package, seed with data object DataPackage dataPack = new DataPackage(dataObj); Console.Out.WriteLine("Calling the IObjectService.create() method..."); OperationOptions options = null; //call the create method objectService.Create(dataPack, options); Console.Out.WriteLine("A new object called '" + objName + "' has been created..."); }
public void TestConnectionPooling() { ConnectorPoolManager.Dispose(); ConnectorInfoManager manager = GetConnectorInfoManager(); ConnectorInfo info1 = FindConnectorInfo(manager, "1.0.0.0", "org.identityconnectors.testconnector.TstConnector"); Assert.IsNotNull(info1); //reset connection count { //trigger TstConnection.init to be called APIConfiguration config2 = info1.CreateDefaultAPIConfiguration(); config2.ConfigurationProperties.GetProperty("resetConnectionCount").Value = (true); ConnectorFacade facade2 = ConnectorFacadeFactory.GetInstance().NewInstance(config2); facade2.Schema(); //force instantiation } APIConfiguration config = info1.CreateDefaultAPIConfiguration(); config.ConnectorPoolConfiguration.MinIdle = (0); config.ConnectorPoolConfiguration.MaxIdle = (0); ConnectorFacade facade1 = ConnectorFacadeFactory.GetInstance().NewInstance(config); OperationOptionsBuilder builder = new OperationOptionsBuilder(); builder.SetOption("testPooling", "true"); OperationOptions options = builder.Build(); ICollection <ConnectorAttribute> attrs = CollectionUtil.NewReadOnlySet <ConnectorAttribute>(); Assert.AreEqual("1", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("2", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("3", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("4", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); config = info1.CreateDefaultAPIConfiguration(); config.ConnectorPoolConfiguration.MinIdle = (1); config.ConnectorPoolConfiguration.MaxIdle = (2); facade1 = ConnectorFacadeFactory.GetInstance().NewInstance(config); Assert.AreEqual("5", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("5", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("5", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); Assert.AreEqual("5", facade1.Create(ObjectClass.ACCOUNT, attrs, options).GetUidValue()); }
//public IEnumerable<DocumentModel> SimplePassthroughQueryDocumentWithPath(string filename, string subject) //{ // List<DocumentModel> documentModels = new List<DocumentModel>(); // QueryResult queryResult; // try // { // string queryString = "select dm_document.r_object_id, dm_document.subject, dm_document.a_content_type,dm_document.object_name,dm_format.dos_extension from dm_document,dm_format where dm_document.a_content_type = dm_format.name"; // if ((!String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%' and upper(subject) like '%" + subject.ToUpper() + "%'"; // } // if ((!String.IsNullOrEmpty(filename)) && (String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(object_name) like '%" + filename.ToUpper() + "%'"; // } // if ((String.IsNullOrEmpty(filename)) && (!String.IsNullOrEmpty(subject))) // { // queryString = queryString + " and upper(subject) like '%" + subject.ToUpper() + "%'"; // } // int startingIndex = 0; // int maxResults = 60; // int maxResultsPerSource = 20; // PassthroughQuery q = new PassthroughQuery(); // q.QueryString = queryString; // q.AddRepository(DefaultRepository); // QueryExecution queryExec = new QueryExecution(startingIndex, // maxResults, // maxResultsPerSource); // queryExec.CacheStrategyType = CacheStrategyType.NO_CACHE_STRATEGY; // queryResult = searchService.Execute(q, queryExec, null); // QueryStatus queryStatus = queryResult.QueryStatus; // RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; // if (repStatusInfo.Status == Status.FAILURE) // { // // Console.WriteLine(repStatusInfo.ErrorTrace); // documentModels.Add(new DocumentModel() { ObjectId = "0", ObjectName = repStatusInfo.ErrorMessage, Subject = repStatusInfo.ErrorTrace }); // } // //Console.WriteLine("Query returned result successfully."); // DataPackage dp = queryResult.DataPackage; // //Console.WriteLine("DataPackage contains " + dp.DataObjects.Count + " objects."); // foreach (DataObject dObj in dp.DataObjects) // { // PropertySet docProperties = dObj.Properties; // String objectId = dObj.Identity.GetValueAsString(); // String docName = docProperties.Get("object_name").GetValueAsString(); // String Extension = docProperties.Get("dos_extension").GetValueAsString(); // string repName = dObj.Identity.RepositoryName; // string docsubject = docProperties.Get("subject").GetValueAsString(); // //Console.WriteLine("RepositoryName: " + repName + " ,Document: " + objectId + " ,Name:" + docName + " ,Subject:" + docsubject); // documentModels.Add(new DocumentModel() { ObjectId = objectId, ObjectName = docName+"."+Extension , Subject = docsubject }); // } // } // catch (Exception ex) // { // documentModels.Add(new DocumentModel() { ObjectId = "1", ObjectName = "SampleFile.txt", Subject = "This is a Sample" }); // } // return documentModels; //} public void SimpleStructuredQuery(String docName) { String repoName = DefaultRepository; Console.WriteLine("Called SimpleStructuredQuery - " + DefaultRepository); PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.IMPLIED; OperationOptions operationOptions = new OperationOptions(); operationOptions.Profiles.Add(propertyProfile); // Create query StructuredQuery q = new StructuredQuery(); q.AddRepository(repoName); q.ObjectType = "dm_document"; q.IsIncludeHidden = true; q.IsDatabaseSearch = true; ExpressionSet expressionSet = new ExpressionSet(); expressionSet.AddExpression(new PropertyExpression("object_name", Condition.CONTAINS, docName)); q.RootExpressionSet = expressionSet; // Execute Query int startingIndex = 0; int maxResults = 60; int maxResultsPerSource = 20; QueryExecution queryExec = new QueryExecution(startingIndex, maxResults, maxResultsPerSource); QueryResult queryResult = searchService.Execute(q, queryExec, operationOptions); QueryStatus queryStatus = queryResult.QueryStatus; RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Console.WriteLine(repStatusInfo.ErrorTrace); throw new Exception("Query failed to return result."); } Console.WriteLine("Query returned result successfully."); // print results Console.WriteLine("DataPackage contains " + queryResult.DataObjects.Count + " objects."); foreach (DataObject dataObject in queryResult.DataObjects) { Console.WriteLine(dataObject.Identity.GetValueAsString()); } }
public void VersionSampleObjects() { Console.WriteLine("Creating versions of sample data for VersionControlService samples."); ServiceFactory serviceFactory = ServiceFactory.Instance; IVersionControlService versionSvc = serviceFactory.GetRemoteService <IVersionControlService>(serviceDemo.DemoServiceContext); ObjectIdentitySet objIdSet = new ObjectIdentitySet(); ObjectIdentity docObjId = new ObjectIdentity(); docObjId.RepositoryName = serviceDemo.DefaultRepository; docObjId.Value = new ObjectPath(gifImageObjPath); ObjectIdentity doc1ObjId = new ObjectIdentity(); doc1ObjId.RepositoryName = serviceDemo.DefaultRepository; doc1ObjId.Value = new ObjectPath(gifImage1ObjPath); objIdSet.AddIdentity(docObjId); objIdSet.AddIdentity(doc1ObjId); OperationOptions operationOptions = new OperationOptions(); ContentProfile contentProfile = new ContentProfile(FormatFilter.ANY, null, PageFilter.ANY, -1, PageModifierFilter.ANY, null); operationOptions.ContentProfile = contentProfile; DataPackage checkinPackage = versionSvc.Checkout(objIdSet, operationOptions); Console.WriteLine("Checked out sample objects."); for (int i = 0; i <= 1; i++) { DataObject checkinObj = checkinPackage.DataObjects[i]; checkinObj.Contents = null; FileContent newContent = new FileContent(); newContent.LocalPath = gifImageFilePath; newContent.RenditionType = RenditionType.PRIMARY; newContent.Format = "gif"; checkinObj.Contents.Add(newContent); } bool retainLock = false; List <String> labels = new List <String>(); labels.Add("test_version"); versionSvc.Checkin(checkinPackage, VersionStrategy.NEXT_MINOR, retainLock, labels, operationOptions); Console.WriteLine("Checked in sample object with label 'test_version'"); }
public DataObject GetObjectWithDefaults(ObjectIdentity objIdentity) { objIdentity.RepositoryName = DefaultRepository; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List <ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objIdentity); OperationOptions operationOptions = null; DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return(dataPackage.DataObjects[0]); }
public DataObject GetObjectFilterProperties(ObjectIdentity objIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; OperationOptions operationOptions = new OperationOptions(); operationOptions.PropertyProfile = propertyProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return(dataPackage.DataObjects[0]); }
/// <summary> /// Performs a raw, unfiltered search at the SPI level, /// eliminating duplicates from the result set. /// </summary> /// <param name="search">The search SPI</param> /// <param name="oclass">The object class - passed through to /// connector so it may be null if the connecor /// allowing it to be null. (This is convenient for /// unit tests, but will not be the case in general)</param> /// <param name="filter">The filter to search on</param> /// <param name="handler">The result handler</param> /// <param name="options">The options - may be null - will /// be cast to an empty OperationOptions</param> public void Search <T>(SearchOp <T> search, ObjectClass oclass, Filter filter, ResultsHandler handler, OperationOptions options) where T : class { if (options == null) { options = new OperationOptionsBuilder().Build(); } RawSearcherImpl <T> .RawSearch( search, oclass, filter, handler, options); }
public void ExecuteQuery(ObjectClass oclass, string query, ResultsHandler handler, OperationOptions options) { Assert.IsNotNull(oclass); Assert.IsNotNull(handler); Assert.IsNotNull(options); AddCall("ExecuteQuery", oclass, query, handler, options); if (null != options.PageSize && options.PageSize > 0) { // This is a pages search request ((SearchResultsHandler)handler).HandleResult(new SearchResult("TOKEN==", 100)); } }
public BackupOperation( string groupName, IFileTask man, OperationOptions options) { _backupDirLinks = StringNullOrEmptyException.Assert(groupName, nameof(groupName)); _man = NamedNullException.Assert(man, nameof(man)); NamedNullException.Assert(options, nameof(options)); NotTrueException.Assert(options.DoBackup, nameof(options.DoBackup)); StringNullOrEmptyException.Assert(options.BackupPath, nameof(options.BackupPath)); _options = options; }
public void TestOperationOptions() { OperationOptionsBuilder builder = new OperationOptionsBuilder(); builder.SetOption("foo", "bar"); builder.SetOption("foo2", "bar2"); OperationOptions v1 = builder.Build(); OperationOptions v2 = (OperationOptions)CloneObject(v1); Assert.AreEqual(2, v2.Options.Count); Assert.AreEqual("bar", v2.Options["foo"]); Assert.AreEqual("bar2", v2.Options["foo2"]); }
/// <summary> /// Get item /// </summary> /// <typeparam name="T"></typeparam> /// <param name="id"></param> /// <param name="value"></param> /// <param name="options"></param> /// <returns></returns> private static dynamic GetItem <T>(string id, T value, OperationOptions options) { var token = JObject.FromObject(value); if (options?.PartitionKey != null) { token.AddOrUpdate(PartitionKeyProperty, options.PartitionKey); } if (id != null) { token.AddOrUpdate(IdProperty, id); } return(token); }
/// <summary> /// Elimina un utente in amministrazione /// </summary> /// <param name="utente"></param> /// <returns></returns> public EsitoOperazione EliminaUtenteAmm(OrgUtente utente) { EsitoOperazione ret = new EsitoOperazione(); string logMsg; IObjectService objSrvc = null; String repositoryName = DctmConfigurations.GetRepositoryName(); // test sui campi obbligatori if (string.IsNullOrEmpty(utente.UserId)) { logMsg = ERR_HEADER + "EliminaUtente: dati insufficienti"; ret.Codice = -1; ret.Descrizione = logMsg; logger.Debug(logMsg); return(ret); } try { // verifica se esistono più di un'occorrenza per utente if (CountGroupsByUser(utente.UserId) > 1) { // rimuove l'utente dal gruppo di root EliminaUtenteDaRuoloAmm(utente.UserId, utente.IDAmministrazione); } else { ObjectIdentitySet identitySet = new ObjectIdentitySet(); objSrvc = this.GetObjectServiceInstance(); ObjectIdentity userIdentity = Dfs4DocsPa.getUserIdentityByName(TypeUtente.getUserName(utente)); // Cancellazione dell'home cabinet per l'utente identitySet.AddIdentity(Dfs4DocsPa.getUserHomeFolderIdentity(utente.UserId)); identitySet.AddIdentity(userIdentity); OperationOptions opts = new OperationOptions(); opts.DeleteProfile = new DeleteProfile(); opts.DeleteProfile.IsPopulateWithReferences = true; objSrvc.Delete(identitySet, opts); logger.Debug(DEBUG_HEADER + "EliminaUtente completata con SUCCESSO"); } return(ret); } catch (Exception ex) { String st = ex.ToString(); logger.Debug(DEBUG_HEADER + "EliminaUtente FALLITA, Exception=" + st); ret.Codice = -1; ret.Descrizione = ERR_HEADER + "EliminaUtente"; return(ret); } }
protected Object ExecuteAuthenticate(String scriptName, ObjectClass objectClass, String username, GuardedString password, OperationOptions options) { var result = new MsPowerShellUidHandler(); var arguments = new Dictionary <String, Object> { { Result, result }, { Username, username }, { Password, SecurityUtil.Decrypt(password) } }; ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.AUTHENTICATE, objectClass, null, null, options)); return(result.Uid); }
public DataPackage CreateContentlessDocument() { ObjectIdentity objectIdentity = new ObjectIdentity(DefaultRepository); DataObject dataObject = new DataObject(objectIdentity, "dm_document"); PropertySet properties = new PropertySet(); properties.Set("object_name", "contentless-" + System.DateTime.Now.Ticks); dataObject.Properties = properties; DataPackage dataPackage = new DataPackage(dataObject); OperationOptions operationOptions = null; return(objectService.Create(dataPackage, operationOptions)); }
public FtpTransferOperation( OperationOptions oo, ILoggerFactory loggerFactory) { _options = NamedNullException.Assert(oo, nameof(oo)); var fo = _options.Ftp; NamedNullException.Assert(fo, nameof(fo)); _timeout = fo.Timeout.HasValue ? fo.Timeout.Value : FtpOptions.MaxFtpTimeout; _ftpClient = new SimpleFtpClient(fo.FtpRoot, fo.UserName, fo.Password, _timeout); _logger = NamedNullException.Assert(loggerFactory, nameof(loggerFactory)).CreateLogger <FtpTransferOperation>(); _timeoutPolicy = Policy.TimeoutAsync(TimeSpan.FromMilliseconds(_timeout), TimeoutStrategy.Pessimistic); }
/// <summary> /// Implementation of SynOp.Sync /// </summary> /// <param name="objClass">Object class</param> /// <param name="token">Sync token</param> /// <param name="handler">Sync results handler</param> /// <param name="options">Operation options</param> public override void Sync( ObjectClass objClass, SyncToken token, SyncResultsHandler handler, OperationOptions options) { ExchangeUtility.NullCheck(objClass, "oclass", this.configuration); // we handle accounts only if (!objClass.Is(ObjectClass.ACCOUNT_NAME)) { base.Sync(objClass, token, handler, options); return; } ICollection <string> attsToGet = null; if (options != null && options.AttributesToGet != null) { attsToGet = CollectionUtil.NewSet(options.AttributesToGet); } // delegate to get the exchange attributes if requested SyncResultsHandler xchangeHandler = delegate(SyncDelta delta) { if (delta.DeltaType == SyncDeltaType.DELETE) { return(handler(delta)); } // replace the ad attributes with exchange one and add recipient type ConnectorObject updated = ExchangeUtility.ReplaceAttributes(delta.Object, attsToGet, AttMapFromAD); updated = this.AddExchangeAttributes(objClass, updated, attsToGet); if (updated != delta.Object) { // build new sync delta, cause we changed the object SyncDeltaBuilder deltaBuilder = new SyncDeltaBuilder { DeltaType = delta.DeltaType, Token = delta.Token, Uid = delta.Uid, Object = updated }; delta = deltaBuilder.Build(); } return(handler(delta)); }; // call AD sync, use xchangeHandler base.Sync(objClass, token, xchangeHandler, options); }
public PropertyInfo PropertyInfoDemo() { OperationOptions operationOptions = null; PropertyInfo propertyInfo = schemaService.GetPropertyInfo(DefaultRepository, null, "dm_document", "subject", operationOptions); Console.WriteLine("Getting property info for property 'subject' of dm_document."); Console.WriteLine("Name: " + propertyInfo.Name); Console.WriteLine("Label: " + propertyInfo.Label); Console.WriteLine("Description: " + propertyInfo.Description); return propertyInfo; }
protected void ExecuteSync(String scriptName, ObjectClass objectClass, SyncToken token, SyncResultsHandler handler, OperationOptions options) { var arguments = new Dictionary <String, Object> { { Result, new MsPowerShellSyncResults(objectClass, handler) } }; if (token != null) { arguments.Add(Token, token.Value); } ExecuteScript(GetScript(scriptName), CreateBinding(arguments, OperationType.SYNC, objectClass, null, null, options)); }
public virtual void Delete(ObjectClass objectClass, Uid uid, OperationOptions options) { if (ObjectClass.ACCOUNT.Equals(objectClass) || ObjectClass.GROUP.Equals(objectClass)) { // do real delete here } else { Trace.TraceWarning("Delete of type {0} is not supported", _configuration.ConnectorMessages.Format(objectClass.GetDisplayNameKey(), objectClass.GetObjectClassValue())); throw new NotSupportedException("Delete of type" + objectClass.GetObjectClassValue() + " is not supported"); } }
/// <summary> /// Convert to request options /// </summary> /// <param name="options"></param> /// <param name="partitioned"></param> /// <param name="etag"></param> /// <returns></returns> public static RequestOptions ToRequestOptions(this OperationOptions options, bool partitioned = true, string etag = null) { var pk = !partitioned || string.IsNullOrEmpty(options?.PartitionKey) ? null : new PartitionKey(options?.PartitionKey); var ac = string.IsNullOrEmpty(etag) ? null : new AccessCondition { Condition = etag, Type = AccessConditionType.IfMatch }; return(new RequestOptions { AccessCondition = ac, PartitionKey = pk, ConsistencyLevel = options?.Consistency.ToConsistencyLevel() }); }
protected Object ExecuteScriptOnConnector(ScriptContext request, OperationOptions options) { var reqArguments = new Dictionary <String, Object>(); foreach (var entry in request.ScriptArguments) { reqArguments.Add(entry.Key, entry.Value); } var arguments = new Dictionary <String, Object> { { ScriptArguments, reqArguments } }; return(ExecuteScript(request.ScriptText, CreateBinding(arguments, OperationType.RUNSCRIPTONCONNECTOR, null, null, null, options))); }
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 SimpleStructuredQuery(String docName) { String repoName = DefaultRepository; PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.IMPLIED; OperationOptions operationOptions = new OperationOptions(); operationOptions.Profiles.Add(propertyProfile); // Create query StructuredQuery q = new StructuredQuery(); q.AddRepository(repoName); q.ObjectType = "dm_document"; q.IsIncludeHidden = true; q.IsDatabaseSearch = true; ExpressionSet expressionSet = new ExpressionSet(); expressionSet.AddExpression(new PropertyExpression("object_name", Condition.CONTAINS, docName)); q.RootExpressionSet = expressionSet; // Execute Query int startingIndex = 0; int maxResults = 60; int maxResultsPerSource = 20; QueryExecution queryExec = new QueryExecution(startingIndex, maxResults, maxResultsPerSource); QueryResult queryResult = searchService.Execute(q, queryExec, operationOptions); QueryStatus queryStatus = queryResult.QueryStatus; RepositoryStatusInfo repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Console.WriteLine(repStatusInfo.ErrorTrace); throw new Exception("Query failed to return result."); } Console.WriteLine("Query returned result successfully."); // print results Console.WriteLine("DataPackage contains " + queryResult.DataObjects.Count + " objects."); foreach (DataObject dataObject in queryResult.DataObjects) { Console.WriteLine(dataObject.Identity.GetValueAsString()); } }
public static IMatrixOperations GetOperation(OperationOptions operation) { switch (operation) { case OperationOptions.Add: return new Add(); case OperationOptions.Substraction: return new Substraction(); case OperationOptions.Multiplication: return new Multiplication(); case OperationOptions.Division: return null; default: break; } return null; }
public RepositoryInfo RepositoryInfoDemo() { OperationOptions operationOptions = new OperationOptions(); RepositoryInfo repositoryInfo = schemaService.GetRepositoryInfo(DefaultRepository, operationOptions); Console.WriteLine(repositoryInfo.Name); Console.WriteLine("Default schema name: " + repositoryInfo.DefaultSchemaName); Console.WriteLine("Label: " + repositoryInfo.Label); Console.WriteLine("Description: " + repositoryInfo.Description); Console.WriteLine("Schema names:"); List<String> schemaList = repositoryInfo.SchemaNames; foreach (String schemaName in schemaList) { Console.WriteLine(schemaName); } return repositoryInfo; }
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); }
private OperationOptions GetOperationOptionsForRetrievingContent() { var contentProfile = new ContentProfile { FormatFilter = FormatFilter.ANY, UrlReturnPolicy = UrlReturnPolicy.PREFER }; var operationOptions = new OperationOptions { ContentProfile = contentProfile }; operationOptions.SetProfile(contentProfile); return operationOptions; }
public void VersionSampleObjects() { Console.WriteLine("Creating versions of sample data for VersionControlService samples."); ServiceFactory serviceFactory = ServiceFactory.Instance; IVersionControlService versionSvc = serviceFactory.GetRemoteService<IVersionControlService>(serviceDemo.DemoServiceContext); ObjectIdentitySet objIdSet = new ObjectIdentitySet(); ObjectIdentity docObjId = new ObjectIdentity(); docObjId.RepositoryName = serviceDemo.DefaultRepository; docObjId.Value = new ObjectPath(gifImageObjPath); ObjectIdentity doc1ObjId = new ObjectIdentity(); doc1ObjId.RepositoryName = serviceDemo.DefaultRepository; doc1ObjId.Value = new ObjectPath(gifImage1ObjPath); objIdSet.AddIdentity(docObjId); objIdSet.AddIdentity(doc1ObjId); OperationOptions operationOptions = new OperationOptions(); ContentProfile contentProfile = new ContentProfile(FormatFilter.ANY, null, PageFilter.ANY, -1, PageModifierFilter.ANY, null); operationOptions.ContentProfile = contentProfile; DataPackage checkinPackage = versionSvc.Checkout(objIdSet, operationOptions); Console.WriteLine("Checked out sample objects."); for (int i = 0; i <= 1; i++) { DataObject checkinObj = checkinPackage.DataObjects[i]; checkinObj.Contents = null; FileContent newContent = new FileContent(); newContent.LocalPath = gifImageFilePath; newContent.RenditionType = RenditionType.PRIMARY; newContent.Format = "gif"; checkinObj.Contents.Add(newContent); } bool retainLock = false; List<String> labels = new List<String>(); labels.Add("test_version"); versionSvc.Checkin(checkinPackage, VersionStrategy.NEXT_MINOR, retainLock, labels, operationOptions); Console.WriteLine("Checked in sample object with label 'test_version'"); }
public void ValueInfoDemo() { SchemaProfile schemaProfile = new SchemaProfile(); schemaProfile.IncludeValues = true; OperationOptions operationOptions = new OperationOptions(); operationOptions.SchemaProfile = schemaProfile; Console.WriteLine("Printing value info:"); ValueAssist valueAssist = schemaService.GetDynamicAssistValues(DefaultRepository, null, "dm_document", "subject", null, operationOptions); if (valueAssist == null) { Console.WriteLine("valueAssist is null."); return; } foreach (String value in valueAssist.Values) { Console.WriteLine(" " + value); } }
public DataObject GetWithContent(ObjectIdentity objectIdentity, String geoLoc, ContentTransferMode transferMode) { ContentTransferProfile transferProfile = new ContentTransferProfile(); transferProfile.Geolocation = geoLoc; transferProfile.TransferMode = transferMode; DemoServiceContext.SetProfile(transferProfile); ContentProfile contentProfile = new ContentProfile(); contentProfile.FormatFilter = FormatFilter.ANY; contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER; OperationOptions operationOptions = new OperationOptions(); operationOptions.ContentProfile = contentProfile; operationOptions.SetProfile(contentProfile); ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List<ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage 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("Got content as file " + fileInfo.FullName); } else if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UcfContent")) { UcfContent ucfContent = (UcfContent)resultContent; Console.WriteLine("Got content as file " + ucfContent.LocalFilePath); } return dataObject; }
/* * Deletes all objects in createdObjectIdentities * This is intended for cleanup after completed test * */ public void DeleteCreatedObjects() { if (!isDataCleanedUp) { Console.WriteLine("Data created during test will not be deleted because SampleContentManager.isDataCleanedUp = false"); return; } if (createdObjectIdentities == null) { return; } try { DeleteProfile deleteProfile = new DeleteProfile(); deleteProfile.IsDeepDeleteFolders = true; deleteProfile.IsDeepDeleteChildrenInFolders = true; OperationOptions operationOptions = new OperationOptions(); operationOptions.DeleteProfile = deleteProfile; objectService.Delete(createdObjectIdentities, operationOptions); Console.WriteLine("Cleaned up the following sample data in repository (including all folder descendants):"); foreach (ObjectIdentity id in createdObjectIdentities.Identities) { Console.WriteLine(id.GetValueAsString()); } createdObjectIdentities.Identities.Clear(); } 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); } }
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 void ObjServiceDelete(String path) { ObjectPath docPath = new ObjectPath(path); ObjectIdentity objIdentity = new ObjectIdentity(); objIdentity.Value = docPath; objIdentity.RepositoryName = DefaultRepository; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity); DeleteProfile deleteProfile = new DeleteProfile(); deleteProfile.IsDeepDeleteFolders = true; deleteProfile.IsDeepDeleteChildrenInFolders = true; OperationOptions operationOptions = new OperationOptions(); operationOptions.DeleteProfile = deleteProfile; objectService.Delete(objectIdSet, 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 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 UpdateObjectProperties(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; OperationOptions operationOptions = new OperationOptions(); operationOptions.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); 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 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 DataPackage CreateFolderAndLinkedDoc() { // create a folder data object String folderName = "a-test-folder-" + System.DateTime.Now.Ticks; DataObject folderDataObj = new DataObject(new ObjectIdentity(DefaultRepository), "dm_folder"); PropertySet folderDataObjProperties = new PropertySet(); folderDataObjProperties.Set("object_name", folderName); folderDataObj.Properties = folderDataObjProperties; // create a contentless document DataObject String doc1Name = "a-test-doc-" + System.DateTime.Now.Ticks; DataObject docDataObj = new DataObject(new ObjectIdentity(DefaultRepository), "dm_document"); PropertySet properties = new PropertySet(); properties.Set("object_name", doc1Name); docDataObj.Properties = properties; // add the folder as a parent of the folder ObjectRelationship objRelationship = new ObjectRelationship(); objRelationship.Target = folderDataObj; objRelationship.Name = Relationship.RELATIONSHIP_FOLDER; objRelationship.TargetRole = Relationship.ROLE_PARENT; docDataObj.Relationships.Add(new ObjectRelationship(objRelationship)); // set up the relationship filter to return the doc and folder RelationshipProfile relationProfile = new RelationshipProfile(); relationProfile.ResultDataMode = ResultDataMode.REFERENCE; relationProfile.TargetRoleFilter = TargetRoleFilter.ANY; relationProfile.NameFilter = RelationshipNameFilter.ANY; relationProfile.DepthFilter = DepthFilter.SPECIFIED; relationProfile.Depth = 2; OperationOptions operationOptions = new OperationOptions(); operationOptions.RelationshipProfile = relationProfile; // create the folder and linked document DataPackage dataPackage = new DataPackage(); dataPackage.AddDataObject(docDataObj); return objectService.Create(dataPackage, operationOptions); }
private object RunConnector(OperationOptions options, CancelationToken cancelationToken) { ClearErrors(); try { string text = sourceText.Text; BasicConnector connector = (new RuntimeCompiler()).CreateInstance<BasicConnector>(connectorDefinition.Text); var selector = options.IsDetailsPage ? connector.CreateDetailsSelector() : connector.CreateSelector(); var model = new MatchListViewModel(); model.Items = new ObservableCollection<MatchItemViewModel>( selector.Match(text).SelectMany(m => FlatMatch(m)) .Select(m => new MatchItemViewModel(m))); resultView.DataContext = model; if (options.FillEntity) { if (options.IsDetailsPage) { foreach (var match in selector.Match(text)) { connector.FillDetails(new AdRealty()); } } else { var ads = new List<Ad>(); foreach (var match in selector.Match(text)) { ads.Add(connector.CreateAd(match)); } } } } catch (Exception ex) { AddError(ex.Message); AddError(ex.StackTrace); if (options.ThrowError) { throw; } } return null; }
private DataPackage GetSingle(ObjectIdentitySet objectIdSet, OperationOptions operationOptions) { try { return dfsContext.ObjectService.Get(objectIdSet, operationOptions); } catch (FaultException<SerializableException> ex) { if (ex.Message.Contains("There is no object in repository with id")) { throw new InvalidOperationException("No matching objects found.", ex); } if (ex.Message.Contains("multiple objects qualify")) { throw new InvalidOperationException("Found more than one matching object", ex); } throw; } }
public IList<DataObject> FindDataObjects(string objectType, List<PropertyExpression> searchCriteria, bool getContent) { Log.Verbose("DataObjectRepository FindDataObjects criteria {@searchCriteria}", searchCriteria); var propertyProfile = new PropertyProfile {FilterMode = PropertyFilterMode.IMPLIED}; var operationOptions = new OperationOptions(); operationOptions.Profiles.Add(propertyProfile); // Create query var query = new StructuredQuery(); query.AddRepository(dfsConfiguration.Repository); query.ObjectType = objectType; query.IsIncludeHidden = true; query.IsDatabaseSearch = true; if (searchCriteria != null && searchCriteria.Count > 0) { query.RootExpressionSet = new ExpressionSet(); foreach (var expression in searchCriteria) { query.RootExpressionSet.AddExpression(expression); } } // Execute Query const int StartingIndex = 0; int maxResults = dfsConfiguration.MaxQueryResults; var queryExec = new QueryExecution(StartingIndex, maxResults, maxResults); var queryResult = dfsContext.SearchService.Execute(query, queryExec, operationOptions); var queryStatus = queryResult.QueryStatus; var repStatusInfo = queryStatus.RepositoryStatusInfos[0]; if (repStatusInfo.Status == Status.FAILURE) { Log.Debug("FindDataObjects failed {@searchCriteria}", searchCriteria); return null; } Log.Debug("FindDataObjects found {0} objects", queryResult.DataObjects.Count); //TODO see if there is a better way to get the contents from a search return queryResult.DataObjects .Select(dataObject => getContent ? GetDataObjectWithContentsObjectId(dataObject.Identity.GetValueAsString()) : GetDataObjectByObjectId(dataObject.Identity.GetValueAsString())) .ToList(); }
public DataObject GetObjectFilterRelationsParentOnly(ObjectIdentity objIdentity) { // set up relation profile to return only immediate parent RelationshipProfile relationProfile = new RelationshipProfile(); relationProfile.ResultDataMode = ResultDataMode.REFERENCE; relationProfile.TargetRoleFilter = TargetRoleFilter.SPECIFIED; relationProfile.TargetRole = Relationship.ROLE_PARENT; relationProfile.NameFilter = RelationshipNameFilter.ANY; relationProfile.DepthFilter = DepthFilter.SPECIFIED; relationProfile.Depth = 1; OperationOptions operationOptions = new OperationOptions(); operationOptions.RelationshipProfile = relationProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }
public DataObject GetObjectFilterProperties(ObjectIdentity objIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; OperationOptions operationOptions = new OperationOptions(); operationOptions.PropertyProfile = propertyProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }
public DataObject GetObjectFilterPropertiesExclude(ObjectIdentity objIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.SPECIFIED_BY_EXCLUDE; List<string> excludeProperties = new List<string>(); excludeProperties.Add("title"); excludeProperties.Add("object_name"); excludeProperties.Add("r_object_type"); Console.WriteLine("Explicitly filtering all properties by excluding title, object_name, r_object_type."); propertyProfile.ExcludeProperties = excludeProperties; OperationOptions operationOptions = new OperationOptions(); operationOptions.PropertyProfile = propertyProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }
public DataObject GetWithPermissions(ObjectIdentity objectIdentity) { PermissionProfile permissionProfile = new PermissionProfile(); permissionProfile.PermissionTypeFilter = PermissionTypeFilter.ANY; OperationOptions operationOptions = new OperationOptions(); operationOptions.PermissionProfile = permissionProfile; ObjectIdentitySet objectIdSet = new ObjectIdentitySet(); List<ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); return dataPackage.DataObjects[0]; }