Project

General

Profile

« Previous | Next » 

Revision 57671

1. Schema changes: Move each entity on its own collection - each entity keeps ids for its sub-entities.
2. New controllers for each entity: TopicController.java, CategoryController.java, SubCategoryController.java, IndicatorController.java.
3. New DAOs for each entity: TopicDAO.java, MongoDBTopicDAO.java, CategoryDAO.java, MongoDBCategoryDAO.java, SubCategoryDAO.java, MongoDBSubCategoryDAO.java.
4. New custom Exceptions: EntityNotFoundException.java, PathNotValidException.java.
5. ExceptionsHandler.java: Handle new EntityNotFoundException (id not in db) and PathNotValidException (id exists in db but not in path given).

View differences:

Category.java
5 5

  
6 6
import java.util.List;
7 7

  
8
public class Category {
8
public class Category<StringOrSubcategory> {
9 9
    @Id
10 10
    @JsonProperty("_id")
11 11
    private String id;
......
16 16
    private boolean isPublic;
17 17
    private boolean isOverview;
18 18
    private boolean isDefault;
19
    private List<SubCategory> subCategories;
19
    private List<StringOrSubcategory> subCategories;
20 20

  
21 21
    public Category() {}
22 22
    public Category(Category category) {
23
        id = category.getId();
23 24
        name = category.getName();
24 25
        alias = category.getAlias();
25 26
        isActive = category.getIsActive();
......
28 29
        isDefault = category.getIsDefault();
29 30
    }
30 31

  
32
    public String getId() {
33
        return id;
34
    }
35

  
36
    public void setId(String id) {
37
        this.id = id;
38
    }
39

  
31 40
    public String getName() {
32 41
        return name;
33 42
    }
......
76 85
        this.isDefault = isDefault;
77 86
    }
78 87

  
79
    public List<SubCategory> getSubCategories() {
88
    public List<StringOrSubcategory> getSubCategories() {
80 89
        return subCategories;
81 90
    }
82 91

  
83
    public void setSubCategories(List<SubCategory> subCategories) {
92
    public void setSubCategories(List<StringOrSubcategory> subCategories) {
84 93
        this.subCategories = subCategories;
85 94
    }
86 95
}

Also available in: Unified diff