use of org.obeonetwork.dsl.environment.MetaDataContainer in project InformationSystem by ObeoNetwork.
the class AnnotationHelper method getOrCreateMetaDataContainer.
private static MetaDataContainer getOrCreateMetaDataContainer(ObeoDSMObject dsmObject) {
MetaDataContainer metaDataContainer = dsmObject.getMetadatas();
if (metaDataContainer == null) {
metaDataContainer = EnvironmentFactory.eINSTANCE.createMetaDataContainer();
dsmObject.setMetadatas(metaDataContainer);
}
return metaDataContainer;
}
use of org.obeonetwork.dsl.environment.MetaDataContainer in project InformationSystem by ObeoNetwork.
the class AnnotationHelper method getAnnotations.
public static Collection<Annotation> getAnnotations(ObeoDSMObject dsmObject, String name) {
Collection<Annotation> annotations = new ArrayList<Annotation>();
MetaDataContainer metaDataContainer = dsmObject.getMetadatas();
if (metaDataContainer != null) {
for (MetaData metaData : metaDataContainer.getMetadatas()) {
if (metaData instanceof Annotation) {
Annotation annotation = (Annotation) metaData;
if (name.equals(annotation.getTitle())) {
annotations.add(annotation);
}
}
}
}
return annotations;
}
use of org.obeonetwork.dsl.environment.MetaDataContainer in project InformationSystem by ObeoNetwork.
the class DocumentationLinkType method loadLinks.
/**
* {@inheritDoc}
* @see org.obeonetwork.tools.linker.LinkType#loadLinks(org.eclipse.emf.ecore.EObject)
*/
public List<EObjectLink> loadLinks(EObject source) {
if (source instanceof ObeoDSMObject) {
ObeoDSMObject element = (ObeoDSMObject) source;
MetaDataContainer metadatas = element.getMetadatas();
if (metadatas != null) {
List<EObjectLink> result = new ArrayList<EObjectLink>();
for (MetaData metadata : metadatas.getMetadatas()) {
if (metadata instanceof Annotation) {
Annotation annotation = (Annotation) metadata;
if (annotation.getTitle() != null && annotation.getTitle().startsWith(DocumentationLink.DOCUMENTATION_ANNOTATION_TITLE)) {
DocumentationLink link = new DocumentationLinkImpl(annotation);
result.add(link);
}
}
}
return result;
}
}
return Collections.emptyList();
}
Aggregations