From fa5c0810fea51bba2f396d51d1a875326c8b220a Mon Sep 17 00:00:00 2001 From: Taciano Silva Date: Fri, 7 Oct 2022 18:08:33 -0300 Subject: [PATCH] refactor: Id tipo IDENTITY para postgres #64 --- .../br/ufrn/dct/apf/model/Attribution.java | 4 +- .../br/ufrn/dct/apf/model/DataFunction.java | 30 ++++++------- .../java/br/ufrn/dct/apf/model/Member.java | 6 +-- .../java/br/ufrn/dct/apf/model/Project.java | 2 +- src/main/java/br/ufrn/dct/apf/model/Role.java | 2 +- .../dct/apf/model/TransactionFunction.java | 42 +++++++++---------- src/main/java/br/ufrn/dct/apf/model/User.java | 2 +- .../java/br/ufrn/dct/apf/model/UserStory.java | 10 ++--- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/main/java/br/ufrn/dct/apf/model/Attribution.java b/src/main/java/br/ufrn/dct/apf/model/Attribution.java index 9940df8..41c67a2 100644 --- a/src/main/java/br/ufrn/dct/apf/model/Attribution.java +++ b/src/main/java/br/ufrn/dct/apf/model/Attribution.java @@ -22,11 +22,11 @@ public class Attribution implements Serializable { * Regra para definir permissões membros de um projeto. */ public static final String PROJECT_MANAGER = "PROJECT MANAGER"; - + public static final String PROJECT_MEMBER = "PROJECT MEMBER"; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "attrib_id") private int id; diff --git a/src/main/java/br/ufrn/dct/apf/model/DataFunction.java b/src/main/java/br/ufrn/dct/apf/model/DataFunction.java index 88916bc..ac95860 100644 --- a/src/main/java/br/ufrn/dct/apf/model/DataFunction.java +++ b/src/main/java/br/ufrn/dct/apf/model/DataFunction.java @@ -17,9 +17,9 @@ * Internal Logical Files * External Interface Files * - * Data Functions are made up of internal and external resources + * Data Functions are made up of internal and external resources * that affect the system. - * + * * @author Taciano Morais Silva * @since 04/04/2019 */ @@ -33,11 +33,11 @@ public class DataFunction implements Serializable { private static final long serialVersionUID = 1L; public static final String TYPE_ILF = "TYPE_ILF"; - + public static final String TYPE_EIF = "TYPE_EIF"; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "data_id") private Long id; @@ -49,9 +49,9 @@ public class DataFunction implements Serializable { /** * number of Record Element Types (RET). - * + * * A Record Element Type (RET) is the largest user identifiable subgroup - * of elements within an ILF or an EIF. It is best to look at logical + * of elements within an ILF or an EIF. It is best to look at logical * groupings of data to help identify them. */ @Column(name = "ret") @@ -59,20 +59,20 @@ public class DataFunction implements Serializable { /** * number of Data Element Types (DET). - * - * Data Element Type (DET) is the data subgroup within an FTR. + * + * Data Element Type (DET) is the data subgroup within an FTR. * They are unique and user identifiable. */ @Column(name = "det") private Long dataElementTypes; - + @Column(name = "description") private String description; @ManyToOne @JoinColumn(name = "user_story_id", nullable = true) private UserStory userStory; - + @ManyToOne @JoinColumn(name = "project_id", nullable = true) private Project project; @@ -91,7 +91,7 @@ public class DataFunction implements Serializable { public static DataFunction createILF(String name) { return new DataFunction(name, TYPE_ILF); } - + /** * External Interface Files (EIF’s, in Portuguese, Arquivos Interface Externa - AIE's). * @@ -109,7 +109,7 @@ public static DataFunction createILF(String name) { public static DataFunction createEIF(String name) { return new DataFunction(name, TYPE_EIF); } - + public DataFunction() {} private DataFunction(String name, String type) { @@ -140,7 +140,7 @@ public String getType() { public void setType(String type) { this.type = type; } - + public String getDescription() { return description; } @@ -184,7 +184,7 @@ public void setUserStory(UserStory us) { public boolean isILF() { return getType().equals(TYPE_ILF); } - + public boolean isEIF() { return getType().equals(TYPE_EIF); } @@ -216,7 +216,7 @@ public boolean equals(Object obj) { return other.name == null; } else return name.equals(other.name); } - + @Override public String toString() { return "DataFunction@" + this.id + "@"+ this.type +"[" + this.name + "]"; diff --git a/src/main/java/br/ufrn/dct/apf/model/Member.java b/src/main/java/br/ufrn/dct/apf/model/Member.java index d8d6e59..adfa2bb 100644 --- a/src/main/java/br/ufrn/dct/apf/model/Member.java +++ b/src/main/java/br/ufrn/dct/apf/model/Member.java @@ -26,7 +26,7 @@ public class Member implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "member_id") private Long id; @@ -37,7 +37,7 @@ public class Member implements Serializable { @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "project_id", nullable = false) private Project project; - + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "attrib_id", nullable = false) private Attribution attribution; @@ -70,7 +70,7 @@ public Project getProject() { public void setProject(Project project) { this.project = project; } - + public Attribution getAttribution() { return attribution; } diff --git a/src/main/java/br/ufrn/dct/apf/model/Project.java b/src/main/java/br/ufrn/dct/apf/model/Project.java index cdc652a..c73120b 100644 --- a/src/main/java/br/ufrn/dct/apf/model/Project.java +++ b/src/main/java/br/ufrn/dct/apf/model/Project.java @@ -29,7 +29,7 @@ public class Project implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "project_id") private Long id; diff --git a/src/main/java/br/ufrn/dct/apf/model/Role.java b/src/main/java/br/ufrn/dct/apf/model/Role.java index 46d95a7..66a60f0 100644 --- a/src/main/java/br/ufrn/dct/apf/model/Role.java +++ b/src/main/java/br/ufrn/dct/apf/model/Role.java @@ -26,7 +26,7 @@ public class Role implements Serializable { public static final String ADMIN_ROLE = "ADMIN"; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "role_id") private int id; diff --git a/src/main/java/br/ufrn/dct/apf/model/TransactionFunction.java b/src/main/java/br/ufrn/dct/apf/model/TransactionFunction.java index e98a6e7..60b963a 100644 --- a/src/main/java/br/ufrn/dct/apf/model/TransactionFunction.java +++ b/src/main/java/br/ufrn/dct/apf/model/TransactionFunction.java @@ -19,12 +19,12 @@ * External Inputs * External Outputs * External Inquiries - * + * * Transaction functions are made up of the processes that are exchanged * between the user, the external applications and the application being measured. - * + * * https://www.tutorialspoint.com/estimation_techniques/estimation_techniques_function_points.htm - * + * * @author Taciano Morais Silva * @version 1.0 * @since 23/05/2019, 14h11m @@ -40,19 +40,19 @@ public class TransactionFunction implements Serializable { private static final long serialVersionUID = 1L; /** - * External Input (EI) is a transaction function in which Data goes “into” - * the application from outside the boundary to inside. This data is coming + * External Input (EI) is a transaction function in which Data goes “into” + * the application from outside the boundary to inside. This data is coming * external to the application. */ public static final String TYPE_EI = "TYPE_EI"; - + /** * External Output (EO) is a transaction function in which data comes “out” * of the system. Additionally, an EO may update an ILF. The data creates reports * or output files sent to other applications. */ public static final String TYPE_EO = "TYPE_EO"; - + /** * External Inquiry (EQ) is a transaction function * with both input and output components that result in data retrieval. @@ -60,7 +60,7 @@ public class TransactionFunction implements Serializable { public static final String TYPE_EQ = "TYPE_EQ"; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "trans_id") private Long id; @@ -72,8 +72,8 @@ public class TransactionFunction implements Serializable { /** * number of File Type Referenced (FTR). - * - * File Type Referenced (FTR) is the largest user identifiable subgroup + * + * File Type Referenced (FTR) is the largest user identifiable subgroup * within the EI, EO, or EQ that is referenced to. */ @Column(name = "ftr") @@ -81,20 +81,20 @@ public class TransactionFunction implements Serializable { /** * number of Data Element Types (DET). - * - * Data Element Type (DET) is the data subgroup within an FTR. + * + * Data Element Type (DET) is the data subgroup within an FTR. * They are unique and user identifiable. */ @Column(name = "det") private Integer dataElementTypes; - + @Column(name = "description") private String description; @ManyToOne @JoinColumn(name = "user_story_id", nullable = true) private UserStory userStory; - + @ManyToOne @JoinColumn(name = "project_id", nullable = true) private Project project; @@ -102,15 +102,15 @@ public class TransactionFunction implements Serializable { public static TransactionFunction createEI(String name) { return new TransactionFunction(name, TYPE_EI); } - + public static TransactionFunction createEO(String name) { return new TransactionFunction(name, TYPE_EO); } - + public static TransactionFunction createEQ(String name) { return new TransactionFunction(name, TYPE_EQ); } - + public TransactionFunction() {} private TransactionFunction(String name, String type) { @@ -141,7 +141,7 @@ public String getType() { public void setType(String type) { this.type = type; } - + public String getDescription() { return description; } @@ -185,11 +185,11 @@ public void setUserStory(UserStory us) { public boolean isEI() { return getType().equals(TYPE_EI); } - + public boolean isEO() { return getType().equals(TYPE_EO); } - + public boolean isEQ() { return getType().equals(TYPE_EQ); } @@ -224,7 +224,7 @@ public boolean equals(Object obj) { return false; return true; } - + @Override public String toString() { return "TransactionFunction@" + this.id + "@"+ this.type +"[" + this.name + "]"; diff --git a/src/main/java/br/ufrn/dct/apf/model/User.java b/src/main/java/br/ufrn/dct/apf/model/User.java index 2fb5349..5735335 100644 --- a/src/main/java/br/ufrn/dct/apf/model/User.java +++ b/src/main/java/br/ufrn/dct/apf/model/User.java @@ -31,7 +31,7 @@ public class User implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id") private Long id; diff --git a/src/main/java/br/ufrn/dct/apf/model/UserStory.java b/src/main/java/br/ufrn/dct/apf/model/UserStory.java index 11517e5..d425e00 100644 --- a/src/main/java/br/ufrn/dct/apf/model/UserStory.java +++ b/src/main/java/br/ufrn/dct/apf/model/UserStory.java @@ -26,7 +26,7 @@ public class UserStory implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_story_id") private Long id; @@ -44,7 +44,7 @@ public class UserStory implements Serializable { @OneToMany(mappedBy = "userStory", targetEntity = DataFunction.class, fetch = FetchType.EAGER) private Set dataFunctions = new HashSet<>(); - + @OneToMany(mappedBy = "userStory", targetEntity = TransactionFunction.class, fetch = FetchType.EAGER) private Set transactions = new HashSet<>(); @@ -105,15 +105,15 @@ public void addData(DataFunction data) { dataFunctions.add(data); } } - + public Set getTransactionFunctions() { return transactions; } - + public void setTransactionFunctions(Set transactions) { this.transactions = transactions; } - + public void addTransaction(TransactionFunction transaction) { if (transaction != null) { transaction.setUserStory(this);