Пример #1
0
 public PublicationRunner(ILogService log,
                          ITime time,
                          IDbFactory dbFactory,
                          PublishingMode mode)
 {
     _log       = log;
     _time      = time;
     _dbFactory = dbFactory;
     _mode      = mode;
 }
Пример #2
0
 public PublicationRunnerActionBased(ILogService log,
                                     ITime time,
                                     IDbFactory dbFactory,
                                     ISystemActionService actionService,
                                     PublishingMode mode)
 {
     _log           = log;
     _time          = time;
     _dbFactory     = dbFactory;
     _actionService = actionService;
     _mode          = mode;
 }
Пример #3
0
        internal ContentBlockReferenceDto(IBlock contentBlock, PublishingMode publishingMode)
        {
            Id = contentBlock.ContentBlockId;

            // if the CBID is the Mod-Id, then it's part of page
            PartOfPage = contentBlock.ParentId == contentBlock.ContentBlockId;

            PublishingMode = publishingMode.ToString();

            // try to get more information about the block
            if (!((contentBlock as BlockFromEntity)?.Entity is EntityInBlock specsEntity))
            {
                return;
            }
            ParentGuid  = specsEntity.Parent;
            ParentField = specsEntity.Field;
            ParentIndex = specsEntity.SortOrder;
        }
Пример #4
0
        public PublishingMode Requirements(int instanceId)
        {
            var wrapLog = Log.Call <PublishingMode>($"{instanceId}");

            if (_cache.ContainsKey(instanceId))
            {
                return(wrapLog("in cache", _cache[instanceId]));
            }

            Log.Add($"Requirements(mod:{instanceId}) - checking first time (others will be cached)");
            try
            {
                PublishingMode decision = PublishingMode.DraftOptional;
                _cache.Add(instanceId, decision);
                return(wrapLog("decision: ", decision));
            }
            catch
            {
                Log.Add("Requirements had exception!");
                throw;
            }
        }
Пример #5
0
        /// <summary>
        /// хеш код по всей глубине контена с учетом того что могут быть циклы
        /// </summary>
        /// <param name="visitedContents">родительские контенты</param>
        internal int GetRecurciveHashCode(ReferenceHashSet <Content> visitedContents)
        {
            if (visitedContents.Contains(this))
            {
                return(HashHelper.CombineHashCodes(ContentId.GetHashCode(), visitedContents.Count.GetHashCode()));
            }

            visitedContents.Add(this);

            int hash = PublishingMode.GetHashCode();

            hash = HashHelper.CombineHashCodes(hash, IsReadOnly.GetHashCode());
            hash = HashHelper.CombineHashCodes(hash, LoadAllPlainFields.GetHashCode());
            hash = HashHelper.CombineHashCodes(hash, ContentId.GetHashCode());

            foreach (Field field in Fields.OrderBy(x => x.FieldId))
            {
                int fieldHash = field.GetRecurciveHashCode(visitedContents);
                hash = HashHelper.CombineHashCodes(hash, fieldHash);
            }

            return(hash);
        }
Пример #6
0
 internal ClientInfoContentBlock(IBlock contentBlock, string parentFieldName, int indexInField, PublishingMode versioningRequirements)
 {
     ShowTemplatePicker = contentBlock.ShowTemplateChooser;
     IsEntity           = contentBlock.ParentIsEntity;
     Id = contentBlock.ContentBlockId;
     ParentFieldName        = parentFieldName;
     ParentFieldSortOrder   = indexInField;
     VersioningRequirements = versioningRequirements.ToString();
     PartOfPage             = contentBlock.ParentId == contentBlock.ContentBlockId; // if the CBID is the moduleId, then it's part of page
 }
Пример #7
0
        internal ClientInfoContentBlock(IBlock contentBlock, string parentFieldName, int indexInField, PublishingMode versioningRequirements)
        {
            Id = contentBlock.ContentBlockId;
            ParentFieldName        = parentFieldName;
            ParentFieldSortOrder   = indexInField;
            VersioningRequirements = versioningRequirements.ToString();

            // if the CBID is the Mod-Id, then it's part of page
            PartOfPage = contentBlock.ParentId == contentBlock.ContentBlockId;
        }