コード例 #1
0
 @Override
 protected void storeAssociationValue(
     AssociationValue associationValue, String sagaType, String sagaIdentifier) {
   AssociationValueEntry associationValueEntry =
       new AssociationValueEntry(sagaIdentifier, sagaType, associationValue);
   mongoTemplate.associationsCollection().save(associationValueEntry.asDBObject());
 }
コード例 #2
0
 @Override
 protected void removeAssociationValue(
     AssociationValue associationValue, String sagaType, String sagaIdentifier) {
   DBObject query =
       AssociationValueEntry.queryBySagaIdentifierAndAssociationKeyValue(
           sagaIdentifier, associationValue.getKey(), associationValue.getValue());
   mongoTemplate.associationsCollection().findAndRemove(query);
 }
コード例 #3
0
 private synchronized void initialize() {
   if (!initialized) {
     DBCursor dbCursor = mongoTemplate.associationsCollection().find();
     getAssociationValueMap().clear();
     while (dbCursor.hasNext()) {
       AssociationValueEntry entry = new AssociationValueEntry(dbCursor.next());
       getAssociationValueMap()
           .add(entry.getAssociationValue(), entry.getSagaType(), entry.getSagaIdentifier());
     }
     initialized = true;
   }
 }