Package org.structr.core.property

Examples of org.structr.core.property.PropertyKey


        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");
View Full Code Here


  // ----- protected methods -----
  protected PropertyKey findPropertyKey(final TypedIdResource typedIdResource, final TypeResource typeResource) {

    Class sourceNodeType = typedIdResource.getTypeResource().getEntityClass();
    String rawName = typeResource.getRawType();
    PropertyKey key = StructrApp.getConfiguration().getPropertyKeyForJSONName(sourceNodeType, rawName, false);

    if (key == null) {

      // try to convert raw name into lower-case variable name
      key = StructrApp.getConfiguration().getPropertyKeyForJSONName(sourceNodeType, CaseHelper.toLowerCamelCase(rawName), false);
View Full Code Here

      if (sortKey == null) {

        // Apply default sorting, if defined
        final GraphObject obj = list.get(0);

        final PropertyKey defaultSort = obj.getDefaultSortKey();

        if (defaultSort != null) {

          sortKey = defaultSort;
          finalSortOrder = obj.getDefaultSortOrder();
View Full Code Here

      final ConfigurationProvider conf   = Services.getInstance().getConfigurationProvider();
      final List<PropertyKey> searchKeys = new LinkedList<>();

      for (final String name : request.getParameterMap().keySet()) {

        final PropertyKey key = conf.getPropertyKeyForJSONName(type, getFirstPartOfString(name));
        if (key != null) {

          if (key.isSearchable()) {

            // add to list of searchable keys
            searchKeys.add(key);

          } else if (!JsonRestServlet.commonRequestParameters.contains(name)) {

            throw new FrameworkException(400, "Search key " + name + " is not indexed.");
          }

        } else if (!JsonRestServlet.commonRequestParameters.contains(name)) {

          // exclude common request parameters here (should not throw exception)
          throw new FrameworkException(400, "Invalid search key " + name);
        }
      }

      // sort list of search keys according to their desired order
      // so that querying search attributes can use other attributes
      // to refine their partial results.
      Collections.sort(searchKeys, new PropertyKeyProcessingOrderComparator());

      for (final PropertyKey key : searchKeys) {

        // hand list of search attributes over to key
        key.extractSearchableAttribute(securityContext, request, query);
      }
    }
  }
View Full Code Here

          for (PropertyKey key : keys) {

            final Predicate predicate  = writer.getSecurityContext().getRange(key.jsonName());
            final Object value         = source.getProperty(key, predicate);
            final Class relatedType    = key.relatedType();
            final PropertyKey localKey = key;

            if (value != null) {

              if (reduceRedundancy && relatedType != null && visitedTypes.contains(key.relatedType())) {

                continue;

              } else {

                writer.name(localKey.jsonName());
                serializeProperty(writer, key, value, localPropertyView, depth+1);

              }

            } else {

              writer.name(localKey.jsonName()).nullValue();
            }
          }
        }
      }
View Full Code Here

      String sortKeyName       = request.getParameter(REQUEST_PARAMETER_SORT_KEY);
      boolean sortDescending   = (sortOrder != null && "desc".equals(sortOrder.toLowerCase()));
      int pageSize     = HttpService.parseInt(pageSizeParameter, NodeFactory.DEFAULT_PAGE_SIZE);
      int page                 = HttpService.parseInt(pageParameter, NodeFactory.DEFAULT_PAGE);
      String baseUrl           = request.getRequestURI();
      PropertyKey sortKey      = null;

      // set sort key
      if (sortKeyName != null) {

        Class<? extends GraphObject> type = resource.getEntityClass();
View Full Code Here

      String sortOrder         = request.getParameter(REQUEST_PARAMETER_SORT_ORDER);
      String sortKeyName       = request.getParameter(REQUEST_PARAMETER_SORT_KEY);
      boolean sortDescending   = (sortOrder != null && "desc".equals(sortOrder.toLowerCase()));
      int pageSize     = HttpService.parseInt(pageSizeParameter, NodeFactory.DEFAULT_PAGE_SIZE);
      int page                 = HttpService.parseInt(pageParameter, NodeFactory.DEFAULT_PAGE);
      PropertyKey sortKey      = null;

      // set sort key
      if (sortKeyName != null) {

        Class<? extends GraphObject> type = resource.getEntityClass();
View Full Code Here

  @Override
  public Result doGet(final PropertyKey sortKey, final boolean sortDescending, final int pageSize, final int page, final String offsetId) throws FrameworkException {

    boolean includeDeletedAndHidden        = false;
    boolean publicOnly                     = false;
    PropertyKey actualSortKey              = sortKey;
    boolean actualSortOrder                = sortDescending;

    if (rawType != null) {

      if (entityClass == null) {
        throw new NotFoundException();
      }

      collectSearchAttributes(query);

      // default sort key & order
      if (actualSortKey == null) {

        try {

          GraphObject templateEntity  = ((GraphObject)entityClass.newInstance());
          PropertyKey sortKeyProperty = templateEntity.getDefaultSortKey();
          actualSortOrder             = GraphObjectComparator.DESCENDING.equals(templateEntity.getDefaultSortOrder());

          if (sortKeyProperty != null) {

            actualSortKey = sortKeyProperty;
View Full Code Here

    final Class sourceType                  = template.getSourceType();
    final Notion notion                     = template.getStartNodeNotion();

    notion.setType(sourceType);

                PropertyKey startNodeIdentifier = notion.getPrimaryPropertyKey();

                if (startNodeIdentifier != null) {

                        Object identifierValue = properties.get(startNodeIdentifier.dbName());

                        properties.remove(sourceIdProperty.dbName());

                        return (NodeInterface)notion.getAdapterForSetter(securityContext).adapt(identifierValue);
View Full Code Here

    final Class targetType                  = template.getTargetType();
    final Notion notion                     = template.getEndNodeNotion();

    notion.setType(targetType);

                final PropertyKey endNodeIdentifier = notion.getPrimaryPropertyKey();
                if (endNodeIdentifier != null) {

                        Object identifierValue = properties.get(endNodeIdentifier.dbName());

                        properties.remove(targetIdProperty.dbName());

                        return (NodeInterface)notion.getAdapterForSetter(securityContext).adapt(identifierValue);
View Full Code Here

TOP

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

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.