OB3-10
com.obsidiansoft.core.domain.UUIDObject
- We suggest to rename this class to “IdentifiableObject”.
- It is better to use a more native type for MongoDB identifier like org.bson.types.ObjectId. Also we must keep the reference to the old database tables. So we declare one more field in this class.
- We suggest to remove Serializable interface – it is useless in this case.
- So, in the end the class should look like:
package com.obsidiansoft.core.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
@EqualsAndHashCode
public abstract class IdentifiableObject {
@Id
@Getter
@Setter
private ObjectId id;
/**
* The old MySQL database primary key. May be removed after full migration.
*/
@Indexed
@Getter
@Setter
private long oldDatabaseId;
}
com.obsidiansoft.core.model.SourceTool
- The fields enabled, visible, searchable and dynamicLoading can be simplified. There is no need to use a reference-type and @NotNull Just a value-type can be used instead.
General
- According to the changing of the type of primary key to ObjectId, the repository interfaces have to be refactored with new generic type. For example:
- Looking at a large number of example, the Mongo repository interfaces does not require @Repository.
- Since you decide to use a convention with the “I” prefix for interfaces naming like IMonitorService – you should remove the “Impl” suffix out of the implementation class name: MonitorServiceImple have to be renamed to MonitorService.
- It is common practice to place interfaces and their implementations in the same folder. Currently all interfaces are gathered in a separate package obsidiansoft.core.service.interfaces – and this is wrong.



