private CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel) {
     Assert.AssertNotNull(lifecycleManager);
     Assert.AssertNotNull(nakedObjectManager);
     this.lifecycleManager = lifecycleManager;
     this.nakedObjectManager = nakedObjectManager;
     this.metamodel = metamodel;
 }
Exemple #2
0
        public OneToManyAssociationSpec(IMetamodelManager metamodel, IOneToManyAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager, IObjectPersistor persistor)
            : base(metamodel, association, session, lifecycleManager, manager) {
            this.persistor = persistor;
            isASet = association.ContainsFacet<IIsASetFacet>();

            elementSpec = MetamodelManager.GetSpecification(association.ElementSpec);
        }
Exemple #3
0
        protected AssociationSpecAbstract(IMetamodelManager metamodel, IAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager)
            : base(association.Identifier.MemberName, association, session, lifecycleManager, metamodel) {
            Assert.AssertNotNull(manager);

            this.manager = manager;
            returnSpec = MetamodelManager.GetSpecification(association.ReturnSpec);
        }
 public ViewModelOid(IMetamodelManager metamodel, IObjectSpec spec) {
     Assert.AssertNotNull(metamodel);
     this.metamodel = metamodel;
     IsTransient = false;
     TypeName = TypeNameUtils.EncodeTypeName(spec.FullName);
     Keys = new[] {Guid.NewGuid().ToString()};
     CacheState();
 }
Exemple #5
0
        public ConcurrencyCheckVersion(IMetamodelManager metamodel, string[] strings) {
            Assert.AssertNotNull(metamodel);
            var helper = new StringDecoderHelper(metamodel, strings);

            user = helper.GetNextString();
            time = new DateTime(helper.GetNextLong());
            version = helper.GetNextObject();
        }
