Examples of StringAttribute


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

  public void setAttributesManyToOne() throws Exception {
    String newValue = "A new value";
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    ManyToOneAttribute attr = HibernateTestManyToOne.getDefaultAttributeInstance1(new Long(1));
    attr.getValue().getAttributes().remove(PARAM_TEXT_ATTR);
    attr.getValue().getAttributes().put(PARAM_TEXT_ATTR, new StringAttribute(newValue));
    attributes.put(PARAM_MANY_TO_ONE, attr);
    featureModel.setAttributes(feature1, attributes);
    Assert.assertEquals("A new value", featureModel.getAttribute(feature1, ATTR__MANY_TO_ONE__DOT__TEXT).getValue());
  }
View Full Code Here

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

    String id = layer.getFeatureModel().getId(persistent);
    // retrieve feature
    Object read = layer.getElements(filterService.createFidFilter(new String[] { id }), 0, 1).next();
    // read primitives
    ManyToOneAttribute manyToOne = (ManyToOneAttribute) layer.getFeatureModel().getAttribute(read, "manyToOneAttr");
    StringAttribute s = (StringAttribute) manyToOne.getValue().getAllAttributes().get("stringAttr");
    Assert.assertEquals("one", s.getValue());
    // update primitives
    Map<String, Attribute> attribs = new HashMap<String, Attribute>();
    attribs.put("stringAttr", new StringAttribute("bean2"));
    ManyToOneAttribute manyToOne2 = (ManyToOneAttribute) manyToOne.clone();
    manyToOne2.getValue().getAllAttributes().put("stringAttr", new StringAttribute("one2"));
    attribs.put("manyToOneAttr", manyToOne2);
    layer.getFeatureModel().setAttributes(read, attribs);
    layer.saveOrUpdate(read);
    // retrieve feature again
    Object read2 = layer.getElements(filterService.createFidFilter(new String[] { id }), 0, 1).next();
View Full Code Here

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

  public Object createNested() throws LayerException {
    Object o = layer.getFeatureModel().newInstance();
    OneToManyAttribute many = new OneToManyAttribute(new ArrayList<AssociationValue>());
    ManyToOneAttribute one = new ManyToOneAttribute(new AssociationValue(null, new HashMap<String, Attribute<?>>(),
        false));
    one.getValue().getAllAttributes().put("stringAttr", new StringAttribute("one"));

    // create 2 manyInMany
    OneToManyAttribute manyInMany = new OneToManyAttribute(new ArrayList<AssociationValue>());
    AssociationValue manyInMany1 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    manyInMany1.getAllAttributes().put("stringAttr", new StringAttribute("manyInMany1"));
    manyInMany.getValue().add(manyInMany1);
    AssociationValue manyInMany2 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    manyInMany2.getAllAttributes().put("stringAttr", new StringAttribute("manyInMany2"));
    manyInMany.getValue().add(manyInMany2);

    // create oneInMany
    ManyToOneAttribute oneInMany = new ManyToOneAttribute();
    AssociationValue oneInManyValue = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    oneInManyValue.getAllAttributes().put("stringAttr", new StringAttribute("oneInMany"));
    oneInMany.setValue(oneInManyValue);

    // create 2 manyInOne
    OneToManyAttribute manyInOne = new OneToManyAttribute(new ArrayList<AssociationValue>());
    AssociationValue manyInOne1 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    manyInOne1.getAllAttributes().put("stringAttr", new StringAttribute("manyInOne1"));
    manyInOne.getValue().add(manyInOne1);
    AssociationValue manyInOne2 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    manyInOne2.getAllAttributes().put("stringAttr", new StringAttribute("manyInOne2"));
    manyInOne.getValue().add(manyInOne2);

    // create oneInOne
    ManyToOneAttribute oneInOne = new ManyToOneAttribute();
    AssociationValue oneInOneValue = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    oneInOneValue.getAllAttributes().put("stringAttr", new StringAttribute("oneInOne"));
    oneInOne.setValue(oneInOneValue);

    // create 2 many
    AssociationValue many1 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    AssociationValue many2 = new AssociationValue(null, new HashMap<String, Attribute<?>>(), false);
    // add manyInMany to many1
    many1.getAllAttributes().put("oneToManyAttr", manyInMany);
    // add oneInMany to many2
    many2.getAllAttributes().put("manyToOneAttr", oneInMany);
    // add to many
    many.getValue().add(many1);
    many.getValue().add(many2);

    // add manyInOne to one
    one.getValue().getAllAttributes().put("oneToManyAttr", manyInOne);
    // add oneInOne to one
    one.getValue().getAllAttributes().put("manyToOneAttr", oneInOne);
    Map<String, Attribute> attributes = new HashMap<String, Attribute>();
    attributes.put("oneToManyAttr", many);
    attributes.put("manyToOneAttr", one);
    attributes.put("stringAttr", new StringAttribute("bean1"));
    layer.getFeatureModel().setAttributes(o, attributes);
    return o;
  }
