Ejemplo n.º 1
0
        public string GetBookPageByXmlId(string bookGuid, string pageXmlId, OutputFormatEnumContract resultFormat,
                                         BookTypeEnumContract bookTypeContract)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("Start MainService (BookManager) get page xmlId '{0}' of book '{1}'", pageXmlId,
                                  bookGuid);
            }

            m_authorizationManager.AuthorizeBook(bookGuid);

            OutputFormat outputFormat;

            if (!Enum.TryParse(resultFormat.ToString(), true, out outputFormat))
            {
                throw new ArgumentException(string.Format("Result format : '{0}' unknown", resultFormat));
            }

            BookTypeEnum bookType;

            if (!Enum.TryParse(bookTypeContract.ToString(), true, out bookType))
            {
                throw new ArgumentException(string.Format("Book type : '{0}' unknown", bookTypeContract));
            }

            var bookVersion         = m_bookRepository.GetLastVersionForBookWithType(bookGuid);
            var transformation      = m_bookRepository.FindTransformation(bookVersion, outputFormat, bookType);
            var transformationName  = transformation.Name;
            var transformationLevel = (ResourceLevelEnumContract)transformation.ResourceLevel;
            var pageText            = m_searchServiceClient.GetBookPageByXmlId(bookGuid, bookVersion.VersionId, pageXmlId,
                                                                               transformationName, resultFormat, transformationLevel);

            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("End MainService (BookManager) get page xmlId '{0}' of book '{1}'", pageXmlId,
                                  bookGuid);
            }

            return(pageText);
        }
Ejemplo n.º 2
0
        public string GetDictionaryEntryByXmlId(string bookGuid, string xmlEntryId,
                                                OutputFormatEnumContract resultFormat, BookTypeEnumContract bookTypeContract)
        {
            m_authorizationManager.AuthorizeBook(bookGuid);

            OutputFormat outputFormat;

            if (!Enum.TryParse(resultFormat.ToString(), true, out outputFormat))
            {
                throw new ArgumentException(string.Format("Result format : '{0}' unknown", resultFormat));
            }

            var bookType            = Mapper.Map <BookTypeEnum>(bookTypeContract);
            var bookVersion         = m_bookRepository.GetLastVersionForBookWithType(bookGuid);
            var transformation      = m_bookRepository.FindTransformation(bookVersion, outputFormat, bookType);
            var transformationName  = transformation.Name;
            var transformationLevel = (ResourceLevelEnumContract)transformation.ResourceLevel;
            var dictionaryEntryText = m_searchServiceClient.GetDictionaryEntryByXmlId(bookGuid, bookVersion.VersionId,
                                                                                      xmlEntryId, transformationName, resultFormat, transformationLevel);

            return(dictionaryEntryText);
        }
Ejemplo n.º 3
0
        public string GetBookEditionNote(long bookId, OutputFormatEnumContract resultFormat)
        {
            m_authorizationManager.AuthorizeBook(bookId);

            OutputFormat outputFormat;

            if (!Enum.TryParse(resultFormat.ToString(), true, out outputFormat))
            {
                throw new ArgumentException(string.Format("Result format : '{0}' unknown", resultFormat));
            }

            var book                = m_bookRepository.FindBookById(bookId);
            var bookVersion         = m_bookRepository.GetLastVersionForBookByBookId(bookId);
            var bookType            = m_bookVersionRepository.GetBookTypeByBookVersionId(bookVersion.Id);
            var transformation      = m_bookRepository.FindTransformation(bookVersion, outputFormat, bookType.Type);
            var transformationName  = transformation.Name;
            var transformationLevel = (ResourceLevelEnumContract)transformation.ResourceLevel;

            var editionNoteText = m_searchServiceClient.GetBookEditionNote(book.Guid, bookVersion.VersionId,
                                                                           transformationName, resultFormat, transformationLevel);

            return(editionNoteText);
        }
Ejemplo n.º 4
0
        public string GetEditionPageFromSearch(IEnumerable <SearchCriteriaContract> searchCriterias, string bookXmlId, string pageXmlId,
                                               OutputFormatEnumContract resultFormat)
        {
            var criterias = searchCriterias.ToList();

            m_authorizationManager.AuthorizeCriteria(criterias);

            OutputFormat outputFormat;

            if (!Enum.TryParse(resultFormat.ToString(), true, out outputFormat))
            {
                throw new ArgumentException(string.Format("Result format : '{0}' unknown", resultFormat));
            }

            var bookVersion    = m_bookRepository.GetLastVersionForBookWithType(bookXmlId);
            var transformation = m_bookRepository.FindTransformation(bookVersion, outputFormat,
                                                                     bookVersion.DefaultBookType.Type); //TODO add bookType as method parameter
            var transformationName  = transformation.Name;
            var transformationLevel = (ResourceLevelEnumContract)transformation.ResourceLevel;
            var pageText            = m_searchServiceClient.GetEditionPageFromSearch(criterias,
                                                                                     bookXmlId, bookVersion.VersionId, pageXmlId, transformationName, resultFormat, transformationLevel);

            return(pageText);
        }