Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tigerstripe-dev] Delegation Solution

> So I read once again Yuri's email about what delegation is for, and I think
> that if I was to define our Provider as a delegate of IResource, it would lead
> to having all Annotations defined on IResource instead of IModelComponent, but
> they would probably appear in the UI.
> I don't this is a viable solution though since we need to access the
> Annotations programmatically at code generation from the model, and we'd need
> to have the annotations defined against proper IModelComponents instead...

As I understand, framework works exactly what you need. So, I'll explain delegation
solution by the example:

Let's IModelComponent delegate to IJavaElement and IJavaElement delegate to
IResource. Say we have following POJOs which represent the same project:

 ITigerstripeModelProject tProject;
 IJavaProject jProject;
 IProject rProject;

So, we can create following annotations;

 IAnnotationManager.addAnnotation(tProject, content1);
 IAnnotationManager.addAnnotation(jProject, content2);
 IAnnotationManager.addAnnotation(rProject, content3);

Now we can use IAnnotationManager.getAnnotations(Object object, boolean delegate)
to get all annotations by POJO object:

 IAnnotationManager.getAnnotations(tProject, false) return 1 annotation
 IAnnotationManager.getAnnotations(jProject, false) return 1 annotation
 IAnnotationManager.getAnnotations(rProject, false) return 1 annotation

 IAnnotationManager.getAnnotations(tProject, true) return 3 annotations
 IAnnotationManager.getAnnotations(jProject, true) return 2 annotations
 IAnnotationManager.getAnnotations(rProject, true) return 1 annotation

Is it the right way?

Best regards,
Yuri Strot.

Back to the top