Exemple #6
0
 public static bool IsVisible(ISpecification specification, IInteractionContext ic, ILifecycleManager lifecycleManager, IMetamodelManager manager) {
     var buf = new InteractionBuffer();
     IEnumerable<IHidingInteractionAdvisor> facets = specification.GetFacets().Where(f => f is IHidingInteractionAdvisor).Cast<IHidingInteractionAdvisor>();
     foreach (IHidingInteractionAdvisor advisor in facets) {
         buf.Append(advisor.Hides(ic, lifecycleManager, manager));
     }
     return IsVisible(buf);
 }
 public override INakedObjectAdapter Invoke(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameters, int resultPage, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager) {
     profileManager.Begin(session, ProfileEvent.ActionInvocation, identifier.MemberName, nakedObjectAdapter, lifecycleManager);
     try {
         return underlyingFacet.Invoke(nakedObjectAdapter, parameters, resultPage, lifecycleManager, manager, session, nakedObjectManager, messageBroker, transactionManager);
     }
     finally {
         profileManager.End(session, ProfileEvent.ActionInvocation, identifier.MemberName, nakedObjectAdapter, lifecycleManager);
     }
 }
 public override void Invoke(INakedObjectAdapter nakedObjectAdapter, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager) {
     profileManager.Begin(session, associatedEvent, "", nakedObjectAdapter, lifecycleManager);
     try {
         underlyingFacet.Invoke(nakedObjectAdapter, session, lifecycleManager, metamodelManager);
     }
     finally {
         profileManager.End(session, associatedEvent, "", nakedObjectAdapter, lifecycleManager);
     }
 }
 public AggregateOid(IMetamodelManager metamodel, string[] strings) {
     Assert.AssertNotNull(metamodel);
     this.metamodel = metamodel;
     var helper = new StringDecoderHelper(metamodel, strings);
     typeName = helper.GetNextString();
     fieldName = helper.GetNextString();
     if (helper.HasNext) {
         parentOid = (IOid) helper.GetNextEncodedToStrings();
     }
 }
 public TestObjectFactory(IMetamodelManager metamodelManager, ISession session, ILifecycleManager lifecycleManager, IObjectPersistor persistor, INakedObjectManager manager, ITransactionManager transactionManager, IServicesManager servicesManager, IMessageBroker messageBroker) {
     this.metamodelManager = metamodelManager;
     Session = session;
     this.lifecycleManager = lifecycleManager;
     this.persistor = persistor;
     this.manager = manager;
     this.transactionManager = transactionManager;
     this.servicesManager = servicesManager;
     this.messageBroker = messageBroker;
 }
        public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, INakedObjectAdapter target, IActionSpec actionSpec, INakedObjectAdapter[] parameters)
            : this(lifecycleManager, nakedObjectManager, metamodel) {
            Target = target;
            Action = actionSpec;
            Parameters = parameters;

            if (Target.Spec.IsViewModel) {
                lifecycleManager.PopulateViewModelKeys(Target);
            }
        }
        public AggregateOid(IMetamodelManager metamodel, IOid oid, string id, string typeName) {
            Assert.AssertNotNull(metamodel);
            Assert.AssertNotNull(oid);
            Assert.AssertNotNull(id);
            Assert.AssertNotNull(typeName);

            this.metamodel = metamodel;
            parentOid = oid;
            fieldName = id;
            this.typeName = typeName;
        }
        public ViewModelOid(IMetamodelManager metamodel, string[] strings) {
            Assert.AssertNotNull(metamodel);
            this.metamodel = metamodel;
            var helper = new StringDecoderHelper(metamodel, strings);
            TypeName = helper.GetNextString();

            Keys = helper.HasNext ? helper.GetNextArray() : new[] {Guid.NewGuid().ToString()};

            IsTransient = false;
            CacheState();
        }
        public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, CollectionMemento otherMemento, object[] selectedObjects)
            : this(lifecycleManager, nakedObjectManager, metamodel) {
            Assert.AssertNotNull(otherMemento);

            IsPaged = otherMemento.IsPaged;
            IsNotQueryable = otherMemento.IsNotQueryable;
            Target = otherMemento.Target;
            Action = otherMemento.Action;
            Parameters = otherMemento.Parameters;
            SelectedObjects = selectedObjects;
        }
 public TestAction(IMetamodelManager metamodelManager, ISession session, ILifecycleManager lifecycleManager, ITransactionManager transactionManager, string contributor, IActionSpec actionSpec, ITestHasActions owningObject, ITestObjectFactory factory, INakedObjectManager manager, IMessageBroker messageBroker) {
     SubMenu = contributor;
     this.metamodelManager = metamodelManager;
     this.session = session;
     this.lifecycleManager = lifecycleManager;
     this.transactionManager = transactionManager;
     this.messageBroker = messageBroker;
     this.owningObject = owningObject;
     this.factory = factory;
     this.manager = manager;
     this.actionSpec = actionSpec;
 }
        public NakedObjectManager(IMetamodelManager metamodel, ISession session, IIdentityMap identityMap, IOidGenerator oidGenerator, NakedObjectFactory nakedObjectFactory) {
            Assert.AssertNotNull(metamodel);
            Assert.AssertNotNull(session);
            Assert.AssertNotNull(identityMap);
            Assert.AssertNotNull(oidGenerator);
            Assert.AssertNotNull(nakedObjectFactory);

            this.metamodel = metamodel;
            this.session = session;
            this.identityMap = identityMap;
            this.oidGenerator = oidGenerator;
            this.nakedObjectFactory = nakedObjectFactory;
        }
Exemple #17
0
 public static bool IsVisibleWhenPersistent(ISpecification specification, IInteractionContext ic, ILifecycleManager lifecycleManager, IMetamodelManager manager) {
     var buf = new InteractionBuffer();
     IEnumerable<IHidingInteractionAdvisor> facets = specification.GetFacets().Where(f => f is IHidingInteractionAdvisor).Cast<IHidingInteractionAdvisor>();
     foreach (IHidingInteractionAdvisor advisor in facets) {
         var facet = advisor as IHiddenFacet;
         if (facet != null) {
             if (facet.Value == WhenTo.OncePersisted) {
                 continue;
             }
         }
         buf.Append(advisor.Hides(ic, lifecycleManager, manager));
     }
     return IsVisible(buf);
 }
        // ReSharper disable ParameterHidesMember
        public void Initialize(IMetamodelManager metamodelManager, ISession session, ILifecycleManager lifecycleManager, IObjectPersistor persistor, INakedObjectManager nakedObjectManager) {
            // ReSharper restore ParameterHidesMember
            Assert.AssertNotNull(metamodelManager);
            Assert.AssertNotNull(session);
            Assert.AssertNotNull(lifecycleManager);
            Assert.AssertNotNull(persistor);
            Assert.AssertNotNull(nakedObjectManager);

            this.metamodelManager = metamodelManager;
            this.session = session;
            this.lifecycleManager = lifecycleManager;
            this.persistor = persistor;
            this.nakedObjectManager = nakedObjectManager;
            isInitialized = true;
        }
