Inheritance: SenseNet.ContentRepository.Storage.NodeSaveSettings
Esempio n. 1
0
        public virtual void Reject()
        {
            var action = SavingAction.Create(this);

            action.Reject();
            action.Execute();
        }
Esempio n. 2
0
        public virtual void Publish()
        {
            var action = SavingAction.Create(this);

            action.Publish();
            action.Execute();
        }
Esempio n. 3
0
        public virtual void Approve()
        {
            var action = SavingAction.Create(this);

            action.Approve();
            action.Execute();
        }
Esempio n. 4
0
        public virtual void CheckIn()
        {
            var action = SavingAction.Create(this);

            action.CheckIn();
            action.Execute();
        }
Esempio n. 5
0
        public void UndoCheckOut(bool forceRefresh = true)
        {
            var action = SavingAction.Create(this);

            action.UndoCheckOut(forceRefresh);
            action.Execute();
        }
Esempio n. 6
0
        public virtual void SaveSameVersion()
        {
            var action = SavingAction.Create(this);

            action.SaveSameVersion();
            action.Execute();
        }
Esempio n. 7
0
        public static Node CreateFromTemplate(Node target, Node template, string name)
        {
            var           newNode = template.MakeTemplatedCopy(target, name);
            VersionNumber version = null;

            //compute new version number according to the versioning
            //and approving settings in the target folder
            var gc = newNode as GenericContent;

            if (gc != null)
            {
                version = SavingAction.ComputeNewVersion(gc.ApprovingMode == ApprovingType.True, gc.VersioningMode);
            }
            else
            {
                //TODO: handle non-GenericContent scenarios
            }

            if (version != null)
            {
                newNode.Version = version;
            }

            newNode.Template = template;

            return(newNode);
        }
Esempio n. 8
0
        //==================================================== Versioning & Approving ====================================================

        private void VersionSetup()
        {
            if (this.Id == 0)
            {
                this.Version = SavingAction.ComputeNewVersion(this.HasApproving, this.VersioningMode);
            }
        }
Esempio n. 9
0
        private static SavingAction CreateForNode(Node node)
        {
            var savingAction = new SavingAction
            {
                Node           = node,
                VersioningMode = VersioningMode.None,
                HasApproving   = false
            };

            return(savingAction);
        }
Esempio n. 10
0
        public static bool HasUndoCheckOut(GenericContent node)
        {
            if (HasForceUndoCheckOutRight(node))
            {
                return(false);
            }

            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.UndoCheckOut) == ActionValidationResult.Valid);
        }
Esempio n. 11
0
        private static SavingAction CreateForNode(Node node)
        {
            var savingAction = new SavingAction
            {
                Node = node,
                VersioningMode = VersioningMode.None,
                HasApproving = false
            };

            return savingAction;
        }
Esempio n. 12
0
        private static SavingAction CreateForGenericContent(GenericContent genericContent)
        {
            var mode = VersioningMode.None;
            switch (genericContent.VersioningMode)
            {
                case VersioningType.MajorOnly: mode = VersioningMode.Major; break;
                case VersioningType.MajorAndMinor: mode = VersioningMode.Full; break;
            }
            var savingAction = new SavingAction
            {
                Node = genericContent,
                VersioningMode = mode,
                HasApproving = genericContent.HasApproving
            };

            return savingAction;
        }
Esempio n. 13
0
        private static SavingAction CreateForGenericContent(GenericContent genericContent)
        {
            var mode = VersioningMode.None;

            switch (genericContent.VersioningMode)
            {
            case VersioningType.MajorOnly: mode = VersioningMode.Major; break;

            case VersioningType.MajorAndMinor: mode = VersioningMode.Full; break;
            }
            var savingAction = new SavingAction
            {
                Node           = genericContent,
                VersioningMode = mode,
                HasApproving   = genericContent.HasApproving
            };

            return(savingAction);
        }
Esempio n. 14
0
        public virtual void Save(SavingMode mode)
        {
            var action = SavingAction.Create(this);

            switch (mode)
            {
            case SavingMode.RaiseVersion:
                action.CheckOutAndSaveAndCheckIn();
                break;

            case SavingMode.RaiseVersionAndLock:
                action.CheckOutAndSave();
                break;

            case SavingMode.KeepVersion:
                action.SaveSameVersion();
                break;

            default:
                throw new NotImplementedException("Unknown SavingMode: " + mode);
            }
            action.Execute();
        }
Esempio n. 15
0
        public static bool HasReject(GenericContent node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.Reject) == ActionValidationResult.Valid);
        }
Esempio n. 16
0
        public static bool HasCheckIn(Node node)
        {
            var s = SavingAction.Create(node);

            return(s.ValidateAction(StateAction.CheckIn) == ActionValidationResult.Valid);
        }