Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Referential Integrity  (Read 8574 times)
flexphp
Jr. Member
**
Posts: 17


View Profile Email
« 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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>
Logged
flexphp
Jr. Member
**
Posts: 17


View Profile Email
« Reply #2 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
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: July 25, 2008, 09:00:29 »

Patrick,

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

-=Cliff>
Logged
Pages: [1]
Print