View Full Code Here

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

    return p;
  }

  public static ManyToOneAttribute getDefaultAttributeInstance1(Long id) {
     Map<String, PrimitiveAttribute<?>> attributes = new HashMap<String, PrimitiveAttribute<?>>();
    attributes.put("textAttr", new StringAttribute("manyToOne-1"));
    attributes.put("booleanAttr", new BooleanAttribute(true));
    attributes.put("intAttr", new IntegerAttribute(100));
    attributes.put("floatAttr", new FloatAttribute(100.0f));
    attributes.put("doubleAttr", new DoubleAttribute(100.0));
   
View Full Code Here

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

    // update one item
    recorder.clear();
    InternalFeature org = features.get(0);
    InternalFeature upd = org.clone();
    upd.getAttributes().put("stringAttr", new StringAttribute("something has changed"));
    List<InternalFeature> orgFeatures = new ArrayList<InternalFeature>();
    orgFeatures.add(org);
    List<InternalFeature> updFeatures = new ArrayList<InternalFeature>();
    updFeatures.add(upd);
    vectorLayerService.saveOrUpdate(LAYER_BEANS, geoService.getCrs2("EPSG:4326"), orgFeatures, updFeatures);
View Full Code Here

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

        break;
      case CURRENCY:
        attribute = new CurrencyAttribute();
        break;
      case STRING:
        attribute = new StringAttribute();
        break;
      case DATE:
        attribute = new DateAttribute();
        break;
      case URL:
View Full Code Here

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

      case LONG:
        return new LongAttribute();
      case SHORT:
        return new ShortAttribute();
      case STRING:
        return new StringAttribute();
      case URL:
        return new UrlAttribute();
      default:
        return new StringAttribute();

    }
  }
View Full Code Here

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

      switch (type) {
        case CURRENCY:
          attribute = new CurrencyAttribute(value);
          break;
        case STRING:
          attribute = new StringAttribute(value);
          break;
        case URL:
          attribute = new UrlAttribute(value);
          break;
        case IMGURL:
          attribute = new ImageUrlAttribute(value);
          break;
      }
      this.attribute = new StringAttribute(value);
      this.info = new PrimitiveAttributeInfo(name, label, type);
    }
View Full Code Here

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

          case DOUBLE:
            return new DoubleAttribute();
          case CURRENCY:
            return new CurrencyAttribute();
          case STRING:
            return new StringAttribute();
          case DATE:
            return new DateAttribute();
          case URL:
            return new UrlAttribute();
          case IMGURL:
View Full Code Here

Examples of org.jboss.security.xacml.sunxacml.attr.StringAttribute

         // now get the value
         try
         {
            Node child = root.getFirstChild();
            if(child == null)
               return new StringAttribute("");
           //get the type of the node
            short nodetype = child.getNodeType();

            // now see if we have (effectively) a simple string value
            if ((nodetype == Node.TEXT_NODE) || (nodetype == Node.CDATA_SECTION_NODE) ||
                (nodetype == Node.COMMENT_NODE))
            {
                return new StringAttribute(child.getNodeValue());
            }
           
            return AttributeFactory.getInstance().createValue(child, type);
         }
         catch (UnknownIdentifierException uie)
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.