Search in sources :

Example 6 with MetaDataContainer

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;
}
Also used : MetaDataContainer(org.obeonetwork.dsl.environment.MetaDataContainer)

Example 7 with 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;
}
Also used : MetaData(org.obeonetwork.dsl.environment.MetaData) ArrayList(java.util.ArrayList) MetaDataContainer(org.obeonetwork.dsl.environment.MetaDataContainer) Annotation(org.obeonetwork.dsl.environment.Annotation)

Example 8 with MetaDataContainer

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();
}
Also used : MetaData(org.obeonetwork.dsl.environment.MetaData) DocumentationLink(org.obeonetwork.tools.doc.core.DocumentationLink) ObeoDSMObject(org.obeonetwork.dsl.environment.ObeoDSMObject) EObjectLink(org.obeonetwork.tools.linker.EObjectLink) ArrayList(java.util.ArrayList) MetaDataContainer(org.obeonetwork.dsl.environment.MetaDataContainer) Annotation(org.obeonetwork.dsl.environment.Annotation)

Aggregations

MetaDataContainer (org.obeonetwork.dsl.environment.MetaDataContainer)8 Annotation (org.obeonetwork.dsl.environment.Annotation)5 MetaData (org.obeonetwork.dsl.environment.MetaData)3 ObeoDSMObject (org.obeonetwork.dsl.environment.ObeoDSMObject)3 Risk (fr.gouv.mindef.safran.graalextensions.Risk)2 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)1 EditingDomain (org.eclipse.emf.edit.domain.EditingDomain)1 DocumentationLink (org.obeonetwork.tools.doc.core.DocumentationLink)1 EObjectLink (org.obeonetwork.tools.linker.EObjectLink)1