Java Reference
In-Depth Information
helper.setOperationContext(MindmapPackage.Literals.TOPIC,
eOperation);
EAnnotation ocl = eOperation.getEAnnotation(OCL_ANNOTATION_SOURCE);
String body = ocl.getDetails().get("body");
try
{
allSubtopicsBodyOCL = helper.createQuery(body);
}
catch
(ParserException e) {
throw new
UnsupportedOperationException(e.getLocalizedMessage());
}
}
Query<EClassifier, ?, ?> query =
OCL_ENV.createQuery(allSubtopicsBodyOCL);
@SuppressWarnings("unchecked")
Collection<Topic> result = (Collection<Topic>) query.evaluate(
this
);
return new
BasicEList.UnmodifiableEList<Topic>(result.size(),
result.toArray());
}
Again, here we see the boilerplate OCL code that configures an
OCLExpression
if it's the first invocation, and then it invokes the expression
obtained from the annotation. We leave the mindmap model at this point and
move on to develop the second domain model in our product line.
In a similar fashion to our mindmap model, we create a new
org.eclipse.
dsl.requirements
DSL project here to hold our requirements model. This
forms the base of our fictitious Requirements Management Project (RMP). We
create the new
requirements.ecore
model using the Domain Model Wizard
and GMF Ecore diagram, and we complete it to match the diagram and descrip-
tion of Figure 3-7.
Basically, a model contains a collection of
RequirementGroups
, which con-
tain a number of children groups and
Requirements
.
Requirements
have
child references and contain Version and optional Comment elements. A number
of enumerations for
Priority
,
State
,
Type
, and
Resolution
are also in the
model. A
Requirement
can also have a number of dependent requirements,
which become the basis for our dependency diagram. Note that the author attrib-
utes are simple strings. We could create a Team model and reference these ele-
ments to assign to our requirements and comments. We also could have a
separate Discussion model to use here and in our mindmap, as a topic might have
an associated discussion thread. Many possibilities exist, but for the purposes of
our sample application, we keep it simple.
Search WWH ::
Custom Search