use of org.obeonetwork.dsl.environment.Namespace in project InformationSystem by ObeoNetwork.
the class EntityToMLD method processNamespaceAndCreateAdditionalFields.
private void processNamespaceAndCreateAdditionalFields(Namespace namespace) {
// create tables
for (Entity entity : EntityUtils.getEntitiesInNamespace(namespace)) {
// Create technical fields
Table table = getFromOutputTraceabilityMap(entity, DatabasePackage.Literals.TABLE);
createAdditionalFields(table);
}
// process sub-namespaces
for (Namespace subnamespace : namespace.getOwnedNamespaces()) {
processNamespaceAndCreateAdditionalFields(subnamespace);
}
}
use of org.obeonetwork.dsl.environment.Namespace in project InformationSystem by ObeoNetwork.
the class MLDToEntity method getTargetNamespace.
protected Namespace getTargetNamespace(TableContainer tableContainer) {
if (!cacheTableContainerToNamespace.containsKey(tableContainer)) {
Namespace targetNamespace = null;
// First we look for a namespace with the right name
String namespaceName = tableContainer.getName();
// Look for a namespace with the right name
targetNamespace = getNamespaceByName(namespaceName);
if (targetNamespace == null) {
if (defaultTarget instanceof Namespace) {
if (EntityUtils.getEntitiesInNamespace((Namespace) defaultTarget).isEmpty()) {
// We consider the namespace is contained is a newly created model
// we can change its physical name
targetNamespace = (Namespace) defaultTarget;
AnnotationHelper.setPhysicalNameAnnotation(targetNamespace, namespaceName);
}
} else if (defaultTarget instanceof Root) {
Root entityRoot = (Root) defaultTarget;
if (entityRoot.getOwnedNamespaces().size() == 1 && EntityUtils.getEntitiesInNamespace(entityRoot.getOwnedNamespaces().get(0)).isEmpty()) {
targetNamespace = entityRoot.getOwnedNamespaces().get(0);
AnnotationHelper.setPhysicalNameAnnotation(targetNamespace, namespaceName);
}
}
// We create a namespace if the target object is a entity root
if (targetNamespace == null) {
targetNamespace = createNamespace(namespaceName);
}
// Last solution, can occur only if the default target is a non empty namespace, we then select it
if (targetNamespace == null) {
if (defaultTarget instanceof Namespace) {
targetNamespace = (Namespace) defaultTarget;
}
}
}
cacheTableContainerToNamespace.put(tableContainer, targetNamespace);
}
Namespace namespace = cacheTableContainerToNamespace.get(tableContainer);
// Ensure description is taken from tableContainer's comments
namespace.setDescription(tableContainer.getComments());
return namespace;
}
use of org.obeonetwork.dsl.environment.Namespace in project InformationSystem by ObeoNetwork.
the class DesignServices method getDependencyBeginLabel.
public static String getDependencyBeginLabel(DEdge edge) {
Namespace source = getNamespaceFromEdgeTarget(edge.getSourceNode());
Namespace target = getNamespaceFromEdgeTarget(edge.getTargetNode());
return "" + getNbDependencies(target, source);
}
use of org.obeonetwork.dsl.environment.Namespace in project InformationSystem by ObeoNetwork.
the class DesignServices method isDependencyBeginDecorated.
public static boolean isDependencyBeginDecorated(DEdge edge) {
Namespace source = getNamespaceFromEdgeTarget(edge.getSourceNode());
Namespace target = getNamespaceFromEdgeTarget(edge.getTargetNode());
return source != null && target != null && isExistingDependency(target, source);
}
use of org.obeonetwork.dsl.environment.Namespace in project InformationSystem by ObeoNetwork.
the class DesignServices method isDependencyEndDecorated.
public static boolean isDependencyEndDecorated(DEdge edge) {
Namespace source = getNamespaceFromEdgeTarget(edge.getSourceNode());
Namespace target = getNamespaceFromEdgeTarget(edge.getTargetNode());
return source != null && target != null && isExistingDependency(source, target);
}
Aggregations