Skip to content

Commit

Permalink
#22: Disable setting an id during Space creation
Browse files Browse the repository at this point in the history
  • Loading branch information
gowthamnvv committed Oct 21, 2021
1 parent 49e123d commit e525cc8
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import dev.morphia.annotations.Property;
import edu.illinois.ncsa.incore.common.auth.PrivilegeLevel;
import edu.illinois.ncsa.incore.common.auth.Privileges;
import org.bson.json.JsonParseException;
import org.bson.types.ObjectId;

import javax.xml.bind.annotation.XmlRootElement;
Expand All @@ -32,7 +33,7 @@
public class Space {
@Id
@Property("_id")
private ObjectId id = new ObjectId();
private ObjectId id;

@JsonProperty("metadata")
private SpaceMetadata metadata;
Expand All @@ -54,13 +55,11 @@ public Space(String name) {
}

public String getId() {

return id.toString();
}

public void setId(String id) {

this.id = new ObjectId(id);
private void setId(ObjectId id) {
throw new JsonParseException("Ids are auto-generated by the system. Setting an id is not allowed");
}

public String getName() {
Expand Down

0 comments on commit e525cc8

Please sign in to comment.