Package org.structr.core.property

Examples of org.structr.core.property.StringProperty


      // setup
      try (final Tx tx = app.tx()) {

        node = app.create(SchemaNode.class, new NodeAttribute(SchemaNode.name, "TestType"));
        node.setProperty(new StringProperty("_test"), "Integer");

        tx.success();
      }

      // fetch dynamic type info
      final Class dynamicType   = StructrApp.getConfiguration().getNodeEntityClass("TestType");
      final PropertyKey testKey = StructrApp.getConfiguration().getPropertyKeyForJSONName(dynamicType, "test");

      // modify schema node but keep reference to "old" type
      try (final Tx tx = app.tx()) {

        node.setProperty(new StringProperty("_test2"), "String");

        tx.success();
      }

      // create test nodes
View Full Code Here


        final PropertyMap relProperties = relationship.getProperties();
        final NodeInterface startNode = relationship.getSourceNode();
        final NodeInterface endNode = relationship.getTargetNode();

        relProperties.put(new StringProperty("startNodeId"), startNode.getUuid());
        relProperties.put(new StringProperty("endNodeId"), endNode.getUuid());

        final Map<String, Object> properties = PropertyMap.javaTypeToInputType(securityContext, relationship.getClass(), relProperties);

        message.setRelData(properties);
View Full Code Here

                  if (value.equalsIgnoreCase("true")) {
                    newNode.setProperty(new BooleanProperty(key), true);
                  } else if (value.equalsIgnoreCase("false")) {
                    newNode.setProperty(new BooleanProperty(key), false);
                  } else {
                    newNode.setProperty(new StringProperty(key), nodeAttr.getValue());
                  }
                }

              } else {

                int l = DATA_META_PREFIX.length();

                String upperCaseKey = WordUtils.capitalize(key.substring(l), new char[]{'-'}).replaceAll("-", "");
                String camelCaseKey = key.substring(l, l + 1).concat(upperCaseKey.substring(1));

                if (value != null) {
                  if (value.equalsIgnoreCase("true")) {
                    newNode.setProperty(new BooleanProperty(camelCaseKey), true);
                  } else if (value.equalsIgnoreCase("false")) {
                    newNode.setProperty(new BooleanProperty(camelCaseKey), false);
                  } else {
                    newNode.setProperty(new StringProperty(camelCaseKey), nodeAttr.getValue());
                  }
                }

              }

            } else {

              String value =  nodeAttr.getValue();

              boolean isAnchor = StringUtils.isNotBlank(value) && value.startsWith("#");
              boolean isLocal = StringUtils.isNotBlank(value) && !value.startsWith("http");
              boolean isActive = StringUtils.isNotBlank(value) && (value.startsWith("${") || value.startsWith("/${"));

              if ("link".equals(tag) && "href".equals(key) && isLocal && !isActive) {

                newNode.setProperty(new StringProperty(PropertyView.Html.concat(key)), "${link.path}?${link.version}");

              } else if (("href".equals(key) || "src".equals(key)) && isLocal && !isActive && !isAnchor) {

                newNode.setProperty(new StringProperty(PropertyView.Html.concat(key)), "${link.path}");

              } else {

                newNode.setProperty(new StringProperty(PropertyView.Html.concat(nodeAttr.getKey())), value);
              }

            }
          }
View Full Code Here

      if (type != null) {

        String url = "/".concat(CaseHelper.toUnderscore(rawType, true));

        schema.setProperty(new StringProperty("url"), url);
        schema.setProperty(new StringProperty("type"), type.getSimpleName());
        schema.setProperty(new StringProperty("className"), type.getName());
        schema.setProperty(new StringProperty("isRel"), AbstractRelationship.class.isAssignableFrom(type));
        schema.setProperty(new LongProperty("flags"), SecurityContext.getResourceFlags(rawType));

      }