Exemple #19
0
        public ActionSpec(SpecFactory memberFactory, IMetamodelManager metamodel, ILifecycleManager lifecycleManager, ISession session, IServicesManager servicesManager, INakedObjectManager nakedObjectManager, IActionSpecImmutable actionSpecImmutable, IMessageBroker messageBroker, ITransactionManager transactionManager)
            : base(actionSpecImmutable.Identifier.MemberName, actionSpecImmutable, session, lifecycleManager, metamodel) {
            Assert.AssertNotNull(memberFactory);
            Assert.AssertNotNull(servicesManager);
            Assert.AssertNotNull(nakedObjectManager);
            Assert.AssertNotNull(actionSpecImmutable);

            this.memberFactory = memberFactory;
            this.servicesManager = servicesManager;
            this.nakedObjectManager = nakedObjectManager;
            this.actionSpecImmutable = actionSpecImmutable;
            this.messageBroker = messageBroker;
            this.transactionManager = transactionManager;
            int index = 0;
            parametersSpec = this.actionSpecImmutable.Parameters.Select(pp => this.memberFactory.CreateParameter(pp, this, index++)).ToArray();
        }
        public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, string[] strings)
            : this(lifecycleManager, nakedObjectManager, metamodel) {
            var helper = new StringDecoderHelper(metamodel, strings, true);
            // ReSharper disable once UnusedVariable
            string specName = helper.GetNextString();
            string actionId = helper.GetNextString();
            var targetOid = (IOid) helper.GetNextEncodedToStrings();

            Target = RestoreObject(targetOid);
            Action = Target.GetActionLeafNode(actionId);

            var parameters = new List<INakedObjectAdapter>();

            while (helper.HasNext) {
                var parmType = helper.GetNextEnum<ParameterType>();

                switch (parmType) {
                    case ParameterType.Value:
                        object obj = helper.GetNextObject();
                        parameters.Add(nakedObjectManager.CreateAdapter(obj, null, null));
                        break;
                    case ParameterType.Object:
                        var oid = (IOid) helper.GetNextEncodedToStrings();
                        INakedObjectAdapter nakedObjectAdapter = RestoreObject(oid);
                        parameters.Add(nakedObjectAdapter);
                        break;
                    case ParameterType.ValueCollection:
                        Type vInstanceType;
                        IList<object> vColl = helper.GetNextValueCollection(out vInstanceType);
                        IList typedVColl = CollectionUtils.ToTypedIList(vColl, vInstanceType);
                        parameters.Add(nakedObjectManager.CreateAdapter(typedVColl, null, null));
                        break;
                    case ParameterType.ObjectCollection:
                        Type oInstanceType;
                        List<object> oColl = helper.GetNextObjectCollection(out oInstanceType).Cast<IOid>().Select(o => RestoreObject(o).Object).ToList();
                        IList typedOColl = CollectionUtils.ToTypedIList(oColl, oInstanceType);
                        parameters.Add(nakedObjectManager.CreateAdapter(typedOColl, null, null));
                        break;
                    default:
                        throw new ArgumentException(string.Format("Unexpected parameter type value: {0}", parmType));
                }
            }

            Parameters = parameters.ToArray();
        }
        public override INakedObjectAdapter Invoke(INakedObjectAdapter inObjectAdapter, INakedObjectAdapter[] parameters, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager) {
            if (parameters.Length != paramCount) {
                Log.Error(actionMethod + " requires " + paramCount + " parameters, not " + parameters.Length);
            }

            object result;
            if (actionDelegate != null) {
                result = actionDelegate(inObjectAdapter.GetDomainObject(), parameters.Select(no => no.GetDomainObject()).ToArray());
            }
            else {
                Log.WarnFormat("Invoking action via reflection as no delegate {0}.{1}", onType, actionMethod);
                result = InvokeUtils.Invoke(actionMethod, inObjectAdapter, parameters);
            }

            INakedObjectAdapter adaptedResult = nakedObjectManager.CreateAdapter(result, null, null);

            return adaptedResult;
        }
        // Start a snapshot at the root object, using supplied namespace manager.
        public XmlSnapshot(object obj, XmlSchema schema, INakedObjectManager nakedObjectManager, IMetamodelManager metamodelManager) {
            this.nakedObjectManager = nakedObjectManager;
            this.metamodelManager = metamodelManager;

            INakedObjectAdapter rootObjectAdapter = nakedObjectManager.CreateAdapter(obj, null, null);

            Schema = schema;

            try {
                XmlDocument = new XDocument();
                XsdDocument = new XDocument();

                XsdElement = XsMetaModel.CreateXsSchemaElement(XsdDocument);

                rootPlace = AppendXml(rootObjectAdapter);
            }
            catch (ArgumentException e) {
                throw new NakedObjectSystemException(Log.LogAndReturn("Unable to build snapshot"), e);
            }
        }
        // Start a snapshot at the root object, using supplied namespace manager.
        public XmlSnapshot(object obj, XmlSchema schema, INakedObjectManager nakedObjectManager, IMetamodelManager metamodelManager) {
            this.nakedObjectManager = nakedObjectManager;
            this.metamodelManager = metamodelManager;

            INakedObjectAdapter rootObjectAdapter = nakedObjectManager.CreateAdapter(obj, null, null);
            Log.Debug(".ctor(" + DoLog("rootObj", rootObjectAdapter) + AndLog("schema", schema) + AndLog("addOids", "" + true) + ")");

            Schema = schema;

            try {
                XmlDocument = new XDocument();
                XsdDocument = new XDocument();

                XsdElement = XsMetaModel.CreateXsSchemaElement(XsdDocument);

                rootPlace = AppendXml(rootObjectAdapter);
            }
            catch (ArgumentException e) {
                Log.Error("unable to build snapshot", e);
                throw new NakedObjectSystemException(e);
            }
        }
        public LifeCycleManager(
            IMetamodelManager metamodel,
            IPersistAlgorithm persistAlgorithm,
            IOidGenerator oidGenerator,
            IDomainObjectInjector injector,
            IObjectPersistor objectPersistor,
            INakedObjectManager nakedObjectManager
            ) {
            Assert.AssertNotNull(metamodel);
            Assert.AssertNotNull(persistAlgorithm);
            Assert.AssertNotNull(oidGenerator);
            Assert.AssertNotNull(injector);
            Assert.AssertNotNull(objectPersistor);
            Assert.AssertNotNull(nakedObjectManager);

            this.metamodel = metamodel;
            this.persistAlgorithm = persistAlgorithm;
            this.oidGenerator = oidGenerator;
            this.injector = injector;
            this.objectPersistor = objectPersistor;
            this.nakedObjectManager = nakedObjectManager;
        }
 public override void Invoke(INakedObjectAdapter nakedObjectAdapter, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager)
 {
 }
