Examples of StringAttribute


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

    securityContext.setAuthentications("token", authentications);

    InternalFeature feature = new InternalFeatureImpl();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    feature.setAttributes(attributes);
    attributes.put(ATTRIBUTE_ID, new StringAttribute("bla"));
    Assert.assertTrue(securityContext.isAttributeReadable(LAYER_ID, feature, ATTRIBUTE_ID));
    Assert.assertTrue(securityContext.isAttributeWritable(LAYER_ID, feature, ATTRIBUTE_ID));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("vis"));
    Assert.assertFalse(securityContext.isAttributeReadable(LAYER_ID, feature, ATTRIBUTE_ID));
    Assert.assertTrue(securityContext.isAttributeWritable(LAYER_ID, feature, ATTRIBUTE_ID));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("upd"));
    Assert.assertTrue(securityContext.isAttributeReadable(LAYER_ID, feature, ATTRIBUTE_ID));
    Assert.assertFalse(securityContext.isAttributeWritable(LAYER_ID, feature, ATTRIBUTE_ID));
  }
View Full Code Here

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

  @Test
  public void testPrimitiveAttributes() throws LayerException {
    Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
    FeatureBean bean = new FeatureBean();
    attributes.put("stringAttr", new StringAttribute("s1"));
    attributes.put("doubleAttr", new DoubleAttribute(1.23));
    attributes.put("longAttr", new LongAttribute(12L));
    attributes.put("floatAttr", new FloatAttribute(1.67F));
    attributes.put("shortAttr", new ShortAttribute((short) 6));
    attributes.put("urlAttr", new UrlAttribute("http://haha"));
View Full Code Here

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

  @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.StringAttribute

  @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());
    Assert.assertNull(bean.getStringAttr());
  }
View Full Code Here

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

    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    feature.getAttributes().put(INTEGER_ATTR, new IntegerAttribute(12345));
    layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
    // check changes
    filter = filterService.createFidFilter(new String[]{"1"});
    oldFeatures = layerService.getFeatures(LAYER_ID, crs, filter, null,
View Full Code Here

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

    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
    // should not able to update feature "3"
    filter = filterService.createFidFilter(new String[]{"3"});
    oldFeatures = layerService.getFeatures(LAYER_ID, crs, filter, null,
        VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    try {
      layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
      Assert.fail("should have throw GeomajasSecurityException");
    } catch (GeomajasSecurityException gse) {
      Assert.assertEquals(ExceptionCode.FEATURE_UPDATE_PROHIBITED, gse.getExceptionCode());
    }

    login("luc");
    // luc should be able to modify "3"
    filter = filterService.createFidFilter(new String[]{"3"});
    oldFeatures = layerService.getFeatures(LAYER_ID,
        crs, filter, null, VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
  }
View Full Code Here

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

    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
    // should not be able to update feature "3"
    filter = filterService.createFidFilter(new String[]{"3"});
    oldFeatures = layerService.getFeatures(LAYER_ID, crs, filter, null,
        VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
    Assert.assertEquals(1, oldFeatures.size());
    feature = oldFeatures.get(0);
    newFeatures = new ArrayList<InternalFeature>();
    feature = feature.clone();
    newFeatures.add(feature);
    feature.getAttributes().put(STRING_ATTR, new StringAttribute("changed"));
    try {
      layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
      Assert.fail("update area not checked when updating");
    } catch (GeomajasException ge) {
      Assert.assertEquals(ExceptionCode.FEATURE_UPDATE_PROHIBITED, ge.getExceptionCode());
View Full Code Here

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

    securityContext.setAuthentications("token", authentications);

    InternalFeature feature = new InternalFeatureImpl();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    feature.setAttributes(attributes);
    attributes.put(ATTRIBUTE_ID, new StringAttribute("bla"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));
View Full Code Here

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

    securityContext.setAuthentications("token", authentications);

    InternalFeature feature = new InternalFeatureImpl();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    feature.setAttributes(attributes);
    attributes.put(ATTRIBUTE_ID, new StringAttribute("bla"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));
View Full Code Here

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

    securityContext.setAuthentications("token", authentications);

    InternalFeature feature = new InternalFeatureImpl();
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    feature.setAttributes(attributes);
    attributes.put(ATTRIBUTE_ID, new StringAttribute("bla"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("vis"));
    Assert.assertFalse(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("cre"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertFalse(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("upd"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertFalse(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("org"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertFalse(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("new"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertFalse(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertTrue(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));

    feature.getAttributes().put(ATTRIBUTE_ID, new StringAttribute("del"));
    Assert.assertTrue(securityContext.isFeatureVisible(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureUpdateAuthorized(LAYER_ID, feature, feature));
    Assert.assertFalse(securityContext.isFeatureDeleteAuthorized(LAYER_ID, feature));
    Assert.assertTrue(securityContext.isFeatureCreateAuthorized(LAYER_ID, feature));
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.