/// <summary> /// Deserializza una struttura JSON di tipo UDSWorkflowModel recuperata da Workflow (property). /// </summary> /// <returns>oggetto UDSDto</returns> public UDSDto ReadUDSWorkflowJson(string udsWorkflowJson, Data.Entity.UDS.UDSRepository repository) { if (string.IsNullOrEmpty(udsWorkflowJson)) { throw new ArgumentNullException("udsWorkflowJson"); } if (repository == null) { throw new ArgumentNullException("repository"); } UDSModel udsModel = UDSModel.LoadXml(repository.ModuleXML); UDSWorkflowModel model = JsonConvert.DeserializeObject <UDSWorkflowModel>(udsWorkflowJson, DocSuiteContext.DefaultWebAPIJsonSerializerSettings); UDSModelField udsField; foreach (Section metadata in udsModel.Model.Metadata) { foreach (FieldBaseType item in metadata.Items) { udsField = new UDSModelField(item); foreach (KeyValuePair <string, string> data in model.DynamicDatas) { if (data.Key.Eq(udsField.ColumnName)) { udsField.Value = data.Value; } } } } if (udsModel.Model.Contacts != null && model.Contact != null) { //todo: sarà sempre e solo un singolo contatto? Contacts contact = udsModel.Model.Contacts.FirstOrDefault(); if (model.Contact.HasId()) { ContactInstance newInstance = new ContactInstance() { IdContact = model.Contact.Id.Value }; contact.ContactInstances = (contact.ContactInstances ?? Enumerable.Empty <ContactInstance>()).Concat(new ContactInstance[] { newInstance }).ToArray(); } else if (!string.IsNullOrEmpty(model.Contact.Description)) { ContactManualInstance newManualInstance = new ContactManualInstance() { ContactDescription = model.Contact.Description }; contact.ContactManualInstances = (contact.ContactManualInstances ?? Enumerable.Empty <ContactManualInstance>()).Concat(new ContactManualInstance[] { newManualInstance }).ToArray(); } } UDSDto udsDto = new UDSDto() { UDSModel = udsModel }; return(udsDto); }
private void FillProtocols(UDSEntityDto entityDto, UDSModel model) { ICollection <WebAPIDto <UDSDocumentUnit> > result = WebAPIImpersonatorFacade.ImpersonateFinder(UDSDocumentUnitFinder, (impersonationType, finder) => { finder.ResetDecoration(); finder.IdUDS = entityDto.Id; finder.EnablePaging = false; finder.ExpandRelation = true; finder.DocumentUnitTypes = new List <Entity.UDS.UDSRelationType>() { Entity.UDS.UDSRelationType.Protocol, Entity.UDS.UDSRelationType.ArchiveProtocol, Entity.UDS.UDSRelationType.ProtocolArchived }; return(finder.DoSearch()); }); if (result == null || !result.Select(s => s.Entity).Any()) { return; } ICollection <UDSDocumentUnit> documentUnits = result.Select(s => s.Entity).ToList(); IEnumerable <ReferenceModel> referenceModels = documentUnits.Select(s => new ReferenceModel() { UniqueId = s.Relation.UniqueId }); model.FillProtocols(referenceModels); entityDto.DocumentUnits = entityDto.DocumentUnits.Concat(documentUnits.Select(s => new UDSEntityDocumentUnitDto() { UniqueId = s.Relation.UniqueId, UDSDocumentUnitId = s.UniqueId, RelationType = Model.Entities.UDS.UDSRelationType.Protocol })).ToList(); }
private void FillCollaborations(UDSEntityDto entityDto, UDSModel model) { ICollection <WebAPIDto <UDSCollaboration> > result = WebAPIImpersonatorFacade.ImpersonateFinder(UDSCollaborationFinder, (impersonationType, finder) => { finder.ResetDecoration(); finder.IdUDS = entityDto.Id; finder.EnablePaging = false; finder.ExpandRelation = true; return(finder.DoSearch()); }); if (result == null || !result.Select(s => s.Entity).Any()) { return; } ICollection <UDSCollaboration> collaborations = result.Select(s => s.Entity).ToList(); IEnumerable <ReferenceModel> referenceModels = collaborations.Select(s => new ReferenceModel() { EntityId = s.Relation.EntityId, UniqueId = s.Relation.UniqueId }); model.FillCollaborations(referenceModels); entityDto.Collaborations = result.Select(s => s.Entity).Select(s => new UDSEntityCollaborationDto() { IdCollaboration = s.Relation.EntityId, UniqueId = s.UniqueId }).ToArray(); }
/* * attempts to load and returns all loaded UDS models in the scene */ public static vdkRenderInstance[] getUDSInstances() { GameObject[] objects = GameObject.FindGameObjectsWithTag("UDSModel"); int count = 0; vdkRenderInstance[] modelArray = new vdkRenderInstance[objects.Length]; for (int i = 0; i < objects.Length; ++i) { Component component = objects[i].GetComponent("UDSModel"); UDSModel model = component as UDSModel; if (!model.isLoaded) { model.LoadModel(); } if (model.isLoaded) { modelArray[count].pointCloud = model.udModel.pModel; modelArray[count].worldMatrix = UDUtilities.GetUDMatrix(model.pivotTranslation * model.modelScale * objects[i].transform.localToWorldMatrix * model.pivotTranslation.inverse); count++; } } return(modelArray.Where(m => (m.pointCloud != System.IntPtr.Zero)).ToArray()); }
/* * attempts to load and returns all loaded UDS models in the scene */ public static udRenderInstance[] getUDSInstances() { GameObject[] objects = GameObject.FindGameObjectsWithTag("UDSModel"); int count = 0; udRenderInstance[] modelArray = new udRenderInstance[objects.Length]; for (int i = 0; i < objects.Length; ++i) { UDSModel model = (UDSModel)objects[i].GetComponent("UDSModel"); if (!model.isLoaded) { model.LoadModel(); } if (model.isLoaded) { modelArray[count].pointCloud = model.udModel.pModel; Transform localTransform = objects[i].transform; modelArray[count].worldMatrix = UDUtilities.GetUDMatrix( Matrix4x4.TRS(model.transform.position, model.transform.rotation, model.transform.localScale) * model.modelToPivot ); count++; } } return(modelArray.Where(m => (m.pointCloud != System.IntPtr.Zero)).ToArray()); }
public static IList <DocumentInfo> GetAllDocuments(UDSModel udsModel) { List <DocumentInfo> list = new List <DocumentInfo>(); list.AddRange(FillUDSDocuments(udsModel.Model.Documents.Document)); list.AddRange(FillUDSDocuments(udsModel.Model.Documents.DocumentAttachment)); list.AddRange(FillUDSDocuments(udsModel.Model.Documents.DocumentAnnexed)); return(list); }
/// <summary> /// Deserializza una struttura JSON dinamica recuperata da WebAPI. /// </summary> /// <returns>oggetto UDSDto</returns> public UDSDto ReadUDSJson(string udsJson, Data.Entity.UDS.UDSRepository repository) { if (string.IsNullOrEmpty(udsJson)) { throw new ArgumentNullException("udsJson"); } if (repository == null) { throw new ArgumentNullException("repository"); } UDSModel udsModel = UDSModel.LoadXml(repository.ModuleXML); string jsonParsed = ParseJson(udsJson); UDSEntityDto entityDto = JsonConvert.DeserializeObject <IList <UDSEntityDto> >(jsonParsed, DocSuiteContext.DefaultUDSJsonSerializerSettings).FirstOrDefault(); if (entityDto == null) { return(null); } FillBaseData(entityDto, udsModel); FillMetadata(jsonParsed, udsModel); FillDocuments(entityDto, udsModel); FillContacts(entityDto, udsModel); FillAuthorization(entityDto, udsModel); FillMessages(entityDto, udsModel); FillPECMails(entityDto, udsModel); FillProtocols(entityDto, udsModel); FillCollaborations(entityDto, udsModel); UDSDto dto = new UDSDto() { Id = entityDto.Id.Value, Year = entityDto.Year.Value, Number = entityDto.Number.Value, Status = entityDto.Status, CancelMotivation = entityDto.CancelMotivation, RegistrationDate = entityDto.RegistrationDate.Value, RegistrationUser = entityDto.RegistrationUser, LastChangedDate = entityDto.LastChangedDate, LastChangedUser = entityDto.LastChangedUser, Subject = entityDto.Subject, Category = entityDto.Category, UDSRepository = entityDto.UDSRepository, Authorizations = entityDto.Authorizations, Contacts = entityDto.Contacts, Documents = entityDto.Documents, Messages = entityDto.Messages, PecMails = entityDto.PecMails, Collaborations = entityDto.Collaborations, DocumentUnits = entityDto.DocumentUnits, UDSModel = udsModel }; return(dto); }
public void SaveRepository(UDSModel model, DateTimeOffset activeDate, Guid idRepository, bool publish) { Guid draftIdSaved = SaveDraftRepository(model, idRepository); if (publish) { //Se l'ID della bozza salvata è uguale all'idRepository in ingresso significa che lo schema deve essere modificato ConfirmRepository(model, activeDate, draftIdSaved); } }
public string JsToXml(JsModel jsModel, out List <String> errors) { errors = new List <String>(); UDSModel uds = ConvertFromJson(jsModel); if (!uds.Model.Metadata.SelectMany(f => f.Items).Any()) { errors.Add("E' necessario specificare almeno un metadato dell'archivio."); } return(uds.SerializeToXml()); }
public Guid SendCommandInsertData(Guid idRepository, Guid correlationId, UDSModel model) { CommandFacade <ICommandInsertUDSData> commandFacade = new CommandFacade <ICommandInsertUDSData>(); IdentityContext identity = new IdentityContext(DocSuiteContext.Current.User.FullUserName); UDSBuildModel commandModel = CreateUDSCommandModel(idRepository, idRepository, model); ICommandInsertUDSData commandInsert = new CommandInsertUDSData(correlationId, CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); commandFacade.Push(commandInsert); return(commandInsert.Id); }
public UDSRelationFacade(string xml, string xmlSchema, string dbSchema = "dbo") { bool validate = UDSModel.ValidateXml(xml, xmlSchema, out List <string> validationErrors); if (!validate) { throw new UDSRelationException(string.Format("UDSRelationFacade - Errori di validazione Xml: {0}", string.Join("\n", validationErrors))); } _uds = UDSModel.LoadXml(xml); _builder = new UDSTableBuilder(UDS, dbSchema); }
void Start() { string[] files = Directory.GetFiles(path); double[] rootBaseOffset = new double[3]; Vector3 rootBaseTranslation = Vector3.zero; int baseInd = 0; //index in the list to which all models will be placed relative to for (int i = 0; i < files.Length; ++i) { string file = files[i]; //skip non uds files if (!file.Substring(file.Length - 4).Equals(".uds")) { if (i == baseInd) { ++baseInd; } continue; } GameObject modelGameObject = new GameObject(file); modelGameObject.transform.SetParent(this.transform); modelGameObject.AddComponent <UDSModel>(); UDSModel model = modelGameObject.GetComponent <UDSModel>(); model.path = file; try { model.LoadModel(); } catch { Debug.LogError("load model failed: " + file); if (i == baseInd) { ++baseInd; } continue; } if (i == baseInd) //reference all models to the first { rootBaseOffset = model.header.baseOffset; } model.geolocationOffset = UDUtilities.UDtoGL * -new Vector3( (float)rootBaseOffset[0], (float)rootBaseOffset[1], (float)rootBaseOffset[2] ); modelGameObject.tag = "UDSModel"; model.geolocate = true; } }
private UDSBuildModel CreateUDSCommandModel(Guid idRepository, Guid idUDS, UDSModel model) { UDSRepositoryModelMapper repositoryModelMapper = new UDSRepositoryModelMapper(); UDSBuildModel commandModel = new UDSBuildModel(model.SerializeToXml()); UDSRepository repository = GetById(idRepository); commandModel.UDSRepository = repositoryModelMapper.MappingDTO(repository); commandModel.UniqueId = idUDS; commandModel.RegistrationUser = DocSuiteContext.Current.User.FullUserName; return(commandModel); }
public UDSStorageFacade(ILogger logger, string xml, string xmlSchema, BiblosDS.BiblosDSManagement.AdministrationClient administrationClient, string dbSchema = "") { _logger = logger; bool validate = UDSModel.ValidateXml(xml, xmlSchema, out List <string> validationErrors); if (!validate) { throw new UDSStorageException(string.Format("UDSStorageFacade - Errore di validazione: {0}", string.Join("\n", validationErrors))); } _udsModel = UDSModel.LoadXml(xml); _udsTableBuilder = new UDSTableBuilder(_udsModel, dbSchema); _administrationClient = administrationClient; }
private void ConfirmRepository(UDSModel model, DateTimeOffset activeDate, Guid idRepository) { if (idRepository.Equals(Guid.Empty)) { throw new ArgumentNullException("idRepository"); } UDSSchemaRepositoryModelMapper repositoryschemaModelMapper = new UDSSchemaRepositoryModelMapper(); UDSRepositoryModelMapper repositoryModelMapper = new UDSRepositoryModelMapper(repositoryschemaModelMapper); UDSBuildModel commandModel = new UDSBuildModel(model.SerializeToXml()); IdentityContext identity = new IdentityContext(DocSuiteContext.Current.User.FullUserName); string tenantName = DocSuiteContext.Current.ProtocolEnv.CorporateAcronym; Guid tenantId = DocSuiteContext.Current.CurrentTenant.TenantId; WebAPIDto <UDSRepository> resultDto = null; WebAPIImpersonatorFacade.ImpersonateFinder(Currentfinder, (impersonationType, finder) => { finder.UniqueId = idRepository; finder.EnablePaging = false; finder.ExpandProperties = true; finder.ActionType = UDSRepositoryFinderActionType.FindElement; resultDto = finder.DoSearch().FirstOrDefault(); finder.ResetDecoration(); }); UDSRepository repository = resultDto.Entity; commandModel.UDSRepository = repositoryModelMapper.Map(repository, new UDSRepositoryModel()); commandModel.ActiveDate = activeDate; commandModel.UniqueId = repository.UniqueId; commandModel.RegistrationUser = repository.RegistrationUser; if (repository.Version > 0) { ICommandUpdateUDS commandUpdate = new CommandUpdateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); CommandFacade <ICommandUpdateUDS> commandUpdateFacade = new CommandFacade <ICommandUpdateUDS>(); commandUpdateFacade.Push(commandUpdate); } else { ICommandCreateUDS commandInsert = new CommandCreateUDS(CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); CommandFacade <ICommandCreateUDS> commandCreateFacade = new CommandFacade <ICommandCreateUDS>(); commandCreateFacade.Push(commandInsert); } }
private void FillDocuments(UDSEntityDto entityDto, UDSModel model) { if (model.Model.Documents == null) { return; } ICollection <Guid> mainDocuments = entityDto.Documents.Where(x => x.DocumentType == Helpers.UDS.UDSDocumentType.Main && x.IdDocument.HasValue).Select(s => s.IdDocument.Value).ToList(); ICollection <Guid> attachementDocuments = entityDto.Documents.Where(x => x.DocumentType == Helpers.UDS.UDSDocumentType.Attachment && x.IdDocument.HasValue).Select(s => s.IdDocument.Value).ToList(); ICollection <Guid> annexedDocuments = entityDto.Documents.Where(x => x.DocumentType == Helpers.UDS.UDSDocumentType.Annexed && x.IdDocument.HasValue).Select(s => s.IdDocument.Value).ToList(); ICollection <Guid> dematerialisationDocuments = entityDto.Documents.Where(x => x.DocumentType == Helpers.UDS.UDSDocumentType.Dematerialisation && x.IdDocument.HasValue).Select(s => s.IdDocument.Value).ToList(); model.FillDocuments(mainDocuments); model.FillDocumentAttachments(attachementDocuments); model.FillDocumentAnnexed(annexedDocuments); model.FillDocumentDematerialisation(dematerialisationDocuments); }
private void FillMetadata(string jsModel, UDSModel model) { Dictionary <string, JToken> rootElements = JsonConvert.DeserializeObject <List <Dictionary <string, JToken> > >(jsModel, DocSuiteContext.DefaultUDSJsonSerializerSettings).First(); foreach (Section metadata in model.Model.Metadata) { foreach (FieldBaseType item in metadata.Items) { UDSModelField udsField = new UDSModelField(item); JToken selectedProperty = rootElements.ContainsKey(udsField.ColumnName) ? rootElements[udsField.ColumnName] : null; if (selectedProperty == null) { continue; } udsField.Value = selectedProperty.ToObject <object>(); } } }
// Start is called before the first frame update void Start() { string[] files = Directory.GetFiles(path); Vector3 rootBaseOffset = new Vector3(); for (int i = 0; i < files.Length; ++i) { string file = files[i]; //skip non uds files if (!file.Substring(file.Length - 4).Equals(".uds")) { continue; } GameObject udModel = new GameObject(file); udModel.transform.SetParent(this.transform); udModel.AddComponent <UDSModel>(); UDSModel model = udModel.GetComponent <UDSModel>(); model.path = file; try { model.LoadModel(); } catch { Debug.LogError("load model failed: " + file); continue; } Vector3 baseOffset = new Vector3((float)model.header.baseOffset[0], (float)model.header.baseOffset[1], (float)model.header.baseOffset[2]); if (i == 0) { rootBaseOffset = baseOffset; } model.transform.localPosition = baseOffset - rootBaseOffset; model.transform.localScale = new Vector3((float)model.header.scaledRange, (float)model.header.scaledRange, (float)model.header.scaledRange); model.transform.localRotation = Quaternion.Euler(-90, 0, 0); udModel.tag = "UDSModel"; } }
private void FillAuthorization(UDSEntityDto entityDto, UDSModel model) { ICollection <UDSRole> roles = new List <UDSRole>(); ICollection <WebAPIDto <UDSRole> > result = WebAPIImpersonatorFacade.ImpersonateFinder(UDSRoleFinder, (impersonationType, finder) => { finder.ResetDecoration(); finder.IdUDS = entityDto.Id; finder.EnablePaging = false; finder.ExpandRelation = true; return(finder.DoSearch()); }); if (result == null) { return; } roles = result.Select(f => f.Entity).ToList(); if (roles == null || roles.Count() < 1) { return; } IEnumerable <ReferenceModel> referenceModels = roles.Select(s => new ReferenceModel() { EntityId = s.Relation.EntityShortId, UniqueId = s.UniqueId, AuthorizationType = (AuthorizationType)s.AuthorizationType }); model.FillAuthorizations(referenceModels, model.Model.Authorizations.Label); entityDto.Authorizations = roles.Select(s => new UDSEntityRoleDto() { IdRole = s.Relation.EntityShortId, UniqueId = s.UniqueId, AuthorizationType = (AuthorizationType)s.AuthorizationType }).ToArray(); }
private void FillBaseData(UDSEntityDto entityDto, UDSModel model) { model.Model.Title = entityDto.UDSRepository?.Name; model.Model.Subject.Value = entityDto.Subject; model.Model.Category.IdCategory = entityDto.IdCategory?.ToString(); }
/// <summary> /// Salva o modifica una Bozza in UDSRepositories /// </summary> /// <returns>Il medesimo IdRepository del parametro idRepository se l'oggetto si trova in stato Bozza, altrimenti viene creato un nuovo ID</returns> private Guid SaveDraftRepository(UDSModel model, Guid idRepository) { UDSRepository repository = null; UDSRepository savedRepository = null; if (!idRepository.Equals(Guid.Empty)) { WebAPIImpersonatorFacade.ImpersonateFinder(Currentfinder, (impersonationType, finder) => { //Se il repository recuperato è in stato Bozza allora procedo alla modifica del medesimo oggetto, //viceversa creo sempre una nuova Bozza. finder.UniqueId = idRepository; finder.EnablePaging = false; finder.ExpandProperties = true; finder.ActionType = UDSRepositoryFinderActionType.FindElement; WebAPIDto <UDSRepository> resultDto = finder.DoSearch().FirstOrDefault(); finder.ResetDecoration(); if (resultDto != null && resultDto.Entity != null) { savedRepository = resultDto.Entity; repository = (savedRepository.Status.Equals(Entity.UDS.UDSRepositoryStatus.Draft)) ? savedRepository : null; } }); } short idContainer = -1; if (repository == null) { repository = new UDSRepository() { ModuleXML = model.SerializeToXml(), Name = model.Model.Title, Status = Entity.UDS.UDSRepositoryStatus.Draft, Version = idRepository.Equals(Guid.Empty) ? (short)0 : savedRepository.Version, Alias = model.Model.Alias }; repository.Container = null; if (repository.Version > 0) { model.Model.Container.IdContainer = savedRepository.Container.EntityShortId.ToString(); model.Model.Title = savedRepository.Name; model.Model.Alias = savedRepository.Alias; model.Model.Container.CreateContainer = false; if (model.Model.Documents != null && model.Model.Documents.Document != null) { model.Model.Documents.Document.CreateBiblosArchive = false; } if (model.Model.Documents != null && model.Model.Documents.DocumentDematerialisation != null) { model.Model.Documents.DocumentDematerialisation.CreateBiblosArchive = false; } repository.Name = savedRepository.Name; repository.Alias = savedRepository.Alias; repository.Container = savedRepository.Container; repository.ModuleXML = model.SerializeToXml(); } if (savedRepository == null && model.Model.Container != null && !string.IsNullOrEmpty(model.Model.Container.IdContainer) && short.TryParse(model.Model.Container.IdContainer, out idContainer)) { repository.Container = new Entity.Commons.Container() { EntityShortId = idContainer }; } Save(repository); } else { repository.Container = savedRepository == null ? null : repository.Container; if (repository.Version > 0) { model.Model.Container.IdContainer = savedRepository.Container.EntityShortId.ToString(); model.Model.Title = savedRepository.Name; model.Model.Alias = savedRepository.Alias; model.Model.Container.CreateContainer = false; if (model.Model.Documents != null && model.Model.Documents.Document != null) { model.Model.Documents.Document.CreateBiblosArchive = false; } if (model.Model.Documents != null && model.Model.Documents.DocumentDematerialisation != null) { model.Model.Documents.DocumentDematerialisation.CreateBiblosArchive = false; } repository.Name = savedRepository.Name; repository.Alias = savedRepository.Alias; repository.Container = savedRepository.Container; repository.ModuleXML = model.SerializeToXml(); } if (savedRepository == null && model.Model.Container != null && !string.IsNullOrEmpty(model.Model.Container.IdContainer) && short.TryParse(model.Model.Container.IdContainer, out idContainer)) { repository.Container = new Entity.Commons.Container() { EntityShortId = idContainer }; } repository.ModuleXML = model.SerializeToXml(); repository.Name = model.Model.Title; repository.Alias = model.Model.Alias; Update(repository); } return(repository.UniqueId); }
public Guid SendCommandDeleteData(Guid idRepository, Guid idUDS, Guid correlationId, UDSModel model, string cancelMotivation) { CommandFacade <ICommandDeleteUDSData> commandFacade = new CommandFacade <ICommandDeleteUDSData>(); IdentityContext identity = new IdentityContext(DocSuiteContext.Current.User.FullUserName); UDSBuildModel commandModel = CreateUDSCommandModel(idRepository, idUDS, model); commandModel.CancelMotivation = cancelMotivation; ICommandDeleteUDSData commandCancel = new CommandDeleteUDSData(correlationId, CurrentTenant.TenantName, CurrentTenant.UniqueId, CurrentTenant.TenantAOO.UniqueId, identity, commandModel); commandFacade.Push(commandCancel); return(commandCancel.Id); }
public UDSModel ConvertFromJson(JsModel jsonModel) { if (jsonModel.elements == null) { return(null); } Dictionary <string, Func <Element, bool> > parseDict = GetElementParserDict(); foreach (Element el in jsonModel.elements) { if (!parseDict.ContainsKey(el.ctrlType)) { continue; } parseDict[el.ctrlType](el); } UDSModel uds = new UDSModel(); UnitaDocumentariaSpecifica model = uds.Model; category.ClientId = "CategoryId"; category.Label = "Classificatore"; container.ClientId = "ContainerId"; container.Label = "Contenitore"; container.CreateContainer = createContainer; subjectType.DefaultValue = subject; subjectType.ClientId = "SubjectId"; subjectType.Label = "Oggetto"; subjectType.ResultVisibility = resultVisibility; model.Title = title; model.Category = category; model.Container = container; model.Subject = subjectType; model.Subject.ModifyEnabled = modifyEnabled; model.WorkflowEnabled = enabledWorkflow; model.ProtocolEnabled = enabledProtocol; model.PECEnabled = enabledPEC; model.PECButtonEnabled = enabledPECButton; model.MailButtonEnabled = enabledMailButton; model.MailRoleButtonEnabled = enabledMailRoleButton; model.LinkButtonEnabled = enabledLinkButton; model.DocumentUnitSynchronizeEnabled = enabledCQRSSync; model.IncrementalIdentityEnabled = incrementalIdentityEnabled; model.Alias = alias; model.CancelMotivationRequired = enabledCancelMotivation; model.HideRegistrationIdentifier = hideRegistrationIdentifier; model.StampaConformeEnabled = stampaConformeEnabled; model.ShowArchiveInProtocolSummaryEnabled = showArchiveInProtocolSummaryEnabled; model.RequiredRevisionUDSRepository = requiredRevisionUDSRepository; model.ShowLastChangedDate = showLastChangedDate; model.ShowLastChangedUser = showLastChangedUser; model.Contacts = contacts.ToArray(); model.Documents = new Documents(); if (documents.Count() > 0) { Document doc = null; if (documents.TryGetValue(collectionDocument, out doc)) { doc.ClientId = string.Concat("uds_doc_main_0"); model.Documents.Document = doc; } if (documents.TryGetValue(collectionAnnexed, out doc)) { doc.ClientId = string.Concat("uds_doc_annexed_1"); model.Documents.DocumentAnnexed = doc; } if (documents.TryGetValue(collectionAttachment, out doc)) { doc.ClientId = string.Concat("uds_doc_attachment_1"); model.Documents.DocumentAttachment = doc; } } model.Authorizations = authorizations; model.Metadata = sections.GetSections(); return(uds); }
//A partire dal modello Uds crea un modello di default JSon public JsModel ConvertToJs(UDSModel uds) { UnitaDocumentariaSpecifica model = uds.Model; //title List <Element> elements = new List <Element>(); Element titleElement = new Element { ctrlType = ctlTitle, label = model.Title, readOnly = false, searchable = true, modifyEnable = model.Subject.ModifyEnabled, subject = model.Subject.DefaultValue, clientId = "SubjectId", enabledWorkflow = model.WorkflowEnabled, enabledProtocol = model.ProtocolEnabled, enabledPEC = model.PECEnabled, enabledPECButton = model.PECButtonEnabled, enabledMailButton = model.MailButtonEnabled, enabledMailRoleButton = model.MailRoleButtonEnabled, enabledLinkButton = model.LinkButtonEnabled, enabledCQRSSync = model.DocumentUnitSynchronizeEnabled, alias = model.Alias, enabledCancelMotivation = model.CancelMotivationRequired, incrementalIdentityEnabled = model.IncrementalIdentityEnabled, subjectResultVisibility = model.Subject.ResultVisibility, hideRegistrationIdentifier = model.HideRegistrationIdentifier, stampaConformeEnabled = model.StampaConformeEnabled, showArchiveInProtocolSummaryEnabled = model.ShowArchiveInProtocolSummaryEnabled, requiredRevisionUDSRepository = model.RequiredRevisionUDSRepository, showLastChangedDate = model.ShowLastChangedDate, showLastChangedUser = model.ShowLastChangedUser }; if (model.Category != null) { titleElement.idCategory = model.Category.IdCategory; titleElement.categoryReadOnly = model.Category.ReadOnly; titleElement.categorySearchable = model.Category.Searchable; titleElement.categoryDefaultEnabled = model.Category.DefaultEnabled; titleElement.categoryResultVisibility = model.Category.ResultVisibility; } if (model.Container != null) { titleElement.idContainer = model.Container.IdContainer; titleElement.containerSearchable = model.Container.Searchable; titleElement.createContainer = model.Container.CreateContainer; } elements.Add(titleElement); //sections if (model.Metadata != null) { foreach (Section section in model.Metadata) { if (section.SectionLabel != SectionManager.DefaultSectionName) { elements.Add(new Element { ctrlType = ctlHeader, label = section.SectionLabel }); } if (section.Items != null) { foreach (FieldBaseType field in section.Items) { Element element = CreateFieldElement(field); if (element != null) { if (element.clientId == "0" || string.IsNullOrEmpty(element.clientId)) { element.clientId = string.Concat("uds_", element.columnName, "_", elements.Count()); } elements.Add(element); } } } } } //documents if (model.Documents != null && model.Documents.Document != null) { elements.Add(CreateDocumentElement(model.Documents.Document, collectionDocument)); } if (model.Documents != null && model.Documents.DocumentAnnexed != null) { elements.Add(CreateDocumentElement(model.Documents.DocumentAnnexed, collectionAnnexed)); } if (model.Documents != null && model.Documents.DocumentAttachment != null) { elements.Add(CreateDocumentElement(model.Documents.DocumentAttachment, collectionAttachment)); } //contacts if (model.Contacts != null) { foreach (Contacts contact in model.Contacts) { elements.Add(CreateContactElement(contact)); } } //authorizations if (model.Authorizations != null) { elements.Add(CreateAuthorizationsElement(model.Authorizations)); } return(new JsModel { elements = elements.ToArray() }); }
public void LoadTree(IntPtr pNode) { this.projectNode = new UDProjectNode(pNode); if (projectNode.nodeData.pName != IntPtr.Zero) { this.name = Marshal.PtrToStringAnsi(projectNode.nodeData.pName); } if (projectNode.nodeData.pURI != IntPtr.Zero) { this.URI = Marshal.PtrToStringAnsi(projectNode.nodeData.pURI); } this.itemType = projectNode.nodeData.itemtype; this.geometryType = projectNode.nodeData.geomtype; switch (itemType) { case udProjectNodeType.udPNT_Custom://!<Need to check the itemtypeStr string manually. itemTypeString = new string(projectNode.nodeData.itemtypeStr); switch (itemTypeString) { //these are the custom types currently supported by Vault Client: case "I3S": break; case ("Water"): break; case "ViewMap": break; case "Polygon": break; case "QFilter": break; case "Places": break; case "MHeight": break; } break; case udProjectNodeType.udPNT_PointCloud://!<A Euclideon Unlimited Detail Point Cloud file (“UDS”) UDSModel model = gameObject.AddComponent <UDSModel>(); gameObject.tag = "UDSModel"; model.path = this.URI; break; case udProjectNodeType.udPNT_PointOfInterest: var mf = gameObject.AddComponent <MeshFilter>(); break; case udProjectNodeType.udPNT_Folder: //!<A folder of other nodes (“Folder”) break; case udProjectNodeType.udPNT_LiveFeed: //!<A Euclideon Vault live feed container (“IOT”) break; case udProjectNodeType.udPNT_Media: //!<An Image, Movie, Audio file or other media object (“Media”) break; case udProjectNodeType.udPNT_Viewpoint: break; case udProjectNodeType.udPNT_VisualisationSettings: //!<Visualisation settings (itensity, map height etc) (“VizSet”) break; } switch (geometryType) { case (udProjectGeometryType.udPGT_None): //!<There is no geometry associated with this node. break; case (udProjectGeometryType.udPGT_Point): //!<pCoordinates is a single 3D position { double[] position = new double[3]; Marshal.Copy(projectNode.nodeData.pCoordinates, position, 0, 3); transform.position = new Vector3((float)position[0], (float)position[1], (float)position[2]); break; } case (udProjectGeometryType.udPGT_MultiPoint): //!<Array of udPGT_Point, pCoordinates is an array of 3D positions. if (!(projectNode.nodeData.geomCount == 0)) { //create a child object for each geometry object double[] positions = new double[projectNode.nodeData.geomCount * 3]; Marshal.Copy(projectNode.nodeData.pCoordinates, positions, 0, projectNode.nodeData.geomCount * 3); for (int i = 0; i < projectNode.nodeData.geomCount; i++) { GameObject pointGO = new GameObject(); double[] position = new double[3]; position[0] = positions[3 * i]; position[1] = positions[3 * i + 1]; position[2] = positions[3 * i + 2]; pointGO.transform.parent = transform; pointGO.transform.position = new Vector3((float)position[0], (float)position[1], (float)position[2]); pointGO.name = "Point " + i.ToString(); } } break; case (udProjectGeometryType.udPGT_LineString): //!<pCoordinates is an array of 3D positions forming an open line LineRenderer lr = gameObject.AddComponent <LineRenderer>(); lr.positionCount = projectNode.nodeData.geomCount; Vector3[] verts = new Vector3[projectNode.nodeData.geomCount]; if (!(projectNode.nodeData.geomCount == 0)) { //create a child object for each geometry object double[] positions = new double[projectNode.nodeData.geomCount * 3]; Marshal.Copy(projectNode.nodeData.pCoordinates, positions, 0, projectNode.nodeData.geomCount * 3); for (int i = 0; i < projectNode.nodeData.geomCount; i++) { GameObject pointGO = new GameObject(); double[] position = new double[3]; position[0] = positions[3 * i]; position[1] = positions[3 * i + 1]; position[2] = positions[3 * i + 2]; pointGO.transform.parent = transform; Vector3 posVec = new Vector3((float)position[0], (float)position[1], (float)position[2]); pointGO.transform.position = posVec; verts[i] = posVec; pointGO.name = "Point " + i.ToString(); } } lr.SetPositions(verts); break; case (udProjectGeometryType.udPGT_MultiLineString): //!<Array of udPGT_LineString; pCoordinates is NULL and children will be present. break; case (udProjectGeometryType.udPGT_Polygon): //!<pCoordinates will be a closed linear ring (the outside), there MAY be children that are interior as pChildren udPGT_MultiLineString items, these should be counted as islands of the external ring. break; case (udProjectGeometryType.udPGT_MultiPolygon): //!<pCoordinates is null, children will be udPGT_Polygon (which still may have internal islands) break; case (udProjectGeometryType.udPGT_GeometryCollection): //!<Array of geometries; pCoordinates is NULL and children may be present of any type. break; } //create sibling if (projectNode.nodeData.pNextSibling != System.IntPtr.Zero) { nextSibling = new GameObject(); nextSibling.transform.parent = transform.parent; var nextSiblingData = nextSibling.AddComponent <udProjectNodeUnity>(); nextSiblingData.LoadTree(projectNode.nodeData.pNextSibling); } //create a child (if exists) if (projectNode.nodeData.pFirstChild != System.IntPtr.Zero) { firstChild = new GameObject(); firstChild.transform.parent = transform; var firstChildData = firstChild.AddComponent <udProjectNodeUnity>(); firstChildData.LoadTree(projectNode.nodeData.pFirstChild); } }
private void FillContacts(UDSEntityDto entityDto, UDSModel model) { if (model.Model.Contacts.IsNullOrEmpty()) { return; } ICollection <WebAPIDto <UDSContact> > result = WebAPIImpersonatorFacade.ImpersonateFinder(UDSContactFinder, (impersonationType, finder) => { finder.ResetDecoration(); finder.IdUDS = entityDto.Id; finder.EnablePaging = false; finder.ExpandRelation = true; return(finder.DoSearch()); }); if (result == null || !result.Select(s => s.Entity).Any()) { return; } entityDto.Contacts = result.Select(s => s.Entity).Select(s => new UDSEntityContactDto() { ContactManual = s.ContactManual, ContactType = (Helpers.UDS.UDSContactType)s.ContactType, IdContact = s.Relation?.EntityId, UDSContactId = s.UniqueId, Label = s.ContactLabel }).ToList(); foreach (Contacts modelContacts in model.Model.Contacts) { IList <UDSEntityContactDto> contacts = entityDto.Contacts.Where(x => x.Label.Eq(modelContacts.Label)).ToList(); if (contacts == null || !contacts.Any()) { continue; } foreach (UDSEntityContactDto contact in contacts) { if (contact.ContactType == Helpers.UDS.UDSContactType.Contact) { if (contact.IdContact.HasValue) { ContactInstance newInstance = new ContactInstance() { IdContact = contact.IdContact.Value }; modelContacts.ContactInstances = (modelContacts.ContactInstances ?? Enumerable.Empty <ContactInstance>()).Concat(new ContactInstance[] { newInstance }).ToArray(); } } else { ContactManualInstance newManualInstance = new ContactManualInstance() { ContactDescription = contact.ContactManual }; modelContacts.ContactManualInstances = (modelContacts.ContactManualInstances ?? Enumerable.Empty <ContactManualInstance>()).Concat(new ContactManualInstance[] { newManualInstance }).ToArray(); } } } }
public DocumentInfo GetDocumentUnitChainsDocuments(ICollection <DocumentUnitChain> documentUnitChains, IDictionary <Model.Entities.DocumentUnits.ChainType, string> seriesCaptionLabel, bool?forceAuthorization = null) { if (documentUnitChains != null && documentUnitChains.Count > 0) { DocumentUnit documentUnit = documentUnitChains.First().DocumentUnit; FolderInfo mainFolder = new FolderInfo { Name = $"{documentUnit.DocumentUnitName} {documentUnit.Title}", ID = documentUnit.UniqueId.ToString() }; FolderInfo folderDoc; BiblosDocumentInfo[] docs; string folderName; foreach (DocumentUnitChain chain in documentUnitChains.Where(f => f.ChainType <= ChainType.UnpublishedAnnexedChain || f.ChainType == ChainType.DematerialisationChain).OrderBy(x => x.ChainType)) { docs = null; folderDoc = new FolderInfo { Parent = mainFolder }; folderName = string.Empty; switch (chain.ChainType) { case ChainType.MainChain: { folderName = "Documento"; if (documentUnit.Environment == (int)Data.DSWEnvironment.DocumentSeries && seriesCaptionLabel.ContainsKey(Model.Entities.DocumentUnits.ChainType.MainChain)) { folderName = seriesCaptionLabel[Model.Entities.DocumentUnits.ChainType.MainChain]; } folderDoc.Name = folderName; break; } case ChainType.AttachmentsChain: { folderDoc.Name = "Allegati (parte integrante)"; break; } case ChainType.AnnexedChain: { folderName = "Annessi (non parte integrante)"; if (documentUnit.Environment == (int)Data.DSWEnvironment.DocumentSeries && seriesCaptionLabel.ContainsKey(Model.Entities.DocumentUnits.ChainType.AnnexedChain)) { folderName = seriesCaptionLabel[Model.Entities.DocumentUnits.ChainType.AnnexedChain]; } folderDoc.Name = folderName; break; } case ChainType.UnpublishedAnnexedChain: { folderName = "Annessi non pubblicati"; if (documentUnit.Environment == (int)Data.DSWEnvironment.DocumentSeries && seriesCaptionLabel.ContainsKey(Model.Entities.DocumentUnits.ChainType.UnpublishedAnnexedChain)) { folderName = seriesCaptionLabel[Model.Entities.DocumentUnits.ChainType.UnpublishedAnnexedChain]; } folderDoc.Name = folderName; break; } case ChainType.DematerialisationChain: { folderDoc.Name = "Attestazione di conformità"; break; } default: break; } docs = BiblosDocumentInfo.GetDocuments(chain.IdArchiveChain).ToArray(); if (docs != null) { //TODO: attributi da non salvare in Biblos foreach (BiblosDocumentInfo doc in docs) { doc.AddAttribute(BIBLOS_ATTRIBUTE_Environment, documentUnit.Environment.ToString()); doc.AddAttribute(BIBLOS_ATTRIBUTE_Year, documentUnit.Year.ToString()); doc.AddAttribute(BIBLOS_ATTRIBUTE_Number, documentUnit.Number.ToString()); doc.AddAttribute(BIBLOS_ATTRIBUTE_UniqueId, documentUnit.UniqueId.ToString()); if (chain.DocumentUnit != null && chain.DocumentUnit.UDSRepository != null) { UDSModel model = UDSModel.LoadXml(chain.DocumentUnit.UDSRepository.ModuleXML); if (!model.Model.StampaConformeEnabled) { doc.AddAttribute(BIBLOS_ATTRIBUTE_Disabled, bool.TrueString); } } if (forceAuthorization.HasValue && forceAuthorization.Value) { doc.AddAttribute(BIBLOS_ATTRIBUTE_UserVisibilityAuthorized, bool.TrueString); } } folderDoc.AddChildren(docs); } } return(mainFolder); } return(null); }
public static DocumentInfo GetUDSTreeDocuments(UDSDto udsSource, Action <BiblosDocumentInfo, Helpers.UDS.UDSDocumentType> documentOptionsAction) { UDSModel udsModel = udsSource.UDSModel; FolderInfo mainFolder = new FolderInfo() { Name = string.Concat(udsModel.Model.Title, " ", udsSource.FullNumber), ID = JsonConvert.SerializeObject(new KeyValuePair <string, Guid>(udsModel.Model.Title, udsSource.Id)) }; // Documento principale BiblosDocumentInfo[] docs = FillUDSDocuments(udsModel.Model.Documents.Document); if (documentOptionsAction != null) { docs.ToList().ForEach(f => documentOptionsAction(f, Helpers.UDS.UDSDocumentType.Main)); } if (docs.Length > 0) { FolderInfo folderDoc = new FolderInfo() { Name = udsModel.Model.Documents.Document.Label, Parent = mainFolder }; folderDoc.AddChildren(docs); } // Allegati BiblosDocumentInfo[] attachments = FillUDSDocuments(udsModel.Model.Documents.DocumentAttachment); if (documentOptionsAction != null) { attachments.ToList().ForEach(f => documentOptionsAction(f, Helpers.UDS.UDSDocumentType.Attachment)); } if (attachments.Length > 0) { FolderInfo folderAtt = new FolderInfo() { Name = udsModel.Model.Documents.DocumentAttachment.Label, Parent = mainFolder }; folderAtt.AddChildren(attachments); } // Allegati non parte integrante (Annessi) BiblosDocumentInfo[] annexes = FillUDSDocuments(udsModel.Model.Documents.DocumentAnnexed); if (documentOptionsAction != null) { annexes.ToList().ForEach(f => documentOptionsAction(f, Helpers.UDS.UDSDocumentType.Annexed)); } if (annexes.Length > 0) { FolderInfo folderAnnexed = new FolderInfo() { Name = udsModel.Model.Documents.DocumentAnnexed.Label, Parent = mainFolder }; folderAnnexed.AddChildren(annexes); } // Dematerializzazione (Attestazione di conformità) BiblosDocumentInfo[] dematerialisation = FillUDSDocuments(udsModel.Model.Documents.DocumentDematerialisation); if (documentOptionsAction != null) { dematerialisation.ToList().ForEach(f => documentOptionsAction(f, Helpers.UDS.UDSDocumentType.Dematerialisation)); } if (dematerialisation.Length > 0) { FolderInfo folderDematerialisation = new FolderInfo() { Name = udsModel.Model.Documents.DocumentDematerialisation.Label, Parent = mainFolder }; folderDematerialisation.AddChildren(dematerialisation); } return(mainFolder); }
public UDSTableBuilder(UDSModel uds, string dbSchema = "dbo") { _uds = uds; _tableName = string.Concat(UDSTablePrefix, Utils.SafeSQLName(uds.Model.Title)); _dbSchema = dbSchema; }
public UDSRelationFacade(UDSModel uds, string dbSchema = "dbo") { _uds = uds; _builder = new UDSTableBuilder(UDS, dbSchema); }