Exemple #26
0
        private bool IsEditableOrVisible(ISession session, ILifecycleManager lifecycleManager, IMetamodelManager manager, INakedObject target, IIdentifier identifier, string toInvoke)
        {
            Assert.AssertNotNull(target);

            object authorizer = GetTypeAuthorizerFor(target, lifecycleManager, manager) ?? GetDefaultAuthorizer(lifecycleManager, manager);

            return((bool)authorizer.GetType().GetMethod(toInvoke).Invoke(authorizer, new[] { session.Principal, target.Object, identifier.MemberName }));
        }
 public override INakedObjectAdapter Invoke(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameters, int resultPage, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager)
 {
     return(Invoke(nakedObjectAdapter, parameters, lifecycleManager, manager, session, nakedObjectManager, messageBroker, transactionManager));
 }
        public override INakedObjectAdapter Invoke(INakedObjectAdapter inObjectAdapter, INakedObjectAdapter[] parameters, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager)
        {
            if (parameters.Length != paramCount)
            {
                Log.Error(actionMethod + " requires " + paramCount + " parameters, not " + parameters.Length);
            }

            object result;

            if (actionDelegate != null)
            {
                result = actionDelegate(inObjectAdapter.GetDomainObject(), parameters.Select(no => no.GetDomainObject()).ToArray());
            }
            else
            {
                Log.WarnFormat("Invoking action via reflection as no delegate {0}.{1}", onType, actionMethod);
                result = InvokeUtils.Invoke(actionMethod, inObjectAdapter, parameters);
            }

            INakedObjectAdapter adaptedResult = nakedObjectManager.CreateAdapter(result, null, null);

            return(adaptedResult);
        }