View Full Code Here

  public void test02ModifyRelationship() {

    try {

      final NodeHasLocation rel = (createTestRelationships(NodeHasLocation.class, 1)).get(0);
      final PropertyKey key1         = new StringProperty("jghsdkhgshdhgsdjkfgh");
      final String val1              = "54354354546806849870";

      try (final Tx tx = app.tx()) {
       
        rel.setProperty(key1, val1);
        tx.success();
      }
     
      try (final Tx tx = app.tx()) {
       
        assertTrue("Expected relationship to have a value for key '" + key1.dbName() + "'", rel.getRelationship().hasProperty(key1.dbName()));

        assertEquals(val1, rel.getRelationship().getProperty(key1.dbName()));

        Object vrfy1 = rel.getProperty(key1);
        assertEquals(val1, vrfy1);
      }
     
View Full Code Here

      if (value instanceof Map) {

        final Map<String, Object> map = (Map<String, Object>)value;
        final GraphObjectMap obj      = new GraphObjectMap();

        target.put(new StringProperty(key), obj);

        recursivelyConvertMapToGraphObjectMap(obj, map, depth + 1);

      } else {

        target.put(new StringProperty(key), value);
      }
    }

  }
View Full Code Here

    final List<PropertyKey> propertyKeys = new LinkedList<>(Iterables.toList(super.getPropertyKeys(propertyView)));

    // add "custom" property keys as String properties
    for (final String key : SchemaHelper.getProperties(getNode())) {

      final PropertyKey newKey = new StringProperty(key);
      newKey.setDeclaringClass(getClass());

      propertyKeys.add(newKey);
    }

    Collections.sort(propertyKeys, new Comparator<PropertyKey>() {
View Full Code Here

   */
  private void renderStructrAppLib(final AsyncBuffer out, final SecurityContext securityContext, final RenderContext renderContext, final int depth) throws FrameworkException {

    EditMode editMode = renderContext.getEditMode(securityContext.getUser(false));

    if (!(EditMode.RAW.equals(editMode) || EditMode.WIDGET.equals(editMode)) && !renderContext.appLibRendered() && getProperty(new StringProperty(STRUCTR_ACTION_PROPERTY)) != null) {

      out
        .append(indent(depth))
        .append("<script>if (!window.jQuery) { document.write('<script src=\"/structr/js/lib/jquery-1.11.1.min.js\"><\\/script>'); }</script>")
        .append(indent(depth))
View Full Code Here

  public void test03SearchRelationship() {

    try {

      final NodeHasLocation rel = createTestRelationships(NodeHasLocation.class, 1).get(0);
      final PropertyKey key1    = new StringProperty("jghsdkhgshdhgsdjkfgh").indexed();
      final Class type          = NodeHasLocation.class;
      final String val1         = "54354354546806849870";
     
      final Result<RelationshipInterface> result;
View Full Code Here

          final GraphObjectMap property = new GraphObjectMap();

          for (final Map.Entry<String, Object> prop : ((Map<String, Object>) entry.getValue()).entrySet()) {

            property.setProperty(new StringProperty(prop.getKey()), prop.getValue());
          }

          resultList.add(property);
        }

      } else {

        final GraphObjectMap schema = new GraphObjectMap();

        resultList.add(schema);

        String url = "/".concat(CaseHelper.toUnderscore(rawType, true));

        schema.setProperty(new StringProperty("url"), url);
        schema.setProperty(new StringProperty("type"), type.getSimpleName());
        schema.setProperty(new StringProperty("className"), type.getName());
        schema.setProperty(new StringProperty("isRel"), AbstractRelationship.class.isAssignableFrom(type));
        schema.setProperty(new LongProperty("flags"), SecurityContext.getResourceFlags(rawType));

        Set<String> propertyViews = new LinkedHashSet<>(StructrApp.getConfiguration().getPropertyViews());

        // list property sets for all views
        Map<String, Map<String, Object>> views = new TreeMap();
        schema.setProperty(new StringProperty("views"), views);

        for (String view : propertyViews) {

          views.put(view, getPropertiesForView(type, view));
View Full Code Here

TOP

Related Classes of org.structr.core.property.StringProperty

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.