public DataPackage UpdateFetchedObjectProperties(ObjectIdentity objectIdentity, String newTitle, String newSubject, String[] newKeywords) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); OperationOptions operationOptions = null; DataPackage dP = objectService.Get(new ObjectIdentitySet(objectIdentity), operationOptions); DataObject dataObject = dP.DataObjects[0]; PropertySet properties = new PropertySet(); properties.Set("title", newTitle); properties.Set("subject", newSubject); properties.Set("keywords", newKeywords); dataObject.Properties = properties; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
public PropertyProfile GetProperyInfo(bool iGetPropertyProfile, bool?iGetInternals = null, bool?iGetPropertyAddress = null, bool?iGetDepartments = null, bool?iGetAccountTypes = null, bool?iGetClub = null, bool?iGetGroup = null, bool?iGetArea = null, bool?iGetZone = null, bool?iGetSection = null, bool?iGetGame = null, bool?iGetTheme = null, bool?iGetPaytable = null, bool?iGetMultiGroup = null, bool?iGetChipSet = null, bool?iGetShift = null, bool?iGetCEQ = null, bool?iGetCalculation = null, bool?iGetIdentificationTypes = null, bool?iGetExternalIDType = null, bool?iGetLocations = null, bool?iGetEmployee = null, bool?iGetJobCodes = null) { PropertyProfile propertyProfile = null; try { PropertyInfoContext propertyInfoContext = new PropertyInfoContext(); propertyProfile = propertyInfoContext.GetProperyInfo(iGetPropertyProfile, iGetInternals, iGetPropertyAddress, iGetDepartments, iGetAccountTypes, iGetClub, iGetGroup, iGetArea, iGetZone, iGetSection, iGetGame, iGetTheme, iGetPaytable, iGetMultiGroup, iGetChipSet, iGetShift, iGetCEQ, iGetCalculation, iGetIdentificationTypes, iGetExternalIDType, iGetLocations, iGetEmployee, iGetJobCodes); if (propertyProfile == null) { _logger.InfoFormat(propertyProfile, "No ProperyInfo has found.", "GetProperyInfo"); } else { _logger.InfoFormat(propertyProfile, "ProperyInfo has found.", "GetProperyInfo"); } } catch (Exception ex) { _logger.ErrorFormat(ex.TargetSite, ex.Message, ex.Source, "GetProperyInfo"); } return(propertyProfile); }
public DfsContext(IDfsConfiguration dfsConfiguration) { this.dfsConfiguration = dfsConfiguration; serviceFactory = ServiceFactory.Instance; var contextFactory = ContextFactory.Instance; serviceContext = contextFactory.NewContext(); var repositoryIdentity = new RepositoryIdentity(dfsConfiguration.Repository, dfsConfiguration.UserName, dfsConfiguration.Password, string.Empty); serviceContext.AddIdentity(repositoryIdentity); var contentTransferProfile = new ContentTransferProfile { TransferMode = ContentTransferMode.MTOM }; serviceContext.SetProfile(contentTransferProfile); // 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 var propertyProfile = new PropertyProfile { FilterMode = PropertyFilterMode.ALL_NON_SYSTEM }; serviceContext.SetProfile(propertyProfile); serviceContext.SetRuntimeProperty("USER_TRANSACTION_HINT", "TRANSACTION_REQUIRED"); }
public DataPackage UpdateRepeatProperty(ObjectIdentity objectIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); String[] moreDangers = { "snakes", "sharks" }; ArrayProperty <string> keywordProperty = new StringArrayProperty("keywords", moreDangers); Console.WriteLine("Appending additional strings 'snakes' and 'sharks' to object keywords."); ValueAction appendAction = new ValueAction(ValueActionType.INSERT, 0); ValueAction deleteAction = new ValueAction(ValueActionType.APPEND, 1); keywordProperty.SetValueActions(appendAction, deleteAction); PropertySet properties = new PropertySet(); properties.Set(keywordProperty); dataObject.Properties = properties; OperationOptions operationOptions = null; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
private void initializeContext() { ContextFactory contextFactory = ContextFactory.Instance; serviceContext = contextFactory.NewContext(); RepositoryIdentity repoId = new RepositoryIdentity(); RepositoryIdentity repositoryIdentity = new RepositoryIdentity(DefaultRepository, UserName, Password, ""); serviceContext.AddIdentity(repositoryIdentity); ContentTransferProfile contentTransferProfile = new ContentTransferProfile(); contentTransferProfile.TransferMode = ContentTransferMode.MTOM; contentTransferProfile.Geolocation = "Pleasanton"; serviceContext.SetProfile(contentTransferProfile); PropertyProfile propertyProfile = new PropertyProfile(); propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; serviceContext.SetProfile(propertyProfile); if (SecondaryRepository != null) { RepositoryIdentity repoId1 = new RepositoryIdentity(); repoId1.RepositoryName = SecondaryRepository; repoId1.UserName = UserName; repoId1.Password = Password; serviceContext.AddIdentity(repoId1); } }
/// <summary> /// Restituisce un DataObject con tutte le proprietà di un oggetto DCTM e /// l'insieme dei folder a cui è linkato (quest'ultimi solo come identity però) /// </summary> /// <param name="objSrvc"></param> /// <param name="documentIdentity"></param> /// <param name="propertyNames">null == TUTTE; altrimenti quelle indicate. OKKIO: in nessun caso restituisce r_object_id !!</param> /// <returns></returns> public static DataObject getAllPropsAndFolders(IObjectService objSrvc, ObjectIdentity objectIdentity, List <string> propertyNames, bool includeFolders) { DataPackage pkg = new DataPackage(); ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity); PropertyProfile propertyProfile = null; //propertyProfile.filterModeSpecified = true; if (propertyNames == null) { propertyProfile = new PropertyProfile(PropertyFilterMode.ALL); } else { propertyProfile = new PropertyProfile(PropertyFilterMode.SPECIFIED_BY_INCLUDE); propertyProfile.IncludeProperties = propertyNames; } RelationshipProfile relationProfile = new RelationshipProfile(); if (includeFolders) { //TODO: bug di DFS60sp1: // se specifico che voglio solo le relazioni parent non funziona // devo chiedere tutte le relazioni //relationProfile.ResultDataMode = ResultDataMode.REFERENCE; //relationProfile.TargetRoleFilter = TargetRoleFilter.ANY; //relationProfile.NameFilter = RelationshipNameFilter.ANY; //relationProfile.DepthFilter = DepthFilter.UNLIMITED; // proposta di Azzalini per velocizzare eliminazione documento in Fascicolo con DCTM 6.7 relationProfile.ResultDataMode = ResultDataMode.REFERENCE; relationProfile.TargetRoleFilter = TargetRoleFilter.SPECIFIED; relationProfile.TargetRole = Relationship.ROLE_PARENT; relationProfile.NameFilter = RelationshipNameFilter.SPECIFIED; relationProfile.RelationName = Relationship.RELATIONSHIP_FOLDER; relationProfile.DepthFilter = DepthFilter.SPECIFIED; relationProfile.Depth = 1; } OperationOptions operationOptions = new OperationOptions(); //operationOptions.Profiles = new Profile[profilesCount]; operationOptions.PropertyProfile = propertyProfile; if (includeFolders) { operationOptions.RelationshipProfile = relationProfile; } pkg = objSrvc.Get(objectIdSet, operationOptions); return(pkg.DataObjects[0]); }
//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 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 PortfolioControllerTests() { var portfolioProfile = new PortfolioProfile(); var propertyProfile = new PropertyProfile(); var addressProfile = new AddressProfile(); var config = new MapperConfiguration(cfg => { cfg.AddProfile(portfolioProfile); cfg.AddProfile(propertyProfile); cfg.AddProfile(addressProfile); }); _mapper = new Mapper(config); _user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.NameIdentifier, "SomeValueHere"), new Claim(ClaimTypes.Name, "*****@*****.**") }, "Owner")); }
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 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 ActionResult Save(PropertyProfile Property, Image image, IEnumerable <HttpPostedFileBase> picture) { foreach (var pic in picture) { if (pic != null) { image.ImageName = Path.GetFileNameWithoutExtension(pic.FileName); string extension = Path.GetExtension(pic.FileName); var newExtension = Guid.NewGuid(); image.ImageName = image.ImageName + newExtension; image.ImagePath = Path.Combine(Url.Content("C:/Users/santo/source/repos/Real_State/Property_Images/"), image.ImageName); pic.SaveAs(image.ImagePath); // _context.Images.Add(AgentProfile); //Property.ID = image.ID; // image.PropertyProfileID = Property.ID; // _context.Images.Add(image); _context.SaveChanges(); } } if (Property.ID == 0) { _context.PropertyProfiles.Add(Property); } else { var customerInDb = _context.PropertyProfiles.Single(c => c.ID == Property.ID); customerInDb.PropertyTypesID = Property.PropertyTypesID; customerInDb.BedroomNumber = Property.BedroomNumber; customerInDb.BathroomNumber = Property.BathroomNumber; customerInDb.Area = Property.Area; customerInDb.Location = Property.Location; customerInDb.Price = Property.Price; customerInDb.Description = Property.Description; } _context.SaveChanges(); return(RedirectToAction("Index", "Property")); }
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 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 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 DataPackage UpdateRepeatProperty(ObjectIdentity objectIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); String[] moreDangers = { "snakes", "sharks" }; ArrayProperty<string> keywordProperty = new StringArrayProperty("keywords", moreDangers); Console.WriteLine("Appending additional strings 'snakes' and 'sharks' to object keywords."); ValueAction appendAction = new ValueAction(ValueActionType.INSERT, 0); ValueAction deleteAction = new ValueAction(ValueActionType.APPEND, 1); keywordProperty.SetValueActions(appendAction, deleteAction); PropertySet properties = new PropertySet(); properties.Set(keywordProperty); dataObject.Properties = properties; OperationOptions operationOptions = null; return objectService.Update(new DataPackage(dataObject), operationOptions); }
public DataPackage UpdateFetchedObjectProperties(ObjectIdentity objectIdentity, String newTitle, String newSubject, String[] newKeywords) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); OperationOptions operationOptions = null; DataPackage dP = objectService.Get(new ObjectIdentitySet(objectIdentity), operationOptions); DataObject dataObject = dP.DataObjects[0]; PropertySet properties = new PropertySet(); properties.Set("title", newTitle); properties.Set("subject", newSubject); properties.Set("keywords", newKeywords); dataObject.Properties = properties; return objectService.Update(new DataPackage(dataObject), operationOptions); }