Exemplo n.º 1
0
        /// <summary>
        /// Updates Code Lists allowed values. Deletes existing values that are not in provided in the list.
        /// </summary>
        /// <param name="codeListCofinguration">Code List configuration of values</param>
        /// <returns>Updates Code List with values.</returns>
        private async Task <CodeListUpdateValuesARM> CodeListUpdateValues(CodeListFileContent codeListCofinguration)
        {
            var newValues = new CodeListUpdateValuesAM();

            newValues.AllowedValues.AddRange(codeListCofinguration.Values.Select(x => x.Name));

            return(await _alfrescoHttpClient.CodeListUpdateValues(codeListCofinguration.Name, newValues));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new Code List with provided values and sets proper authority for each value.
        /// </summary>
        /// <param name="codeListCofinguration">Configuration model of the new code list</param>
        /// <returns></returns>
        private async Task <CodeListCreateARM> CodeListCreate(CodeListFileContent codeListCofinguration)
        {
            var newCodeList = new CodeListCreateAM
            {
                Name          = codeListCofinguration.Name,
                Title         = codeListCofinguration.Title,
                AllowedValues = codeListCofinguration.Values.Select(x => x.Name).ToArray()
            };

            var result = await _alfrescoHttpClient.CodeListCreate(newCodeList);

            await UpdateValueWithAuthority(codeListCofinguration);

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates Code List allowed values authorities based on provided list.
        /// </summary>
        /// <param name="codeListCofinguration">Code List configuration of values</param>
        /// <returns>Updated Code List with values and authorities</returns>
        private async Task <CodeListUpdateValuesAthoritiesARM> UpdateValueWithAuthority(CodeListFileContent codeListCofinguration)
        {
            var updateModel = new CodeListUpdateValuesAuthorityAM();

            updateModel.Values.AddRange(from content in codeListCofinguration.Values select new CodeListValueWithAuthority
            {
                Value       = content.Name,
                Authorities = content.Authorities
            });

            return(await _alfrescoHttpClient.CodeListUpdateValuesWithAuthority(codeListCofinguration.Name, updateModel));
        }