-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8943d63
commit 8acc384
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
beacon-engine/src/main/resources/db/migration/V2.11__create_table_list_value_unicorn.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,16 @@ | ||
CREATE TABLE list_value_unicorn ( | ||
id bigint(20) NOT NULL AUTO_INCREMENT, | ||
type varchar(255) DEFAULT NULL, | ||
uri varchar(255) DEFAULT NULL, | ||
value varchar(255) DEFAULT NULL, | ||
pulse_id bigint(20) DEFAULT NULL, | ||
PRIMARY KEY (id), | ||
KEY FK_list_value_unicorn (pulse_id) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
||
ALTER TABLE list_value_unicorn | ||
ADD CONSTRAINT fk_list_value_unicorn_1 | ||
FOREIGN KEY (pulse_id) | ||
REFERENCES vdf_unicorn (id) | ||
ON DELETE NO ACTION | ||
ON UPDATE NO ACTION; |
36 changes: 36 additions & 0 deletions
36
beacon-interface/src/main/java/com/example/beacon/interfac/infra/ListValueUnicornEntity.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,36 @@ | ||
package com.example.beacon.interfac.infra; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
|
||
@Data | ||
@Entity | ||
@Table(name = "list_value_unicorn") | ||
public class ListValueUnicornEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String value; | ||
|
||
private String type; | ||
|
||
private String uri; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "pulse_id") | ||
private PulseEntity pulseEntity; | ||
|
||
public ListValueUnicornEntity() { | ||
} | ||
|
||
public ListValueUnicornEntity(String value, String type, String uri, PulseEntity pulseEntity) { | ||
this.value = value; | ||
this.type = type; | ||
this.uri = uri; | ||
this.pulseEntity = pulseEntity; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
beacon-interface/src/test/java/com/example/beacon/shared/ListValue.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,36 @@ | ||
package com.example.beacon.shared; | ||
|
||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
|
||
//@Getter | ||
@Data | ||
@NoArgsConstructor | ||
public class ListValue { | ||
|
||
private String uri; | ||
|
||
private String type; | ||
|
||
private String value; | ||
|
||
private ListValue(@NonNull String value, @NonNull String type, String uri) { | ||
this.value = value; | ||
this.type = type; | ||
this.uri = uri; | ||
} | ||
|
||
public static ListValue getOneValue(String value, String type, String uri){ | ||
return new ListValue(value, type, uri); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ListValue{" + | ||
"value='" + value + '\'' + | ||
", type='" + type + '\'' + | ||
", uri='" + uri + '\'' + | ||
'}'; | ||
} | ||
} |