Exemple #29
0
        protected internal MemberSpecAbstract(string id, IMemberSpecImmutable memberSpec, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager)
        {
            AssertArgNotNull(id, Resources.NakedObjects.NameNotSetMessage);
            AssertArgNotNull(memberSpec);
            AssertArgNotNull(session);
            AssertArgNotNull(lifecycleManager);

            this.id               = id;
            memberSpecImmutable   = memberSpec;
            this.session          = session;
            this.lifecycleManager = lifecycleManager;
            this.metamodelManager = metamodelManager;
        }
Exemple #30
0
 public OneToOneAssociationSpec(IMetamodelManager metamodel, IOneToOneAssociationSpecImmutable association, ISession session, ILifecycleManager lifecycleManager, INakedObjectManager manager, IObjectPersistor persistor, ITransactionManager transactionManager)
     : base(metamodel, association, session, lifecycleManager, manager)
 {
     this.persistor          = persistor;
     this.transactionManager = transactionManager;
 }
 public EntityOid(IMetamodelManager metamodel, Type type, object[] key, bool isTransient, ILogger <EntityOid> logger)
     : this(metamodel, type.FullName, key, logger)
 {
     IsTransient = isTransient;
     CacheState();
 }
Exemple #32
0
 public abstract string DisabledReason(ISession session, INakedObject target, ILifecycleManager lifecycleManager, IMetamodelManager manager);
 private object GetTypeAuthorizerFor(INakedObject target, ILifecycleManager lifecycleManager, IMetamodelManager manager) {
     Assert.AssertNotNull(target);
     Type domainType = TypeUtils.GetType(target.Spec.FullName).GetProxiedType();
     Type authorizer;
     typeAuthorizers.TryGetValue(domainType, out authorizer);
     return authorizer == null ? null : CreateAuthorizer(authorizer, lifecycleManager, manager);
 }
 //  Start a snapshot at the root object, using own namespace manager.
 public XmlSnapshot(object obj, INakedObjectManager nakedObjectManager, IMetamodelManager metamodelManager) : this(obj, new XmlSchema(), nakedObjectManager, metamodelManager) {}
 public override string HiddenReason(ISession session, INakedObjectAdapter target, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(FacetUtils.IsAllowed(session, roles, users) ? null : "Not authorized to view");
 }
 public OneToOneActionParameter(IMetamodelManager metamodel, int index, IActionSpec actionImpl, IActionParameterSpecImmutable actionParameterSpecImmutable, INakedObjectManager manager, ISession session, IObjectPersistor persistor)
     : base(metamodel, index, actionImpl, actionParameterSpecImmutable, manager, session, persistor)
 {
 }
 public override void Invoke(INakedObject nakedObject, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager)
 {
     manager.Persisted(nakedObject, session, lifecycleManager, metamodelManager);
     underlyingFacet.Invoke(nakedObject, session, lifecycleManager, metamodelManager);
 }
 public override void Invoke(INakedObject nakedObject, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager)
 {
     InvokeUtils.Invoke(method, nakedObject);
 }
