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
| AWSTemplateFormatVersion: 2010-09-09 | |
| Parameters: | |
| Database1Name: | |
| Type: String | |
| Default: datazone_test1_database | |
| Database2Name: | |
| Type: String | |
| Default: datazone_test2_database | |
| DataZoneDomainName: |
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
| { | |
| "_id" : "595393945af3162ab4df27f2", | |
| "_optimisticLock" : 0, | |
| "audit" : { | |
| "createdBy" : "anonymous", | |
| "createdDate" : "2017-06-28T11:31:31.984Z", | |
| "lastModifiedBy" : "anonymous", | |
| "lastModifiedDate" : "2017-06-28T11:31:31.984Z" | |
| }, | |
| "current" : { |
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
| @Document(collection = "project") | |
| public class ProjectDocument extends AbstractVersionnedDocument<ProjectEntity> { | |
| @Override | |
| protected ProjectEntity createNewInstance() { | |
| return new ProjectEntity(); | |
| } | |
| } | |
| public class ProjectEntity extends AbstractVersionnedEntity { | |
| @Field("name") |
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
| @Component | |
| @EnableMongoAuditing | |
| public class AuditorAwareImpl implements AuditorAware<String> { | |
| private final static String DEFAULT_USER = "anonymous"; | |
| @Override | |
| public String getCurrentAuditor() { | |
| return DEFAULT_USER; //do you custom user retrieving policy here | |
| } |
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
| @Component | |
| public class VersionnedDocumentMongoEventListener extends AbstractMongoEventListener<AbstractVersionnedDocument> { | |
| @Autowired | |
| private MongoClient mongoClient; | |
| @Autowired | |
| private MongoTemplate mongoTemplate; | |
| private static final Logger log = LoggerFactory.getLogger(AssemblyAggregateMongoEventListener.class); |
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 abstract class AbstractVersionnedEntity { | |
| @Field("audit.v") | |
| protected Long version; | |
| @Field("audit.createdBy") | |
| protected String createdBy; | |
| @Field("audit.createdDate") | |
| protected LocalDateTime createdDate; |
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
| /** | |
| * Base document for versionning an entity | |
| * | |
| * @param <T> | |
| */ | |
| public abstract class AbstractVersionnedDocument<T extends AbstractVersionnedEntity> { | |
| @Id | |
| protected String 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
| /** | |
| * Base document for versionning an entity | |
| * | |
| * @param <T> | |
| */ | |
| public abstract class AbstractVersionnedDocument<T extends AbstractVersionnedEntity> { | |
| @Id | |
| protected String id; |