Search in sources :

Example 1 with ObjectDescriptor

use of org.qi4j.api.object.ObjectDescriptor in project qi4j-sdk by Qi4j.

the class ApplicationVisitor method visitEnter.

@Override
public boolean visitEnter(Object visited) throws RuntimeException {
    if (visited instanceof ApplicationDescriptor) {
        ApplicationDescriptor applicationDescriptor = (ApplicationDescriptor) visited;
        appUri = context.createApplicationUri(applicationDescriptor.name());
        context.setNameAndType(appUri, applicationDescriptor.name(), Qi4jRdf.TYPE_APPLICATION);
    }
    if (visited instanceof LayerDescriptor) {
        LayerDescriptor layerDescriptor = (LayerDescriptor) visited;
        layerUri = context.createLayerUri(appUri, layerDescriptor.name());
        context.setNameAndType(layerUri, layerDescriptor.name(), Qi4jRdf.TYPE_LAYER);
        context.addRelationship(appUri, Qi4jRdf.RELATIONSHIP_LAYER, layerUri);
    }
    if (visited instanceof ModuleDescriptor) {
        ModuleDescriptor moduleDescriptor = (ModuleDescriptor) visited;
        moduleUri = context.createModuleUri(layerUri, moduleDescriptor.name());
        context.setNameAndType(layerUri, moduleDescriptor.name(), Qi4jRdf.TYPE_MODULE);
        context.addRelationship(layerUri, Qi4jRdf.RELATIONSHIP_MODULE, moduleUri);
    }
    if (visited instanceof TransientDescriptor) {
        TransientDescriptor transientDescriptor = (TransientDescriptor) visited;
        compositeUri = context.createCompositeUri(moduleUri, first(transientDescriptor.types()));
        context.addType(compositeUri, Qi4jRdf.TYPE_COMPOSITE);
        context.addRelationship(moduleUri, Qi4jRdf.RELATIONSHIP_COMPOSITE, compositeUri);
    }
    if (visited instanceof EntityDescriptor) {
        EntityDescriptor entityDescriptor = (EntityDescriptor) visited;
        compositeUri = context.createCompositeUri(moduleUri, first(entityDescriptor.types()));
        context.addType(compositeUri, Qi4jRdf.TYPE_ENTITY);
        context.addRelationship(moduleUri, Qi4jRdf.RELATIONSHIP_ENTITY, compositeUri);
    }
    if (visited instanceof ObjectDescriptor) {
        ObjectDescriptor objectDescriptor = (ObjectDescriptor) visited;
        compositeUri = context.createCompositeUri(moduleUri, first(objectDescriptor.types()));
        context.addType(compositeUri, Qi4jRdf.TYPE_OBJECT);
        context.addRelationship(moduleUri, Qi4jRdf.RELATIONSHIP_OBJECT, compositeUri);
    }
    if (visited instanceof MethodDescriptor) {
        MethodDescriptor compositeMethodDescriptor = (MethodDescriptor) visited;
        String compositeMethodUri = context.createCompositeMethodUri(compositeUri, compositeMethodDescriptor.method());
        context.addType(compositeMethodUri, Qi4jRdf.TYPE_METHOD);
        context.addRelationship(compositeUri, Qi4jRdf.RELATIONSHIP_METHOD, compositeMethodUri);
    }
    return true;
}
Also used : ModuleDescriptor(org.qi4j.api.structure.ModuleDescriptor) EntityDescriptor(org.qi4j.api.entity.EntityDescriptor) TransientDescriptor(org.qi4j.api.composite.TransientDescriptor) ObjectDescriptor(org.qi4j.api.object.ObjectDescriptor) MethodDescriptor(org.qi4j.api.composite.MethodDescriptor) ApplicationDescriptor(org.qi4j.api.structure.ApplicationDescriptor) LayerDescriptor(org.qi4j.api.structure.LayerDescriptor)

Example 2 with ObjectDescriptor

use of org.qi4j.api.object.ObjectDescriptor in project qi4j-sdk by Qi4j.

the class PDFWriter method writeTypeGeneralPage.

private void writeTypeGeneralPage(Object objectDesciptor) {
    setFont(header5Font, header5FontSize);
    writeString("General: ", headerLineSpace);
    setFont(normalFont, normalFontSize);
    if (objectDesciptor instanceof ServiceDetailDescriptor) {
        ServiceDescriptor descriptor = ((ServiceDetailDescriptor) objectDesciptor).descriptor();
        writeString("- identity: " + descriptor.identity());
        writeString("- class: " + descriptor.toString());
        writeString("- visibility: " + descriptor.visibility().toString());
        writeString("- startup: " + ((ServiceDetailDescriptor) objectDesciptor).descriptor().isInstantiateOnStartup());
    } else if (objectDesciptor instanceof EntityDetailDescriptor) {
        EntityDescriptor descriptor = ((EntityDetailDescriptor) objectDesciptor).descriptor();
        writeString("- name: " + descriptor.toString());
        writeString("- class: " + descriptor.toString());
        writeString("- visibility: " + descriptor.visibility().toString());
    } else if (objectDesciptor instanceof ValueDetailDescriptor) {
        ValueDescriptor descriptor = ((ValueDetailDescriptor) objectDesciptor).descriptor();
        writeString("- name: " + descriptor.toString());
        writeString("- class: " + descriptor.toString());
        writeString("- visibility: " + descriptor.visibility().toString());
    } else if (objectDesciptor instanceof ObjectDetailDescriptor) {
        ObjectDescriptor descriptor = ((ObjectDetailDescriptor) objectDesciptor).descriptor();
        writeString("- name: " + descriptor.toString());
        writeString("- class: " + descriptor.toString());
        writeString("- visibility: " + descriptor.visibility().toString());
    } else if (objectDesciptor instanceof CompositeDetailDescriptor) {
        CompositeDescriptor descriptor = ((CompositeDetailDescriptor) objectDesciptor).descriptor();
        writeString("- name: " + descriptor.toString());
        writeString("- class: " + descriptor.toString());
        writeString("- visibility: " + descriptor.visibility().toString());
    }
}
Also used : EntityDescriptor(org.qi4j.api.entity.EntityDescriptor) ServiceDescriptor(org.qi4j.api.service.ServiceDescriptor) ImportedServiceDescriptor(org.qi4j.api.service.ImportedServiceDescriptor) ValueDescriptor(org.qi4j.api.value.ValueDescriptor) CompositeDescriptor(org.qi4j.api.composite.CompositeDescriptor) ObjectDescriptor(org.qi4j.api.object.ObjectDescriptor)

Aggregations

EntityDescriptor (org.qi4j.api.entity.EntityDescriptor)2 ObjectDescriptor (org.qi4j.api.object.ObjectDescriptor)2 CompositeDescriptor (org.qi4j.api.composite.CompositeDescriptor)1 MethodDescriptor (org.qi4j.api.composite.MethodDescriptor)1 TransientDescriptor (org.qi4j.api.composite.TransientDescriptor)1 ImportedServiceDescriptor (org.qi4j.api.service.ImportedServiceDescriptor)1 ServiceDescriptor (org.qi4j.api.service.ServiceDescriptor)1 ApplicationDescriptor (org.qi4j.api.structure.ApplicationDescriptor)1 LayerDescriptor (org.qi4j.api.structure.LayerDescriptor)1 ModuleDescriptor (org.qi4j.api.structure.ModuleDescriptor)1 ValueDescriptor (org.qi4j.api.value.ValueDescriptor)1