Exemple #39
0
 public override void Invoke(INakedObjectAdapter nakedObjectAdapter, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager) => persistingDelegate(nakedObjectAdapter.GetDomainObject());
Exemple #40
0
 public TestAction(IMetamodelManager metamodelManager, ISession session, ILifecycleManager lifecycleManager, ITransactionManager transactionManager, IActionSpec actionSpec, ITestHasActions owningObject, ITestObjectFactory factory, INakedObjectManager manager, IMessageBroker messageBroker)
     : this(metamodelManager, session, lifecycleManager, transactionManager, string.Empty, actionSpec, owningObject, factory, manager, messageBroker)
 {
 }
 public override string HiddenReason(ISession session, INakedObject target, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(authorizationManager.IsVisible(session, lifecycleManager, manager, target, identifier)
         ? null
         : "Not authorized to view");
 }
Exemple #42
0
        private object GetTypeAuthorizerFor(INakedObject target, ILifecycleManager lifecycleManager, IMetamodelManager manager)
        {
            Assert.AssertNotNull(target);
            Type domainType = TypeUtils.GetType(target.Spec.FullName).GetProxiedType();
            Type authorizer;

            typeAuthorizers.TryGetValue(domainType, out authorizer);
            return(authorizer == null ? null : CreateAuthorizer(authorizer, lifecycleManager, manager));
        }
        public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, ILoggerFactory loggerFactory, ILogger <CollectionMemento> logger, string[] strings)
            : this(lifecycleManager, nakedObjectManager, metamodel, logger)
        {
            var helper = new StringDecoderHelper(metamodel, loggerFactory, loggerFactory.CreateLogger <StringDecoderHelper>(), strings, true);
            // ReSharper disable once UnusedVariable
            var specName  = helper.GetNextString();
            var actionId  = helper.GetNextString();
            var targetOid = (IOid)helper.GetNextEncodedToStrings();

            Target = RestoreObject(targetOid);
            Action = Target.GetActionLeafNode(actionId);

            var parameters = new List <INakedObjectAdapter>();

            while (helper.HasNext)
            {
                var parmType = helper.GetNextEnum <ParameterType>();

                switch (parmType)
                {
                case ParameterType.Value:
                    var obj = helper.GetNextObject();
                    parameters.Add(nakedObjectManager.CreateAdapter(obj, null, null));
                    break;

                case ParameterType.Object:
                    var oid = (IOid)helper.GetNextEncodedToStrings();
                    var nakedObjectAdapter = RestoreObject(oid);
                    parameters.Add(nakedObjectAdapter);
                    break;

                case ParameterType.ValueCollection:
                    var vColl      = helper.GetNextValueCollection(out var vInstanceType);
                    var typedVColl = CollectionUtils.ToTypedIList(vColl, vInstanceType);
                    parameters.Add(nakedObjectManager.CreateAdapter(typedVColl, null, null));
                    break;

                case ParameterType.ObjectCollection:
                    var oColl      = helper.GetNextObjectCollection(out var oInstanceType).Cast <IOid>().Select(o => RestoreObject(o).Object).ToList();
                    var typedOColl = CollectionUtils.ToTypedIList(oColl, oInstanceType);
                    parameters.Add(nakedObjectManager.CreateAdapter(typedOColl, null, null));
                    break;

                default:
                    throw new ArgumentException(logger.LogAndReturn($"Unexpected parameter type value: {parmType}"));
                }
            }

            Parameters = parameters.ToArray();
        }
Exemple #44
0
 public abstract INakedObject Invoke(INakedObject nakedObject, INakedObject[] parameters, int resultPage, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager);
Exemple #45
0
 public abstract INakedObjectAdapter Invoke(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameters, int resultPage, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager);
