コード例 #1
0
ファイル: Step0014.java プロジェクト: andrewwbailey/BIMserver
  @Override
  public void migrate(Schema schema, DatabaseSession databaseSession) {
    EClass serializerPluginConfiguration =
        schema.createEClass(
            schema.getEPackage("store"),
            "MessagingSerializerPluginConfiguration",
            schema.getEClass("store", "PluginConfiguration"));
    EClass userSettings = schema.getEClass("store", "UserSettings");
    EReference serializerSettingsReference =
        schema.createEReference(
            serializerPluginConfiguration, "userSettings", userSettings, Multiplicity.SINGLE);
    EReference settingsSerializerReference =
        schema.createEReference(
            userSettings,
            "messagingSerializerPlugins",
            serializerPluginConfiguration,
            Multiplicity.MANY);

    settingsSerializerReference.setEOpposite(serializerSettingsReference);
    serializerSettingsReference.setEOpposite(settingsSerializerReference);

    EClass serverSettings = schema.getEClass("store", "ServerSettings");
    schema.createEAttribute(
        serverSettings, "allowCreateValidatedUser", EcorePackage.eINSTANCE.getEBoolean());

    EClass version = schema.getEClass("store", "Version");

    EClass serverInfo = schema.getEClass("store", "ServerInfo");
    EReference versionReference =
        schema.createEReference(serverInfo, "version", version, Multiplicity.SINGLE);
    versionReference.getEAnnotations().add(createEmbedsReferenceAnnotation());
  }
コード例 #2
0
ファイル: Step0013.java プロジェクト: conject/BIMserver
  @Override
  public void migrate(Schema schema, DatabaseSession databaseSession) {
    schema.loadEcore("ifc4.ecore", getClass().getResourceAsStream("IFC4.ecore"));
    EClass project = schema.getEClass("store", "Project");
    schema.createEAttribute(project, "schema", EcorePackage.eINSTANCE.getEString());
    EClass revisionSummaryType = schema.getEClass("store", "RevisionSummaryType");
    schema.createEAttribute(revisionSummaryType, "schema", EcorePackage.eINSTANCE.getEString());
    EClass projectSmall = schema.getEClass("store", "ProjectSmall");
    schema.createEAttribute(projectSmall, "schema", EcorePackage.eINSTANCE.getEString());

    schema.createEPackage("geometry");

    EClass geometryInfo = schema.createEClass("geometry", "GeometryInfo");
    EClass vector3f = schema.createEClass("geometry", "Vector3f");
    schema.createEAttribute(vector3f, "x", EcorePackage.eINSTANCE.getEFloat(), Multiplicity.SINGLE);
    schema.createEAttribute(vector3f, "y", EcorePackage.eINSTANCE.getEFloat(), Multiplicity.SINGLE);
    schema.createEAttribute(vector3f, "z", EcorePackage.eINSTANCE.getEFloat(), Multiplicity.SINGLE);
    EReference min =
        schema.createEReference(geometryInfo, "minBounds", vector3f, Multiplicity.SINGLE);
    min.getEAnnotations().add(createEmbedsReferenceAnnotation());
    min.getEAnnotations().add(createHiddenAnnotation());
    EReference max =
        schema.createEReference(geometryInfo, "maxBounds", vector3f, Multiplicity.SINGLE);
    max.getEAnnotations().add(createEmbedsReferenceAnnotation());
    max.getEAnnotations().add(createHiddenAnnotation());
    vector3f.getEAnnotations().add(createHiddenAnnotation());
    geometryInfo.getEAnnotations().add(createHiddenAnnotation());
    schema.createEAttribute(
        geometryInfo,
        "startVertex",
        EcorePackage.eINSTANCE.getEIntegerObject(),
        Multiplicity.SINGLE);
    schema.createEAttribute(
        geometryInfo,
        "startIndex",
        EcorePackage.eINSTANCE.getEIntegerObject(),
        Multiplicity.SINGLE);
    schema.createEAttribute(
        geometryInfo,
        "primitiveCount",
        EcorePackage.eINSTANCE.getEIntegerObject(),
        Multiplicity.SINGLE);

    EClass geometryData = schema.createEClass("geometry", "GeometryData");
    schema.createEAttribute(
        geometryData, "indices", EcorePackage.eINSTANCE.getEByteArray(), Multiplicity.SINGLE);
    schema.createEAttribute(
        geometryData, "vertices", EcorePackage.eINSTANCE.getEByteArray(), Multiplicity.SINGLE);
    schema.createEAttribute(
        geometryData, "normals", EcorePackage.eINSTANCE.getEByteArray(), Multiplicity.SINGLE);
    geometryData.getEAnnotations().add(createNoLazyLoadAnnotation());
    geometryData.getEAnnotations().add(createHiddenAnnotation());

    schema
        .createEReference(geometryInfo, "data", geometryData, Multiplicity.SINGLE)
        .getEAnnotations()
        .add(createNoLazyLoadAnnotation());

    EClass ifcProductIfc2x3tc1 = schema.getEClass("ifc2x3tc1", "IfcProduct");
    EClass ifcProductIfc4 = schema.getEClass("ifc4", "IfcProduct");
    schema
        .createEReference(ifcProductIfc2x3tc1, "geometry", geometryInfo, Multiplicity.SINGLE)
        .getEAnnotations()
        .add(createHiddenAnnotation());
    schema
        .createEReference(ifcProductIfc4, "geometry", geometryInfo, Multiplicity.SINGLE)
        .getEAnnotations()
        .add(createHiddenAnnotation());

    EClass geometryInstance = schema.createEClass("geometry", "GeometryInstance");
    schema.createEReference(
        geometryInstance,
        "data",
        schema.getEClass("geometry", "GeometryData"),
        Multiplicity.SINGLE);
    schema.createEAttribute(
        geometryInstance,
        "transformation",
        EcorePackage.eINSTANCE.getEByteArray(),
        Multiplicity.SINGLE);
    geometryInstance.getEAnnotations().add(createHiddenAnnotation());

    schema.createEReference(
        schema.getEClass("geometry", "GeometryInfo"),
        "instance",
        geometryInstance,
        Multiplicity.SINGLE);
    schema.createEAttribute(geometryData, "materials", EcorePackage.eINSTANCE.getEByteArray());
    schema.createEAttribute(
        geometryData, "materialIndices", EcorePackage.eINSTANCE.getEByteArray());
    schema.createEAttribute(
        geometryInfo,
        "transformation",
        EcorePackage.eINSTANCE.getEByteArray(),
        Multiplicity.SINGLE);
  }