use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.
the class DomainClassServicesTest method testAnnotationPresentMultipleTimes.
@Test
public void testAnnotationPresentMultipleTimes() {
System system = loadRoot("AnnotationPresentMultipleTimes.graal", System.class);
DomainClass domainClass = query(() -> {
return (DomainClass) system.getOwnedNamespaces().get(0).getTypes().get(0);
});
assertEquals("physical size 1", getPhysicalSize(domainClass));
}
use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.
the class DomainClassServicesTest method testAnnotationWithEmptyMetadataContainer.
@Test
public void testAnnotationWithEmptyMetadataContainer() {
System system = loadRoot("AnnotationWithEmptyMetadataContainer.graal", System.class);
DomainClass domainClass = query(() -> {
return (DomainClass) system.getOwnedNamespaces().get(0).getTypes().get(0);
});
assertEquals("", getPhysicalSize(domainClass));
}
use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.
the class DomainClassServicesTest method testAnnotationPresent.
@Test
public void testAnnotationPresent() {
System system = loadRoot("AnnotationPresent.graal", System.class);
DomainClass domainClass = query(() -> {
return (DomainClass) system.getOwnedNamespaces().get(0).getTypes().get(0);
});
assertEquals("physical size", getPhysicalSize(domainClass));
}
use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.
the class UseCaseServices method allDomainClasses.
/**
* Collect all domain classes referenced by a use case
* @param uc
* @return
*/
public List<DomainClass> allDomainClasses(UseCase uc) {
Set<DomainClass> classes = new HashSet<DomainClass>();
// Add domain classes directly references
classes.addAll(uc.getDomainClasses());
// Search for domain classes in referenced namespaces
for (Namespace ns : uc.getNamespaces()) {
collectClasses(ns, classes);
}
// This reference exists for compatibility with old metamodel version (before DomainClass)
for (StructuredType type : uc.getTypes()) {
if (type instanceof DomainClass) {
classes.add((DomainClass) type);
}
}
// Convert set to list
List<DomainClass> result = new ArrayList<>(classes);
// and sort by fully qualified names
Collections.sort(result, new Comparator<DomainClass>() {
@Override
public int compare(DomainClass arg0, DomainClass arg1) {
// Use a primary collator to ignore accents and case
Collator collator = Collator.getInstance();
collator.setStrength(Collator.PRIMARY);
return collator.compare(fullQualifiedName(arg0), fullQualifiedName(arg1));
}
});
return result;
}
Aggregations