Exemple #46
0
 private object CreateAuthorizer(Type authorizer, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(lifecycleManager.CreateInstance(manager.GetSpecification(authorizer)).GetDomainObject());
 }
        public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, ILogger <CollectionMemento> logger, INakedObjectAdapter target, IActionSpec actionSpec, INakedObjectAdapter[] parameters)
            : this(lifecycleManager, nakedObjectManager, metamodel, logger)
        {
            Target     = target;
            Action     = actionSpec;
            Parameters = parameters;

            if (Target?.Spec.IsViewModel == true)
            {
                lifecycleManager.PopulateViewModelKeys(Target);
            }
        }
 public override string DisabledReason(ISession session, INakedObjectAdapter target, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(null);
 }
Exemple #49
0
 private object GetDefaultAuthorizer(ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(CreateAuthorizer(defaultAuthorizer, lifecycleManager, manager));
 }
Exemple #50
0
 public bool IsVisible(ISession session, ILifecycleManager lifecycleManager, IMetamodelManager manager, INakedObject target, IIdentifier identifier)
 {
     return(IsEditableOrVisible(session, lifecycleManager, manager, target, identifier, "IsVisible"));
 }
        private bool IsEditableOrVisible(ISession session, ILifecycleManager lifecycleManager, IMetamodelManager manager, INakedObject target, IIdentifier identifier, string toInvoke) {
            Assert.AssertNotNull(target);

            object authorizer = GetTypeAuthorizerFor(target, lifecycleManager, manager) ?? GetDefaultAuthorizer(lifecycleManager, manager);
            return (bool) authorizer.GetType().GetMethod(toInvoke).Invoke(authorizer, new[] {session.Principal, target.Object, identifier.MemberName});
        }
 public override void Invoke(INakedObjectAdapter nakedObjectAdapter, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager) {}
 public CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, ILogger <CollectionMemento> logger, CollectionMemento otherMemento, object[] selectedObjects)
     : this(lifecycleManager, nakedObjectManager, metamodel, logger)
 {
     IsPaged         = otherMemento.IsPaged;
     IsNotQueryable  = otherMemento.IsNotQueryable;
     Target          = otherMemento.Target;
     Action          = otherMemento.Action;
     Parameters      = otherMemento.Parameters;
     SelectedObjects = selectedObjects;
 }
 public ServiceSpec(SpecFactory memberFactory, IMetamodelManager metamodelManager, INakedObjectManager nakedObjectManager, IServiceSpecImmutable innerSpec) :
     base(memberFactory, metamodelManager, nakedObjectManager, innerSpec)
 {
 }
 public virtual string Hides(IInteractionContext ic, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(HiddenReason(ic.Session, ic.Target, lifecycleManager, manager));
 }
 public virtual Exception CreateExceptionFor(IInteractionContext ic, ILifecycleManager lifecycleManager, IMetamodelManager manager)
 {
     return(new HiddenException(ic, Hides(ic, lifecycleManager, manager)));
 }
 public override INakedObjectAdapter Invoke(INakedObjectAdapter nakedObjectAdapter, INakedObjectAdapter[] parameters, int resultPage, ILifecycleManager lifecycleManager, IMetamodelManager manager, ISession session, INakedObjectManager nakedObjectManager, IMessageBroker messageBroker, ITransactionManager transactionManager) {
     return Invoke(nakedObjectAdapter, parameters, lifecycleManager, manager, session, nakedObjectManager, messageBroker, transactionManager);
 }
 public abstract string HiddenReason(ISession session, INakedObjectAdapter target, ILifecycleManager lifecycleManager, IMetamodelManager manager);
 public override void Invoke(INakedObjectAdapter nakedObjectAdapter, ISession session, ILifecycleManager lifecycleManager, IMetamodelManager metamodelManager) {
     createdDelegate(nakedObjectAdapter.GetDomainObject());
 }
 private CollectionMemento(ILifecycleManager lifecycleManager, INakedObjectManager nakedObjectManager, IMetamodelManager metamodel, ILogger <CollectionMemento> logger)
 {
     this.lifecycleManager = lifecycleManager ?? throw new InitialisationException($"{nameof(lifecycleManager)} is null");
     ;
     this.nakedObjectManager = nakedObjectManager ?? throw new InitialisationException($"{nameof(nakedObjectManager)} is null");
     ;
     this.metamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null");
     this.logger    = logger ?? throw new InitialisationException($"{nameof(logger)} is null");
 }