Friday, August 27, 2010

ModelArtifactState

After I posted the Contolling DevExpress XtraGrid Part-2 (Master Detail) I got many requests to speak about how easy will be to make a behaviout conditional so I am going to explain again how ModelArtifact module was build that is based on eXpand logic architecture

Is based on the eXpand Logic architecture and more specifically at eXpand Conditional Logic architecture. That means that Conditional Logic architecture is designed to execute conditional logic rules and from the name of the module one can easily understand that the rules are responsible to change the state of model artifacts, and what are the model artifacts? Controllers and actions.

tell how and when the state is changed

So for all modelartifacts have a common attribute the Module (one can define all controllers or actions in a module or in a regex on modules that the rule will be applied upon)

By using the logic architecture we just need to implement the following interface that describe the above

public interface IArtifactStateRule:IConditionalLogicRule {

    string Module { get; set; }

}

image image

Now for action artifact the implementation will look as (Note IArtifactStateRule base type)

public interface IActionStateRule : IArtifactStateRule {

    IModelAction ActionId { get; set; }

    ActionState ActionState { get; set; }

}

image

as you see we use an Action attribute and an ActionState one, the values of action state are

public enum ActionState {

    Default,

    Disabled,

    Hidden,

    Executed,

    ExecutedAndDisable

}

And for Controller Artifact the implementation will look like (Note IArtifactStateRule base type)

public interface IControllerStateRule : IArtifactStateRule {

    Type ControllerType { get; set; }

    ControllerState ControllerState { get; set; }

}

image

As u see we have the type of the controller that the ControllerState will be applied uppon

the values of controllerState are

public enum ControllerState {

    Default,

    Disabled,

    Enabled

}

if we explore the modelartifact model structure  we see that we have set the rules to be executed at ViewChanging

image

that means that modelartifacts state will change there (eg. controllers,action will be disabled at ViewChanging)

As I say cause of the logic architecture that behavior, that is changing the state of ModelArtifacts can be applied either through model editor as i explain or through attributes on an object

[ControllerStateRule("testId",typeof(DeleteObjectsViewController),"1=1","1=1",ControllerState.Disabled)]

[ActionStateRule("testId","Delete","1=1","1=1",ActionState.Hidden)]

public class LogicRuleDomainObject : BaseObject {

    public LogicRuleDomainObject(Session session) : base(session) {

    }

or through permissions

image

Subscribe to XAF feed
Subscribe to community feed

DiggIt!
blog comments powered by Disqus