PhotoVO would represents a single photo.
My suggestion to your project:
Use 'PhotosProxy' instead of 'PhotoProxy'. Sometimes you can think about the proxy as a representation of your table.
You have the table 'Photos' with columns: 'id', 'filename', 'type', 'size', 'date' and maybe 'keywords'.
I would create PhotosProxy with methods:
getPhotos(date:String, tags:String) - returns XML(only photos with the same date and keywords), PhotosProxy converts retrieved XML into arrayCollection of photos(single VOs) and sends note PhotosProxy.PHOTOS_RETRIEVED
You need one more method getPhotoDetails(photo:PhotoVO) - returns information about a specific photo, PhotosProxy sends note PhotosProxy.PHOTO_RETRIEVED
public function PhotosProxy()
{
super(NAME, new ArrayCollection);
}
public function get photos():ArrayCollection
{
return data as ArrayCollection;
}
public function getPhotos(date:String, tags:keywords):void
{
//call service to get photos
}
private function photosResults(event:Event):void
{
//convert XML into arrayCollection of PhotoVO
sendNotification(PHOTOS_RETRIEVED, photos);
}
public function getPhotosDetails(photo:PhotoVO):void
{
//call service
}
private function photoResult(event:Event):void
{
//convert XML into PhotoVO
sendNotification(PHOTO_RETRIEVED, photo);
}
You can add getPhotoDetails(photo:PhotoVO) to PhotosProxy or you can create a separate proxy 'PhotoProxy'.
It all depends on your project. I would create PhotoProxy in case where for example by clicking 'edit' button i open a dialog box(DialogBox, DialogBoxMediator). This mediator needs to know currently selected photo. dialogBoxMediator would get data from photoProxy.photo.
Mariush T.
Freelance Flex Developer
http://mariusht.com/blog/