.. ******************************************************************************* * MetaFactory.io R2 * Technical Documentation * * File name : T00_SetupProject.rst * Created by : Ralph Oudejans * * MetaFactory BV Amsterdam ******************************************************************************* .. include:: /inline-images.txt .. include:: /external-links.txt T00 Setup Project ================= To set up a MetaFactory project you need to create the following 5 files: #. a global configuration file named metafactory.properties #. a local configuration file named local.properties #. a project file named metafactory.xml for all project configuration #. a coding instructions files named codeinstruction.xml that contains your application code instructions #. a model file named model.xml that holds all domain specific data and metadata. Get the Metafactory environment up and running ---------------------------------------------- If you have not done it yet, |GoTo S| :ref:`Get and install MetaFactory environment`. You have now installed MetaFactory, configured your IDE and created a basic project. Get started ----------- Let's now get started with the basic files of MetaFactory and your first lines of coding instructions. |Exclam M| All files need to be created in the directory metafactory-workshop-metafactory or its subdirectories. - Create a global configuration file named metafactory.properties with the following content: .. code-block:: xml :caption: metafactory.properties :name: metafactory.properties :linenos: # ############################################ # metafactory.properties # Relative path to the (project)folder that will contain the MetaFactored output output.path=../metafactory-workshop-backend # Base package name of the Java code base.package=com.metafactory.workshop # Structure of the Java directories java.main.directory=src/main/java java.test.directory=src/test/java webapp.main.directory=src/main/webapp # Frontend properties frontend.output.path=../metafactory-workshop-frontend - Create a local configuration file named local.properties with the following (empty) content: .. code-block:: xml :caption: local.properties :name: local.properties :linenos: - Create a project file named metafactory.xml with the following content: .. code-block:: xml :caption: metafactory.xml :name: metafactory.xml :linenos: src/model/model.xml src/patterns/codeinstruction.xml src/snippets ${project.property.output.path} ${project.property.output.path} ${project.property.output.path} true false true false false false true true - Create a subdirectory named src/codeinstructions and in it a code instruction file named codeinstruction.xml that contains the code instructions for your application: .. code-block:: xml :caption: codeinstruction.xml :name: codeinstruction.xml-01 :linenos: com.metafactory.workshop src/main/java src/main/generated src/main/resources src/test/java src/test/resources 4 ./metafactory-workshop-frontend MetaFactoryWorkshopApplication true Workshop MetaFactory Workshop /app ${project.property.webapp.main.directory} ./metafactory-workshop-frontend src/main/webapp src/main/webapp/app shc true ./metafactory-workshop-backend /library/naming.ftl /jhipster/util/util.ftl /jhipster/util/state-utils.ftl /library/model_utils.ftl /library/layout/tableLayout.ftl /library/metadata.ftl ./ src/patterns src/snippets src/patterns/package/pattern-functions.xml - Create a subdirectory src/model with a model file named model.xml with the following content: .. code-block:: xml :caption: model.xml :name: model.xml-01 :linenos: src/main/webapp src/main/webapp/app http://workshop.local:8080 https://localhost:8080 localhost MetaFactoryworkshopApplication global.scss com.metafactory.workshop content Demo com.metafactory.workshop.rest.dto modal com.metafactory.workshop global.scss material_v1 metafactory-workshop MetaFactory workshop 1.0.0-SNAPSHOT com.metafactory.workshop.domain org.metafactory.model.runtime.domain true com.metafactory.workshop.repository.jpa.impl com.metafactory.workshop.repository.dialect 82 com.metafactory.workshop.repository.jpa com.metafactory.workshop.repository.util hibernate_sequence hoursangular Now: - Click on "Runtime_Model and Pattern functions" in the Code Composer Project window. - Click on the Play button to run MetaFactory. Once finished, the Code Composer will have generated the Java class RuntimeModel.java and some other classes that will be used during generation with MetaFactory. .. figure:: images/create-runtime-model-and-pattern-functions-screenshot.png :name: T01_Screenshot :scale: 60%