diff --git a/docs/about/naming_rest_api_brief_introduction.odt b/docs/about/naming_rest_api_brief_introduction.odt new file mode 100644 index 0000000000000000000000000000000000000000..2f209f13918b6b0f6f5694c5ddb7464e046c527a Binary files /dev/null and b/docs/about/naming_rest_api_brief_introduction.odt differ diff --git a/docs/about/naming_rest_api_brief_introduction.pdf b/docs/about/naming_rest_api_brief_introduction.pdf new file mode 100644 index 0000000000000000000000000000000000000000..387a006a1a13a0e99927ef5b94bf1f876ff300e1 Binary files /dev/null and b/docs/about/naming_rest_api_brief_introduction.pdf differ diff --git a/docs/about/naming_rest_api_cheat_sheet.odg b/docs/about/naming_rest_api_cheat_sheet.odg new file mode 100644 index 0000000000000000000000000000000000000000..c255df5cbb7281f2885ef2388ecd6aee8ff97332 Binary files /dev/null and b/docs/about/naming_rest_api_cheat_sheet.odg differ diff --git a/docs/about/naming_rest_api_cheat_sheet.pdf b/docs/about/naming_rest_api_cheat_sheet.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2f3211013e9fe3c49586e49e113220a4923b6267 Binary files /dev/null and b/docs/about/naming_rest_api_cheat_sheet.pdf differ diff --git a/docs/verification/Schema_data_migration.txt b/docs/db/Schema_data_migration.txt similarity index 100% rename from docs/verification/Schema_data_migration.txt rename to docs/db/Schema_data_migration.txt diff --git a/docs/verification/V1__Initial.sql b/docs/verification/V1__Initial.sql deleted file mode 100644 index cb960e1f00d7bbab44e20698a5959796f18d7e88..0000000000000000000000000000000000000000 --- a/docs/verification/V1__Initial.sql +++ /dev/null @@ -1,378 +0,0 @@ -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - --- --- Name: appinfo; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE appinfo ( - id bigint NOT NULL, - version integer, - schemaversion integer NOT NULL -); - - --- --- Name: appinfo_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE appinfo_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: appinfo_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE appinfo_id_seq OWNED BY appinfo.id; - - --- --- Name: device; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE device ( - id bigint NOT NULL, - version integer, - uuid character varying(255) -); - - --- --- Name: device_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE device_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: device_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE device_id_seq OWNED BY device.id; - - --- --- Name: devicerevision; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE devicerevision ( - id bigint NOT NULL, - version integer, - additionalinfo character varying(255), - conventionname character varying(255), - conventionnameeqclass character varying(255), - deleted boolean NOT NULL, - instanceindex character varying(255), - requestdate timestamp without time zone, - device_id bigint, - devicetype_id bigint, - requestedby_id bigint, - section_id bigint -); - - --- --- Name: devicerevision_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE devicerevision_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: devicerevision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE devicerevision_id_seq OWNED BY devicerevision.id; - - --- --- Name: namepart; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE namepart ( - id bigint NOT NULL, - version integer, - nameparttype character varying(255), - uuid character varying(255) -); - - --- --- Name: namepart_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE namepart_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: namepart_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE namepart_id_seq OWNED BY namepart.id; - - --- --- Name: namepartrevision; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE namepartrevision ( - id bigint NOT NULL, - version integer, - deleted boolean NOT NULL, - description character varying(255), - mnemonic character varying(255), - mnemoniceqclass character varying(255), - name character varying(255), - processdate timestamp without time zone, - processorcomment character varying(255), - requestdate timestamp without time zone, - requestercomment character varying(255), - status character varying(255), - namepart_id bigint, - parent_id bigint, - processedby_id bigint, - requestedby_id bigint -); - - --- --- Name: namepartrevision_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE namepartrevision_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: namepartrevision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE namepartrevision_id_seq OWNED BY namepartrevision.id; - - --- --- Name: useraccount; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE useraccount ( - id bigint NOT NULL, - version integer, - role character varying(255), - username character varying(255) -); - - --- --- Name: useraccount_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE useraccount_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: useraccount_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE useraccount_id_seq OWNED BY useraccount.id; - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY appinfo ALTER COLUMN id SET DEFAULT nextval('appinfo_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY device ALTER COLUMN id SET DEFAULT nextval('device_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY devicerevision ALTER COLUMN id SET DEFAULT nextval('devicerevision_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepart ALTER COLUMN id SET DEFAULT nextval('namepart_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepartrevision ALTER COLUMN id SET DEFAULT nextval('namepartrevision_id_seq'::regclass); - - --- --- Name: id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY useraccount ALTER COLUMN id SET DEFAULT nextval('useraccount_id_seq'::regclass); - - --- --- Name: appinfo_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY appinfo - ADD CONSTRAINT appinfo_pkey PRIMARY KEY (id); - - --- --- Name: device_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY device - ADD CONSTRAINT device_pkey PRIMARY KEY (id); - - --- --- Name: devicerevision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY devicerevision - ADD CONSTRAINT devicerevision_pkey PRIMARY KEY (id); - - --- --- Name: namepart_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY namepart - ADD CONSTRAINT namepart_pkey PRIMARY KEY (id); - - --- --- Name: namepartrevision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY namepartrevision - ADD CONSTRAINT namepartrevision_pkey PRIMARY KEY (id); - - --- --- Name: useraccount_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY useraccount - ADD CONSTRAINT useraccount_pkey PRIMARY KEY (id); - - --- --- Name: fk_3f26vetemhujfdm9q74ecr2u5; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepartrevision - ADD CONSTRAINT fk_3f26vetemhujfdm9q74ecr2u5 FOREIGN KEY (namepart_id) REFERENCES namepart(id); - - --- --- Name: fk_4ucnoos7kd8s1gaqbpwm1xptq; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY devicerevision - ADD CONSTRAINT fk_4ucnoos7kd8s1gaqbpwm1xptq FOREIGN KEY (requestedby_id) REFERENCES useraccount(id); - - --- --- Name: fk_9vomfk9x1jow27ifx6xc62c5x; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepartrevision - ADD CONSTRAINT fk_9vomfk9x1jow27ifx6xc62c5x FOREIGN KEY (processedby_id) REFERENCES useraccount(id); - - --- --- Name: fk_9xs5oy86lf0j8ukpjokjipeke; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepartrevision - ADD CONSTRAINT fk_9xs5oy86lf0j8ukpjokjipeke FOREIGN KEY (requestedby_id) REFERENCES useraccount(id); - - --- --- Name: fk_d3ocbsb4tl4ttnusn98khq148; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY devicerevision - ADD CONSTRAINT fk_d3ocbsb4tl4ttnusn98khq148 FOREIGN KEY (devicetype_id) REFERENCES namepart(id); - - --- --- Name: fk_l7kklb4mxixjs27nsso6shone; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY devicerevision - ADD CONSTRAINT fk_l7kklb4mxixjs27nsso6shone FOREIGN KEY (section_id) REFERENCES namepart(id); - - --- --- Name: fk_l9r1givkfaiol5or2lnr324xp; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY devicerevision - ADD CONSTRAINT fk_l9r1givkfaiol5or2lnr324xp FOREIGN KEY (device_id) REFERENCES device(id); - - --- --- Name: fk_lufxqy46l9eiq55d445rbukag; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY namepartrevision - ADD CONSTRAINT fk_lufxqy46l9eiq55d445rbukag FOREIGN KEY (parent_id) REFERENCES namepart(id); - - --- --- Name: public; Type: ACL; Schema: -; Owner: - --- - -REVOKE ALL ON SCHEMA public FROM PUBLIC; -REVOKE ALL ON SCHEMA public FROM postgres; -GRANT ALL ON SCHEMA public TO postgres; -GRANT ALL ON SCHEMA public TO PUBLIC; - - -INSERT INTO appinfo (version, schemaversion) VALUES (1,1); diff --git a/docs/verification/V2__Commit_Msg_to_Device.sql b/docs/verification/V2__Commit_Msg_to_Device.sql deleted file mode 100644 index acbe8e16f8d0263d724f8af9cfbac516cbf2d6f0..0000000000000000000000000000000000000000 --- a/docs/verification/V2__Commit_Msg_to_Device.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE devicerevision ADD processorcomment varchar(255) NULL; diff --git a/docs/verification/V3__Notification_CC_List.sql b/docs/verification/V3__Notification_CC_List.sql deleted file mode 100644 index f694a06165c87fc235ed227147238086212a123a..0000000000000000000000000000000000000000 --- a/docs/verification/V3__Notification_CC_List.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE user_notification ( - id bigserial NOT NULL, - notification_type varchar(32) NOT NULL, - user_login_name varchar(32) NOT NULL, - CONSTRAINT user_notification_pk PRIMARY KEY (id) -); \ No newline at end of file diff --git a/pom.xml b/pom.xml index a7819f91d2e7aa1694268199b9818ff8d78f1989..d1a19f984c72813e266203cdc4ac2be7453ee3f2 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,20 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <configuration> + <delimiters> + <delimiter>@</delimiter> + </delimiters> + <useDefaultDelimiters>false</useDefaultDelimiters> + <nonFilteredFileExtensions> + <nonFilteredFileExtension>pdf</nonFilteredFileExtension> + </nonFilteredFileExtensions> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/src/main/java/org/openepics/names/NamingApplication.java b/src/main/java/org/openepics/names/NamingApplication.java index ef9dbcbc8a04bfc6513ad9be449c60cc8c4405ad..e05d5d8da97c9921adf0df9b3caa48b9886a2aba 100644 --- a/src/main/java/org/openepics/names/NamingApplication.java +++ b/src/main/java/org/openepics/names/NamingApplication.java @@ -18,8 +18,16 @@ package org.openepics.names; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +import io.swagger.v3.oas.models.ExternalDocumentation; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; @SpringBootApplication public class NamingApplication { @@ -28,4 +36,30 @@ public class NamingApplication { SpringApplication.run(NamingApplication.class, args); } + @Value("${openapi.externaldocs.description}") String openapi_externaldocs_description; + @Value("${openapi.externaldocs.url}") String openapi_externaldocs_url; + @Value("${openapi.info.contact.email}") String openapi_info_contact_email; + @Value("${openapi.info.contact.name}") String openapi_info_contact_name; + @Value("${openapi.info.contact.url}") String openapi_info_contact_url; + @Value("${openapi.info.description}") String openapi_info_description; + @Value("${openapi.info.license.name}") String openapi_info_license_name; + @Value("${openapi.info.title}") String openapi_info_title; + + @Bean + public OpenAPI customOpenAPI(@Value("${app.version}") String appVersion) { + return new OpenAPI() + .externalDocs(new ExternalDocumentation() + .description(openapi_externaldocs_description) + .url(openapi_externaldocs_url)) + .info(new Info() + .contact(new Contact() + .email(openapi_info_contact_email) + .name(openapi_info_contact_name) + .url(openapi_info_contact_url)) + .description(openapi_info_description) + .license(new License().name(openapi_info_license_name)) + .title(openapi_info_title) + .version(appVersion)); + } + } diff --git a/src/main/resources/application-docker.properties b/src/main/resources/application-docker.properties index f21cd21557e834386bff48e2c94f03138bf4ade1..102c01b5f1bfdb7c5be10bbc7475bf2f1f8161be 100644 --- a/src/main/resources/application-docker.properties +++ b/src/main/resources/application-docker.properties @@ -3,8 +3,6 @@ server.port=8083 spring.profiles.active=@spring.profiles.active@ -# ------------------------------------------------------------ - spring.datasource.url=jdbc:postgresql://postgres:5432/discs_names spring.datasource.username=discs_names spring.datasource.password=discs_names @@ -12,3 +10,23 @@ spring.datasource.password=discs_names spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=none spring.jpa.hibernate.show-sql=true + +# ------------------------------------------------------------ + +app.version=0.0.1-SNAPSHOT +openapi.externaldocs.description=ESS Naming Convention +openapi.externaldocs.url=https://chess.esss.lu.se/enovia/link/ESS-0000757/21308.51166.45568.45993/valid +openapi.info.contact.email=Icsscontrolsystemsupport@esss.se +openapi.info.contact.name=Support +openapi.info.contact.url=https://jira.esss.lu.se/projects/NT/issues +openapi.info.description=\ + Perform Naming tasks Create Read Update Delete + Approve Cancel Reject \n\n \ + Here are some useful links \n \ + - [CCDB ecosystem](https://confluence.esss.lu.se/display/SW/CCDB+ecosystem) \n \ + - [Introduction to Naming REST API](/pdfs/naming_rest_api_brief_introduction.pdf) + [Cheat Sheet](/pdfs/naming_rest_api_cheat_sheet.pdf) \n\n \ + Note \n \ + - Observe which fields to use for operations client to server. \n \ + - Obsolete values are not shown unless history is requested. \n \ + - Regular expressions are not supported for searches. Regex-like behavior is available with _ underscore, 0 or 1 occurrences of any character, % percent, any number of any character. +openapi.info.license.name=Copyright (C) 2022 European Spallation Source ERIC. +openapi.info.title=Naming REST API diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f21cd21557e834386bff48e2c94f03138bf4ade1..102c01b5f1bfdb7c5be10bbc7475bf2f1f8161be 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,8 +3,6 @@ server.port=8083 spring.profiles.active=@spring.profiles.active@ -# ------------------------------------------------------------ - spring.datasource.url=jdbc:postgresql://postgres:5432/discs_names spring.datasource.username=discs_names spring.datasource.password=discs_names @@ -12,3 +10,23 @@ spring.datasource.password=discs_names spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=none spring.jpa.hibernate.show-sql=true + +# ------------------------------------------------------------ + +app.version=0.0.1-SNAPSHOT +openapi.externaldocs.description=ESS Naming Convention +openapi.externaldocs.url=https://chess.esss.lu.se/enovia/link/ESS-0000757/21308.51166.45568.45993/valid +openapi.info.contact.email=Icsscontrolsystemsupport@esss.se +openapi.info.contact.name=Support +openapi.info.contact.url=https://jira.esss.lu.se/projects/NT/issues +openapi.info.description=\ + Perform Naming tasks Create Read Update Delete + Approve Cancel Reject \n\n \ + Here are some useful links \n \ + - [CCDB ecosystem](https://confluence.esss.lu.se/display/SW/CCDB+ecosystem) \n \ + - [Introduction to Naming REST API](/pdfs/naming_rest_api_brief_introduction.pdf) + [Cheat Sheet](/pdfs/naming_rest_api_cheat_sheet.pdf) \n\n \ + Note \n \ + - Observe which fields to use for operations client to server. \n \ + - Obsolete values are not shown unless history is requested. \n \ + - Regular expressions are not supported for searches. Regex-like behavior is available with _ underscore, 0 or 1 occurrences of any character, % percent, any number of any character. +openapi.info.license.name=Copyright (C) 2022 European Spallation Source ERIC. +openapi.info.title=Naming REST API diff --git a/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf b/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf new file mode 100644 index 0000000000000000000000000000000000000000..387a006a1a13a0e99927ef5b94bf1f876ff300e1 Binary files /dev/null and b/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf differ diff --git a/src/main/resources/static/pdfs/naming_rest_api_cheat_sheet.pdf b/src/main/resources/static/pdfs/naming_rest_api_cheat_sheet.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2f3211013e9fe3c49586e49e113220a4923b6267 Binary files /dev/null and b/src/main/resources/static/pdfs/naming_rest_api_cheat_sheet.pdf differ