Examples of AssociationValue


Examples of org.axonframework.saga.AssociationValue

    private Set<AssociationValue> toAssociationSet(DBObject dbSaga) {
        Set<AssociationValue> values = new HashSet<AssociationValue>();
        List<DBObject> list = (List<DBObject>) dbSaga.get(ASSOCIATIONS);
        if (list != null) {
            for (DBObject item : list) {
                values.add(new AssociationValue((String) item.get(ASSOCIATION_KEY),
                                                (String) item.get(ASSOCIATION_VALUE)));
            }
        }
        return values;
    }
View Full Code Here

Examples of org.axonframework.saga.AssociationValue

                    }
                });
        // the event is scheduled in 50ms, which is generally enough to get the saga committed
        Thread.sleep(150);
        Set<String> actualResult = repository.find(SimpleTimingSaga.class,
                                                   new AssociationValue("association", someAssociationValue));
        assertEquals(1, actualResult.size());
        SimpleTimingSaga saga = (SimpleTimingSaga) repository.load(actualResult.iterator().next());
        assertTrue("Expected saga to be triggered", saga.isTriggered());
        // we make sure all submitted jobs are executed successfully. get() will throw an exception if a job had failed
        for (Future<?> future : executorService.getResults()) {
View Full Code Here

Examples of org.axonframework.saga.AssociationValue

     *
     * @param identifier the identifier to initialize the saga with.
     */
    protected AbstractAnnotatedSaga(String identifier) {
        this.identifier = identifier;
        associationValues.add(new AssociationValue("sagaIdentifier", identifier));
    }
View Full Code Here

Examples of org.axonframework.saga.AssociationValue

     *
     * @param key   The key of the association value to associate this saga with.
     * @param value The value of the association value to associate this saga with.
     */
    protected void associateWith(String key, String value) {
        associationValues.add(new AssociationValue(key, value));
    }
View Full Code Here

Examples of org.axonframework.saga.AssociationValue

     *
     * @param key   The key of the association value to remove from this saga.
     * @param value The value of the association value to remove from this saga.
     */
    protected void removeAssociationWith(String key, String value) {
        associationValues.remove(new AssociationValue(key, value));
    }
View Full Code Here

Examples of org.geomajas.layer.feature.attribute.AssociationValue

  @Test
  public void testManyToOneAttribute() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    AssociationValue value = new AssociationValue(new LongAttribute(),new HashMap<String, Attribute<?>>(), false);
    value.getAllAttributes().put("stringAttr",new StringAttribute("mto"));
    attributes.put("manyToOneAttr", new ManyToOneAttribute(value));
    service.setAttributes(bean, layerBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertNotNull(bean.getManyToOneAttr());
    Assert.assertEquals("mto",bean.getManyToOneAttr().getStringAttr());
    // test replacing
View Full Code Here

Examples of org.geomajas.layer.feature.attribute.AssociationValue

 
  @Test
  public void testNonEditable() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    AssociationValue value = new AssociationValue(new LongAttribute(),new HashMap<String, Attribute<?>>(), false);
    value.getAllAttributes().put("stringAttr",new StringAttribute("mto"));
    attributes.put("manyToOneAttr", new ManyToOneAttribute(value));
    attributes.put("stringAttr", new StringAttribute("top"));
    service.setAttributes(bean, layerNonEditableBeans.getLayerInfo().getFeatureInfo(), new DummyMapper(), attributes);
    Assert.assertNotNull(bean.getManyToOneAttr());
    Assert.assertNull(bean.getManyToOneAttr().getStringAttr());
View Full Code Here

Examples of org.geomajas.layer.feature.attribute.AssociationValue

      switch (associationAttributeInfo.getType()) {
        case MANY_TO_ONE:
          ManyToOneAttribute manyToOne = new ManyToOneAttribute();
          if (entity != null) {
            Entity oneEntity = entity.getChild(associationAttributeInfo.getName());
            AssociationValue value = getAssociationValue(oneEntity, associationAttributeInfo);
            manyToOne.setValue(value);
          }
          return manyToOne;
        case ONE_TO_MANY:
          OneToManyAttribute oneToMany = new OneToManyAttribute();
View Full Code Here

Examples of org.geomajas.layer.feature.attribute.AssociationValue

    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    for (AttributeInfo attributeInfo : childInfo.getAttributes()) {
      attributes.put(attributeInfo.getName(),
          getRecursiveAttribute(entity, childInfo, new String[] { attributeInfo.getName() }));
    }
    AssociationValue value = new AssociationValue(id, attributes, false);
    return value;
  }
View Full Code Here

Examples of org.geomajas.layer.feature.attribute.AssociationValue

    Attribute many = featureModel.getAttribute(f1, "many");
    Assert.assertTrue(many instanceof OneToManyAttribute);
    Assert.assertNotNull(many.getValue());
    Iterator<AssociationValue> it2 = ((OneToManyAttribute) many).getValue().iterator();
    Assert.assertTrue(it2.hasNext());
    AssociationValue v = it2.next();
    Attribute<?> manyInMany = v.getAllAttributes().get("manyInMany");
    Assert.assertNotNull(manyInMany);
    Assert.assertTrue(manyInMany instanceof OneToManyAttribute);
    Attribute<?> oneInMany = v.getAllAttributes().get("oneInMany");
    Assert.assertNotNull(oneInMany);
    Assert.assertTrue(oneInMany instanceof ManyToOneAttribute);
    Attribute one = featureModel.getAttribute(f1, "one");
    Assert.assertTrue(one instanceof ManyToOneAttribute);
    Assert.assertNotNull(one.getValue());
    AssociationValue v2 = ((ManyToOneAttribute) one).getValue();
    Attribute<?> oneInOne = v2.getAllAttributes().get("oneInOne");
    Assert.assertNotNull(oneInOne);
    Assert.assertTrue(oneInOne instanceof ManyToOneAttribute);
    Attribute<?> manyInOne = v2.getAllAttributes().get("manyInOne");
    Assert.assertNotNull(manyInOne);
    Assert.assertTrue(manyInOne instanceof OneToManyAttribute);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.