-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
200 additions
and
7 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/alfio/model/AdditionalServiceFieldValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* This file is part of alf.io. | ||
* | ||
* alf.io is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* alf.io 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package alfio.model; | ||
|
||
import ch.digitalfondue.npjt.ConstructorAnnotationRowMapper.Column; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class AdditionalServiceFieldValue { | ||
|
||
private final int additionalServiceId; | ||
private final int ticketFieldConfigurationId; | ||
private final String name; | ||
private final String value; | ||
|
||
public AdditionalServiceFieldValue(@Column("additional_service_id_fk") int additionalServiceId, | ||
@Column("ticket_field_configuration_id_fk") int ticketFieldConfigurationId, | ||
@Column("field_name") String name, | ||
@Column("field_value") String value) { | ||
this.additionalServiceId = additionalServiceId; | ||
this.ticketFieldConfigurationId = ticketFieldConfigurationId; | ||
this.name = name; | ||
this.value = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/alfio/repository/AdditionalServiceDescriptionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package alfio.repository; | ||
|
||
import alfio.model.AdditionalServiceDescription; | ||
import ch.digitalfondue.npjt.Bind; | ||
import ch.digitalfondue.npjt.Query; | ||
import ch.digitalfondue.npjt.QueryRepository; | ||
|
||
import java.util.List; | ||
|
||
@QueryRepository | ||
public interface AdditionalServiceDescriptionRepository { | ||
|
||
@Query("select additional_service_id_fk, locale, type, value from additional_service_description where additional_service_id_fk = :additionalServiceId") | ||
List<AdditionalServiceDescription> findAllByAdditionalServiceId(@Bind("additionalServiceId") int additionalServiceId); | ||
|
||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/alfio/repository/AdditionalServiceFieldValueRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package alfio.repository; | ||
|
||
import alfio.model.AdditionalServiceFieldValue; | ||
import alfio.model.FieldNameAndValue; | ||
import ch.digitalfondue.npjt.Bind; | ||
import ch.digitalfondue.npjt.Query; | ||
import ch.digitalfondue.npjt.QueryRepository; | ||
|
||
import java.util.List; | ||
|
||
@QueryRepository | ||
public interface AdditionalServiceFieldValueRepository { | ||
|
||
@Query("select a.additional_service_id_fk, a.ticket_field_configuration_id_fk, b.field_name, a.field_value from additional_service_field_value a, ticket_field_configuration b where a.additional_service_id_fk = :additionalServiceId and a.ticket_field_configuration_id_fk = b.id and b.context = 'ADDITIONAL_SERVICE'") | ||
List<AdditionalServiceFieldValue> findAllByAdditionalServiceId(@Bind("additionalServiceId") int id); | ||
|
||
@Query("update additional_service_field_value set field_value = :value where additional_service_id_fk = :additionalServiceId and ticket_field_configuration_id_fk = :fieldConfigurationId") | ||
int updateValue(@Bind("additionalServiceId") int additionalServiceId, @Bind("fieldConfigurationId") int fieldConfigurationId, @Bind("value") String value); | ||
|
||
@Query("insert into additional_service_field_value(additional_service_id_fk, ticket_field_configuration_id_fk, field_value) values (:ticketId, :fieldConfigurationId, :value)") | ||
int insertValue(@Bind("additionalServiceId") int additionalServiceId, @Bind("fieldConfigurationId") int fieldConfigurationId, @Bind("value") String value); | ||
|
||
@Query("delete from additional_service_field_value where additional_service_id_fk = :additionalServiceId and ticket_field_configuration_id_fk = :fieldConfigurationId") | ||
int deleteValue(@Bind("additionalServiceId") int ticketId, @Bind("fieldConfigurationId") int fieldConfigurationId); | ||
|
||
@Query("delete from additional_service_field_value where ticket_field_configuration_id_fk = :fieldConfigurationId") | ||
int deleteValues(@Bind("fieldConfigurationId") int ticketFieldConfigurationId); | ||
|
||
@Query("select field_name, field_value from additional_service_field_value inner join ticket_field_configuration on ticket_field_configuration_id_fk = id where additional_service_id_fk = :additionalServiceId and context = 'ADDITIONAL_SERVICE'") | ||
List<FieldNameAndValue> findNameAndValue(@Bind("additionalServiceId") int additionalServiceId); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/resources/alfio/db/HSQLDB/V15_1.8.2__ALTER_TICKET_FIELD_CONF.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- | ||
-- This file is part of alf.io. | ||
-- | ||
-- alf.io is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- alf.io 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 General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
alter table ticket_field_configuration add column additional_service_id_fk integer; | ||
alter table ticket_field_configuration add FOREIGN KEY (additional_service_id_fk) REFERENCES ADDITIONAL_SERVICE(ID); | ||
|
||
-- drop old constraints | ||
alter table ticket_field_configuration drop constraint "unique_ticket_field_configuration"; | ||
-- add new constraints | ||
alter table ticket_field_configuration add constraint "unique_ticket_field_configuration" unique(event_id_fk, field_name, additional_service_id_fk, context); | ||
|
||
create table additional_service_field_value( | ||
additional_service_id_fk int not null, | ||
ticket_field_configuration_id_fk int not null, | ||
field_value varchar(2048), | ||
PRIMARY KEY (additional_service_id_fk, ticket_field_configuration_id_fk) | ||
); | ||
|
||
alter table additional_service_field_value add foreign key(additional_service_id_fk) references additional_service(id); | ||
alter table additional_service_field_value add foreign key(ticket_field_configuration_id_fk) references ticket_field_configuration(id); |
34 changes: 34 additions & 0 deletions
34
src/main/resources/alfio/db/MYSQL/V15_1.8.2__ALTER_TICKET_FIELD_CONF.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- | ||
-- This file is part of alf.io. | ||
-- | ||
-- alf.io is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- alf.io 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 General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
alter table ticket_field_configuration add column additional_service_id_fk integer; | ||
alter table ticket_field_configuration add FOREIGN KEY (additional_service_id_fk) REFERENCES ADDITIONAL_SERVICE(ID); | ||
|
||
-- drop old constraints | ||
alter table ticket_field_configuration drop index "unique_ticket_field_configuration"; | ||
-- add new constraints | ||
alter table ticket_field_configuration add constraint "unique_ticket_field_configuration" unique(event_id_fk, field_name, additional_service_id_fk, context); | ||
|
||
create table additional_service_field_value( | ||
additional_service_id_fk int not null, | ||
ticket_field_configuration_id_fk int not null, | ||
field_value varchar(2048), | ||
PRIMARY KEY (additional_service_id_fk, ticket_field_configuration_id_fk) | ||
) ENGINE=InnoDB CHARACTER SET=utf8 COLLATE utf8_bin; | ||
|
||
alter table additional_service_field_value add foreign key(additional_service_id_fk) references additional_service(id); | ||
alter table additional_service_field_value add foreign key(ticket_field_configuration_id_fk) references ticket_field_configuration(id); |
34 changes: 34 additions & 0 deletions
34
src/main/resources/alfio/db/PGSQL/V15_1.8.2__ALTER_TICKET_FIELD_CONF.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- | ||
-- This file is part of alf.io. | ||
-- | ||
-- alf.io is free software: you can redistribute it and/or modify | ||
-- it under the terms of the GNU General Public License as published by | ||
-- the Free Software Foundation, either version 3 of the License, or | ||
-- (at your option) any later version. | ||
-- | ||
-- alf.io 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 General Public License for more details. | ||
-- | ||
-- You should have received a copy of the GNU General Public License | ||
-- along with alf.io. If not, see <http://www.gnu.org/licenses/>. | ||
-- | ||
|
||
alter table ticket_field_configuration add column additional_service_id_fk integer; | ||
alter table ticket_field_configuration add FOREIGN KEY (additional_service_id_fk) REFERENCES ADDITIONAL_SERVICE(ID); | ||
|
||
-- drop old constraints | ||
alter table ticket_field_configuration drop constraint "unique_ticket_field_configuration"; | ||
-- add new constraints | ||
alter table ticket_field_configuration add constraint "unique_ticket_field_configuration" unique(event_id_fk, field_name, additional_service_id_fk, context); | ||
|
||
create table additional_service_field_value( | ||
additional_service_id_fk int not null, | ||
ticket_field_configuration_id_fk int not null, | ||
field_value varchar(2048), | ||
PRIMARY KEY (additional_service_id_fk, ticket_field_configuration_id_fk) | ||
); | ||
|
||
alter table additional_service_field_value add foreign key(additional_service_id_fk) references additional_service(id); | ||
alter table additional_service_field_value add foreign key(ticket_field_configuration_id_fk) references ticket_field_configuration(id); |