This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface DataSource { | |
List<Entity> getEntities(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PublicIdentifier { | |
private static final Pattern ALLOWED_REGEX = Pattern.compile("[a-zA-Z\\-_]*"); | |
private String value; | |
public PublicIdentifier(String value) { | |
validate(value); | |
this.value = value; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Target { | |
private static final Pattern ALLOWED_REGEX = Pattern.compile("[a-zA-Z\\-_]*"); | |
private String code; | |
private String name; | |
private String publicIdentifier; | |
public Target(String code, String name, String publicIdentifier) { | |
validate(code, "code"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Target { | |
private String code; | |
private String name; | |
private String publicIdentifier; | |
public Target(String code, String name, String publicIdentifier) { | |
this.code = code; | |
this.name = name; | |
this.publicIdentifier = publicIdentifier; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeMongoTest | |
private static InMemoryMongo inMemoryMongo; | |
private static Client client; | |
@BeforeClass | |
public static void setUpClass() throws Exception { | |
inMemoryMongo = new InMemoryMongo().start(); | |
client = inMemoryMongo.getClient(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class InMemoryMongo { | |
private static final String DATA_PATH = "./target/elasticsearch"; | |
private Node node; | |
private Client client; | |
public InMemoryMongo() { | |
} | |
public InMemoryMongo start() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityServiceImpl implements EntityService { | |
private EntityRepository repository; | |
private ImageService imageService; | |
private EntityObservers entityObservers; | |
@Override | |
public void update(String id, UpdateData updateData) { | |
Entity entity = repository.find(id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityServiceImpl implements EntityService { | |
private EntityRepository repository; | |
private ImageService imageService; | |
@Override | |
public void update(String id, UpdateData updateData) { | |
Entity entity = repository.find(id); | |
ImageEntity image = imageService.getImage(updateData.getImageUrl()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityServiceImpl implements EntityService { | |
private EntityRepository repository; | |
private ImageService imageService; | |
@Override | |
public void update(String id, UpdateData updateData) { | |
Entity entity = repository.find(id); | |
entity.setDescription(updateData.getDescription()); | |
entity.setTitle(updateData.getTitle()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityServiceImp implements EntityService { | |
private EntityRepository repository; | |
private ImageService imageService; | |
@Override | |
public void update(String id, UpdateData updateData) { | |
Entity entity = repository.find(id); | |
entity.setDescription(updateData.getDescription()); | |
entity.setTitle(updateData.getTitle()); |