diff --git a/src/main/java/no/nibio/vips/logic/entity/PointOfInterestType.java b/src/main/java/no/nibio/vips/logic/entity/PointOfInterestType.java index ee2a94eb7e1e161b21f607f2ae00262224637869..c1db31674bb4ebb0f28aee74b362c2eb13745abf 100755 --- a/src/main/java/no/nibio/vips/logic/entity/PointOfInterestType.java +++ b/src/main/java/no/nibio/vips/logic/entity/PointOfInterestType.java @@ -64,6 +64,7 @@ public class PointOfInterestType implements Serializable { public static final int POINT_OF_INTEREST_TYPE_FARM = 2; public static final int POINT_OF_INTEREST_TYPE_FIELD = 3; public static final int POINT_OF_INTEREST_TYPE_REGION = 4; + public static final int POINT_OF_INTEREST_TYPE_TRAP = 5; public PointOfInterestType() { } diff --git a/src/main/java/no/nibio/vips/logic/entity/PointOfInterestTypeTrap.java b/src/main/java/no/nibio/vips/logic/entity/PointOfInterestTypeTrap.java new file mode 100644 index 0000000000000000000000000000000000000000..53e408bc31f6a67b0b3164baee9f663ae7f7a5b4 --- /dev/null +++ b/src/main/java/no/nibio/vips/logic/entity/PointOfInterestTypeTrap.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020 NIBIO <http://www.nibio.no/>. + * + * This file is part of VIPSLogic. + * VIPSLogic is free software: you can redistribute it and/or modify + * it under the terms of the NIBIO Open Source License as published by + * NIBIO, either version 1 of the License, or (at your option) any + * later version. + * + * VIPSLogic is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * NIBIO Open Source License for more details. + * + * You should have received a copy of the NIBIO Open Source License + * along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>. + * + */ + +package no.nibio.vips.logic.entity; + +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +/** + * @copyright 2023 <a href="http://www.nibio.no/">NIBIO</a> + * @author Tor-Einar Skog <tor-einar.skog@nibio.no> + */ +@Entity +@DiscriminatorValue("5") +@Table(name = "point_of_interest_trap") +public class PointOfInterestTypeTrap extends PointOfInterest implements Serializable { + +} diff --git a/src/main/java/no/nibio/vips/logic/entity/helpers/PointOfInterestFactory.java b/src/main/java/no/nibio/vips/logic/entity/helpers/PointOfInterestFactory.java index 9cd70d815bef8d1624832a26b67a7c88f2c78290..8fd0467fabbc15d05ceb920a1a432b7d84ba75e2 100644 --- a/src/main/java/no/nibio/vips/logic/entity/helpers/PointOfInterestFactory.java +++ b/src/main/java/no/nibio/vips/logic/entity/helpers/PointOfInterestFactory.java @@ -19,12 +19,7 @@ package no.nibio.vips.logic.entity.helpers; -import no.nibio.vips.logic.entity.PointOfInterest; -import no.nibio.vips.logic.entity.PointOfInterestType; -import no.nibio.vips.logic.entity.PointOfInterestTypeFarm; -import no.nibio.vips.logic.entity.PointOfInterestTypeField; -import no.nibio.vips.logic.entity.PointOfInterestTypeRegion; -import no.nibio.vips.logic.entity.PointOfInterestWeatherStation; +import no.nibio.vips.logic.entity.*; /** * @copyright 2020 <a href="http://www.nibio.no/">NIBIO</a> @@ -42,6 +37,8 @@ public class PointOfInterestFactory { return new PointOfInterestTypeField(); case PointOfInterestType.POINT_OF_INTEREST_TYPE_REGION: return new PointOfInterestTypeRegion(); + case PointOfInterestType.POINT_OF_INTEREST_TYPE_TRAP: + return new PointOfInterestTypeTrap(); default: return new PointOfInterest(); } diff --git a/src/main/resources/db/migration/V12__POI_type_added.sql b/src/main/resources/db/migration/V12__POI_type_added.sql new file mode 100644 index 0000000000000000000000000000000000000000..fed7797083310f7bd1212b49e5ea462162aff968 --- /dev/null +++ b/src/main/resources/db/migration/V12__POI_type_added.sql @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020 NIBIO <http://www.nibio.no/>. + * + * This file is part of VIPSLogic. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ +/** + * Author: Tor-Einar Skog <tor-einar.skog@nibio.no> + * Created: May 10th, 2023 + */ + +-- Create POI type trap as entity +CREATE TABLE public.point_of_interest_trap ( + point_of_interest_id INTEGER REFERENCES public.point_of_interest(point_of_interest_id) PRIMARY KEY REFERENCES public.point_of_interest(point_of_interest_id) +); + +INSERT INTO public.point_of_interest_type (point_of_interest_type_id, default_name) +VALUES (5, 'Trap'); diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts.properties index b97d60170a0935b8a1efe1fec551367afb928403..5aa15272b9959ee8574cac22ccb5fecab2d0e921 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts.properties @@ -1042,3 +1042,4 @@ allRoles=All roles allStatuses=All statuses LEAFBLOTCH=Leaf blotch model universalMessageSettingsLink_tpl=To edit your notification subscriptions, please use this link: {0} +pointOfInterestType_5=Trap diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_bs.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_bs.properties index f2572880428953a51d7cf3b0b16fdd1eb3b2e4bb..a85c1e94ad8ee6b6ef8db46a1ba5ce0e2bbe8ca9 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_bs.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_bs.properties @@ -1035,3 +1035,4 @@ allRoles=All roles allStatuses=All statuses LEAFBLOTCH=Leaf blotch model universalMessageSettingsLink_tpl=To edit your VIPS notification subscriptions, please use this link: {0} +pointOfInterestType_5=Trap diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_hr.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_hr.properties index 34aa7af55b5da0ba8a177adad58bc151a048c0a6..1202bdc40a5ca2ac5fa70b708960ecea10d31c4e 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_hr.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_hr.properties @@ -1034,3 +1034,4 @@ allRoles=All roles allStatuses=All statuses LEAFBLOTCH=Leaf blotch model universalMessageSettingsLink_tpl=To edit your notification subscriptions, please use this link: {0} +pointOfInterestType_5=Trap diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_nb.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_nb.properties index dbb321573390e03808b79539176f6f3728140b17..e0ef36175e7da15b066e65d804ced7b676505752 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_nb.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_nb.properties @@ -1043,3 +1043,4 @@ allRoles=Alle roller allStatuses=Alle statuser LEAFBLOTCH=Bladflekksjukdomsmodell universalMessageSettingsLink_tpl=For � endre dine abonnement p� push-varsler fra VIPS, bruk denne lenken: {0} +pointOfInterestType_5=Felle diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_sr.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_sr.properties index bc87ecca6d84dc9faadab56873fe9dfe062c6297..29a3b621379287f521f81a3098344a648e1e4625 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_sr.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_sr.properties @@ -1036,3 +1036,4 @@ allRoles=All roles allStatuses=All statuses LEAFBLOTCH=Leaf blotch model universalMessageSettingsLink_tpl=To edit your notification subscriptions, please use this link: {0} +pointOfInterestType_5=Trap diff --git a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_zh_CN.properties b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_zh_CN.properties index 3bb3a5d8a33d9557f250e39e15f408ec751cec88..6659caa0ac80f4702546d3d0ff4d94ec475af36e 100755 --- a/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_zh_CN.properties +++ b/src/main/resources/no/nibio/vips/logic/i18n/vipslogictexts_zh_CN.properties @@ -1029,3 +1029,4 @@ allRoles=All roles allStatuses=All statuses LEAFBLOTCH=Leaf blotch model universalMessageSettingsLink_tpl=To edit your notification subscriptions, please use this link: {0} +pointOfInterestType_5=Trap diff --git a/src/main/webapp/templates/poiForm.ftl b/src/main/webapp/templates/poiForm.ftl index 74555332c817007ad19dcbb53abce4eb465f27ed..b2d0274b7f1949ab1a1e37a515724b7cca1761b7 100755 --- a/src/main/webapp/templates/poiForm.ftl +++ b/src/main/webapp/templates/poiForm.ftl @@ -84,7 +84,7 @@ <div class="form-group"> <label for="pointOfInterestTypeId">${i18nBundle.pointOfInterestType}</label> <select class="form-control" name="pointOfInterestTypeId" onblur="validateField(this);"> - <#list 0..3 as pointOfInterestTypeId> + <#list [0,1,2,3,5] as pointOfInterestTypeId> <#if pointOfInterestTypeId != 1> <option value="${pointOfInterestTypeId}"<#if poi.pointOfInterestTypeId?has_content && pointOfInterestTypeId == poi.pointOfInterestTypeId