{"id":18383157,"url":"https://github.com/fugerit-org/fj-daogen-quickstart","last_synced_at":"2025-04-11T21:36:35.447Z","repository":{"id":53751104,"uuid":"204350012","full_name":"fugerit-org/fj-daogen-quickstart","owner":"fugerit-org","description":"Quick start for Fugerit DaoGen framework","archived":false,"fork":false,"pushed_at":"2025-01-28T07:30:44.000Z","size":308,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T23:43:26.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fugerit-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-25T21:08:25.000Z","updated_at":"2025-01-28T07:30:45.000Z","dependencies_parsed_at":"2023-01-23T18:46:07.523Z","dependency_job_id":"e4daaf6b-9a50-4a04-80c8-86298d4a6a3a","html_url":"https://github.com/fugerit-org/fj-daogen-quickstart","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugerit-org%2Ffj-daogen-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugerit-org%2Ffj-daogen-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugerit-org%2Ffj-daogen-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fugerit-org%2Ffj-daogen-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fugerit-org","download_url":"https://codeload.github.com/fugerit-org/fj-daogen-quickstart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248484584,"owners_count":21111674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:10:22.417Z","updated_at":"2025-04-11T21:36:35.426Z","avatar_url":"https://github.com/fugerit-org.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mars - Fugerit DAOGEN A.P.I. Quickstart  \n\n[![Keep a Changelog v1.1.0 badge](https://img.shields.io/badge/changelog-Keep%20a%20Changelog%20v1.1.0-%23E05735)](https://github.com/fugerit-org/fj-daogen-quickstart/blob/main/CHANGELOG.md) \n[![license](https://img.shields.io/badge/License-Apache%20License%202.0-teal.svg)](https://opensource.org/licenses/Apache-2.0)\n[![code of conduct](https://img.shields.io/badge/conduct-Contributor%20Covenant-purple.svg)](https://github.com/fugerit-org/fj-universe/blob/main/CODE_OF_CONDUCT.md)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fugerit-org_fj-daogen-quickstart\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fugerit-org_fj-daogen-quickstart)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fugerit-org_fj-daogen-quickstart\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=fugerit-org_fj-daogen-quickstart)\n[![Docker images](https://img.shields.io/badge/dockerhub-images-important.svg?logo=Docker)](https://hub.docker.com/repository/docker/fugeritorg/fj-daogen-quickstart/general)\n\n\n\nSample applications to learn usage of DaoGen framework.  \n\nIndex : \n1. Run the project\n2. Configuration notes\n3. DaoGen tutorial\n\n## 1. Run the project ##\n\n1. Minimum java 17 is required\n2. mvn spring-boot:run\n3. Open one of the rest URL http://localhost:8080/fj-daogen-quickstart/jax-rs/person/load/deep/id/3  \n\nTested with :\n* Amazon Corretto 17.07.7.1\n* Maven 3.9.0\n\nNOTE: index page fj-daogen-quickstart contains a few api links  \n\n\n## 2. Configuration notes ##\n\nThe project use an hqsldb in memory DB, so it doesn't require any further configuration.  \n\n*2.1 Data base sample configuration*\n\nDB configuration is in folder:  \nsrc/main/resources/quickstart_db  \n\u0026nbsp;\u0026nbsp; +quickstart-db-conn.properties   [contains database jdbc connection properties]  \n\u0026nbsp;\u0026nbsp; +hsqldb  [contains database init script to work in (all files in this folder will be loaded to init db at startup]  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\t+100_db_setup.sql [contains create schema, sequences etc]  \n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\t+200_sample_db.sql [contains starting entity and relations, plus some records]  \n\n*2.2 DaoGen configuration file\n\nDaoGen configuration is in path :    \nsrc/main/resources/daogen/daogen-config.xml   \nThe root element contains all the basic properties of generation.    \nThey are all set for this project, but you need to update some of them if you need to configure for another project (especially package name and source folder).  \n\n\n## 3. DaoGen tutorial ##\n\nQuick tutorial to add one entity to the project.  \nAll the files of this tutorial are, as an example, in folder src/test/resources/tutorial  \n\n### 3.1 Add entity configuration script\n\nFor instance we will add an equipment table (src/main/resources/quickstart_db/hsqldb/300_equipment.sql) :   \n\n```\nCREATE TABLE daogen_quickstart.equipment (\n\tid BIGINT NOT NULL,\n\tid_owner BIGINT,\n\tid_creator BIGINT,\n\tcreation_date TIMESTAMP NOT NULL,\n\tupdate_date TIMESTAMP NOT NULL,\n\tdescription VARCHAR(1024) NOT NULL,\n\tstate BIGINT NOT NULL\n);\n\nALTER TABLE daogen_quickstart.equipment ADD CONSTRAINT equipment_pk PRIMARY KEY ( id );\nALTER TABLE daogen_quickstart.equipment ADD CONSTRAINT equipment_fk1 FOREIGN KEY ( id_owner ) REFERENCES person ( id );\nALTER TABLE daogen_quickstart.equipment ADD CONSTRAINT equipment_fk2 FOREIGN KEY ( id_creator ) REFERENCES person ( id );\n\nCOMMENT ON TABLE daogen_quickstart.equipment IS 'equipments meta informations';\nCOMMENT ON COLUMN daogen_quickstart.equipment.id_owner IS 'Reference to owner';\nCOMMENT ON COLUMN daogen_quickstart.equipment.id_creator IS 'Reference to creator';\nCOMMENT ON COLUMN daogen_quickstart.equipment.creation_date IS 'equipment creation time';\nCOMMENT ON COLUMN daogen_quickstart.equipment.update_date IS 'equipment update time';\nCOMMENT ON COLUMN daogen_quickstart.equipment.description IS 'equipments description';\nCOMMENT ON COLUMN daogen_quickstart.equipment.state IS 'equipment state';\n\nINSERT INTO daogen_quickstart.equipment VALUES ( 20, 1, 3, '2019-03-01', '2019-03-02', 'First Silmaril', 1 );\nINSERT INTO daogen_quickstart.equipment VALUES ( 21, 2, 3, '2019-03-01', '2019-03-02', 'First Silmaril', 1 );\nINSERT INTO daogen_quickstart.equipment VALUES ( 22, 3, 3, '2019-03-01', '2019-03-02', 'First Silmaril', 1 );\n```\n\n### 3.2 Dump the configuration\n\nRun the main class src/main/test : \n\n`test.org.fugerit.java.daogen.quickstart.tools.DaogenDump`\n\nThis will dump the configuration, you can then copy paste from output the configuration of the new entity ( src/main/resources/daogen/daogen-config.xml from section 2.2 ) : \n\n```\n  \u003centity catalog=\"PUBLIC\" comments=\"equipments meta informations\" foreignKeys=\"PUBLIC.DAOGEN_QUICKSTART.PERSON,PUBLIC.DAOGEN_QUICKSTART.PERSON\" id=\"PUBLIC.DAOGEN_QUICKSTART.EQUIPMENT\" name=\"EQUIPMENT\" primaryKey=\"ID\" schema=\"DAOGEN_QUICKSTART\"\u003e\n    \u003cfield comments=\"\" id=\"ID\" javaType=\"java.lang.Long\" nullable=\"no\" size=\"0\" sqlType=\"-5\" sqlTypeName=\"BIGINT\"/\u003e\n    \u003cfield comments=\"Reference to owner\" id=\"ID_OWNER\" javaType=\"java.lang.Long\" nullable=\"yes\" size=\"0\" sqlType=\"-5\" sqlTypeName=\"BIGINT\"/\u003e\n    \u003cfield comments=\"Reference to creator\" id=\"ID_CREATOR\" javaType=\"java.lang.Long\" nullable=\"yes\" size=\"0\" sqlType=\"-5\" sqlTypeName=\"BIGINT\"/\u003e\n    \u003cfield comments=\"equipment creation time\" id=\"CREATION_DATE\" javaType=\"java.sql.Timestamp\" nullable=\"no\" size=\"0\" sqlType=\"93\" sqlTypeName=\"TIMESTAMP\"/\u003e\n    \u003cfield comments=\"equipment update time\" id=\"UPDATE_DATE\" javaType=\"java.sql.Timestamp\" nullable=\"no\" size=\"0\" sqlType=\"93\" sqlTypeName=\"TIMESTAMP\"/\u003e\n    \u003cfield comments=\"equipments description\" id=\"DESCRIPTION\" javaType=\"java.lang.String\" nullable=\"no\" size=\"1024\" sqlType=\"12\" sqlTypeName=\"VARCHAR\"/\u003e\n    \u003cfield comments=\"equipment state\" id=\"STATE\" javaType=\"java.lang.Long\" nullable=\"no\" size=\"0\" sqlType=\"-5\" sqlTypeName=\"BIGINT\"/\u003e\n  \u003c/entity\u003e\n```\n\n\n### 3.3 Code generation\n\nUpdate the file [daogen-config.xml](src/main/daogen/daogen-config.xml), then run : \n\n`mvn fj-daogen:generate`\n\nto regenerate the resources. (see the [fj-daogen-maven-plugin](https://docs.fugerit.org/data/java/site/fj-daogen-maven-plugin/generate-mojo.html) reference and [documentation](https://marsdocs.fugerit.org/src/docs/maven-plugin/generate.html) for more information)\n\nFor example, if this test link is accessed : \n\n`http://localhost:8080/fj-daogen-quickstart/jax-rs/person/load/id/3`\n\noutput will be : \n\n`{\"id\":3,\"surname\":\"Noldor\",\"name\":\"Feanor\",\"birthDate\":\"1999-12-31\",\"note\":\"Great smith\",\"idMother\":1,\"idFather\":2,\"mother\":null,\"father\":null,\"owndocuments\":null,\"empty\":false}`\n\nIf the line 67 is removed : \n\n`\u003cfield comments=\"Notes on persone\" id=\"NOTE\" javaType=\"java.lang.String\" nullable=\"no\" size=\"256\" sqlType=\"12\" sqlTypeName=\"VARCHAR\"/\u003e`\n\nThe new output will be :\n\n\n`{\"id\":3,\"surname\":\"Noldor\",\"name\":\"Feanor\",\"birthDate\":\"1999-12-31\",\"idMother\":1,\"idFather\":2,\"mother\":null,\"father\":null,\"owndocuments\":null,\"empty\":false}`\n\n\n### 3.4 Add rest service configuration\n\nAdd the newly built REST service LoadEquipment to jaxrs application : \n\norg.fugerit.java.daogen.quickstart.config.DaogenQuickstart  \n\n```\npublic class DaogenQuickstart extends javax.ws.rs.core.Application {\n\n\t   public Set\u003cClass\u003c?\u003e\u003e getClasses() {\n\t\t      Set\u003cClass\u003c?\u003e\u003e s = new HashSet\u003cClass\u003c?\u003e\u003e();\n\t\t      s.add(org.fugerit.java.daogen.quickstart.impl.rest.load.LoadPerson.class);\n\t\t      s.add(org.fugerit.java.daogen.quickstart.impl.rest.load.LoadDocument.class);\n\t\t      s.add(org.fugerit.java.daogen.quickstart.impl.rest.load.LoadEquipment.class);\n\t\t      return s;\n\t\t}\n\t\n}\n```\n\n### 3.5 Test result\n\nStart the application and test the service :   \n\n[test page](http://localhost:8080/fj-daogen-quickstart/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffugerit-org%2Ffj-daogen-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffugerit-org%2Ffj-daogen-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffugerit-org%2Ffj-daogen-quickstart/lists"}