PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: flexphp on July 25, 2008, 06:07:47



Title: Referential Integrity
Post by: flexphp on July 25, 2008, 06:07:47
Hi there,

Need to implement referential integrity at the user level:

When a user deletes or modify a data (he is allowed to do it), a "Controller" verify that this action won't hurt something:
  • that data is not used by an other (for example is a property of an object) or if yes, the last is not used itself by an other (could be changed/erased too)
  • the user have acl authorisation on modifying/deleting the data potentially related to this one
A screen should display data relational mapping, asking for instructions based on acl.

In order to keep advantage of "Rich Client", the Flex interface should handle this and let the server serving info, mostly "raw info" (not aggregated). I'm I Right ?

Each DTO has its own proxy.

I thougth I would use a proxy to handle integrity checking, requesting the server for something like "Tell me what is related to this". This ReferentialIntegrityProxy would be called by DTO proxys upon their own delete() or update() commands.
ReferentialIntegrityProxy sends a notification. A ReferentialIntegrityMediator deals with user interaction. ReferentialIntegrityProxy command the DTO proxy to allow or not the action.

Is it best practice?

Many thanks,
Patrick


Title: Re: Referential Integrity
Post by: puremvc on July 25, 2008, 06:14:15
Hi Patrick,

I'm not sure I fully understand your post.

In the Model tier, certainly you can have one Proxy that is in charge of keeping the others in sync. I'm unclear about the Mediator's role in keeping the integrity, though.

-=Cliff>


Title: Re: Referential Integrity
Post by: flexphp on July 25, 2008, 08:43:44
Hi Cliff,

The mediator, along with relevant screen code, is in charge of displaying a 'map' of relations between the data to be erased/modified and others related, informing of the "usefullness" of that data in the complete system.
In this screen the user can interract to the question: "Are you sure?"

Ex for erasing a data:

1 In a screen, the user choose to delete a data, for example a "company department" by pressing the DELETE button
2 DepartmentMediator calls DepartmentProxy.delete(departmentVO)
3 DepartmentProxy do not yet interract with server.
4 DepartmentProxy calls ReferentialIntegrityProxy.checkUsefullness(departmentVO)
5 ReferentialIntegrityProxy ask the server for data related to this department. Upon answer, check from ACLProxy that user has the right to delete/modify related info & sends a notification with a ReferentialIntegrityVO as the body.
6 ReferentialIntegrityMediator receives notification and display through screen components the map of objects using this department, if any.
7 The user is invited to confirm or infirm his previous decision to delete "Are you sure?" but he has now the full info to take his decision.
8 ReferentialIntegrityMediator calls the appropriate action ReferentialIntegrityProxy.confirmDelete(ReferentialIntegrityVO)
9 ReferentialIntegrityProxy calls the DepartmentProxy.deletionConfirmed(departmentVO)
10 DepartmentProxy reqsuests the server to delete it...

Thanks again.
Patrick


Title: Re: Referential Integrity
Post by: puremvc on July 25, 2008, 09:00:29
Patrick,

This sounds like a perfectly reasonable setup to me. Very well thought out.

-=Cliff>