diff --git a/src/main/java/com/example/cosmos_serversb/models/Groups.java b/src/main/java/com/example/cosmos_serversb/models/Groups.java index 1b145a1..757ada5 100644 --- a/src/main/java/com/example/cosmos_serversb/models/Groups.java +++ b/src/main/java/com/example/cosmos_serversb/models/Groups.java @@ -50,6 +50,9 @@ } public static Group createGroup(String name, String uId){ + if(name == null || uId == null){ + return null; //not-null制約 + } User user = getUserById(uId); if(user == null){ return null; //存在しないユーザがグループを作成しようとした。 @@ -163,6 +166,9 @@ } public static Request addRequests(String gId, String uId, String product, String deadline, int location){ + if(product == null){ + return null; //not-null制約 + } String rId = getInstance().createRId(); String uri = baseURI + AppName + "/groups/" + gId + "/requests/" + rId; Request request = new Request(rId, uri, new Date(), uId, product, deadline, location); @@ -190,6 +196,9 @@ } public static Request updateRequest(String gId, String rId, String uId, String product, String deadline, int location, boolean done){ + if(product == null){ + return null; //not-null制約 + } Session session = SessionManager.getInstance().getSession(); Request editRequest = session.get(Request.class, rId); if(editRequest != null){