Package org.geomajas.internal.layer.feature

Examples of org.geomajas.internal.layer.feature.InternalFeatureImpl


    Authentication auth2 = getFeatureAuthentication();
    authentications.add(auth1);
    authentications.add(auth2);
    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));
View Full Code Here


    Authentication auth2 = getFeatureAuthentication();
    authentications.add(auth1);
    authentications.add(auth2);
    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

      dto.setGeometry(toDto(feature.getGeometry()));
    }
    if ((featureIncludes & VectorLayerService.FEATURE_INCLUDE_STYLE) != 0 && null != feature.getStyleInfo()) {
      dto.setStyleId(feature.getStyleInfo().getStyleId());
    }
    InternalFeatureImpl vFeature = (InternalFeatureImpl) feature;
    dto.setClipped(vFeature.isClipped());
    dto.setUpdatable(feature.isEditable());
    dto.setDeletable(feature.isDeletable());
    return dto;
  }
View Full Code Here

   */
  public InternalFeature toInternal(Feature dto) throws GeomajasException {
    if (dto == null) {
      return null;
    }
    InternalFeatureImpl feature = new InternalFeatureImpl();
    feature.setAttributes(dto.getAttributes());
    feature.setId(dto.getId());
    feature.setLabel(dto.getLabel());
    feature.setGeometry(toInternal(dto.getGeometry()));
    feature.setClipped(dto.isClipped());
    feature.setEditable(dto.isUpdatable());
    feature.setDeletable(dto.isDeletable());
    return feature;
  }
View Full Code Here

    Assert.assertTrue(internalFeature.isEditable());
  }

  @Test
  public void toDto() throws GeomajasException {
    InternalFeature internalFeature = new InternalFeatureImpl();
    Assert.assertNotNull(converterService.toDto(internalFeature));

    internalFeature.setId("id");
    internalFeature.setLabel("label");
    internalFeature.setDeletable(true);
    internalFeature.setEditable(true);

    Feature feature = converterService.toDto(internalFeature);
    Assert.assertEquals("id", feature.getId());
    Assert.assertEquals("label", feature.getLabel());
    Assert.assertTrue(feature.isDeletable());
View Full Code Here

TOP

Related Classes of org.geomajas.internal.layer.feature.InternalFeatureImpl

Copyright © 2018 www.massapicom. 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.