Package org.structr.core

Examples of org.structr.core.GraphObject


  }

  // ----- public methods -----
  public GraphObject getEntity() throws FrameworkException {

    GraphObject entity = idResource.getEntity();
    String type        = SchemaHelper.normalizeEntityName(typeResource.getRawType());
    Class parentClass  = SchemaHelper.getEntityClassForRawType(type);
    Class entityClass  = entity.getClass();

    if (parentClass.isAssignableFrom(entityClass)) {
      return entity;
    }
View Full Code Here


    String queryTime = src.getQueryTime();
    Integer resultCount = src.getRawResultCount();
    String searchString = src.getSearchString();
    String sortKey = src.getSortKey();
    String sortOrder = src.getSortOrder();
    GraphObject metaData = src.getMetaData();

    if(page != null) {
      result.add("page", new JsonPrimitive(page));
    }
View Full Code Here

      String finalSortOrder = sortDescending ? "desc" : "asc";

      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();
        }
      }

      if (sortKey != null) {
        Collections.sort(list, new GraphObjectComparator(sortKey, finalSortOrder));
View Full Code Here

    String queryTime = result.getQueryTime();
    Integer resultCount = result.getRawResultCount();
    String searchString = result.getSearchString();
    String sortKey = result.getSortKey();
    String sortOrder = result.getSortOrder();
    GraphObject metaData = result.getMetaData();

    writer.beginDocument(baseUrl, propertyView.get(securityContext));

    // open result set
    writer.beginObject();
View Full Code Here

      // 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

      logger.log(Level.SEVERE, "Unable to remove given object from collection: idToRemove is null");
      getWebSocket().send(MessageBuilder.status().code(400).build(), true);

    }

    GraphObject obj         = getNode(webSocketData.getId());
    if (obj != null) {

      if (!getWebSocket().getSecurityContext().isAllowed(((AbstractNode) obj), Permission.write)) {

        getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true);
        logger.log(Level.WARNING, "No write permission for {0} on {1}", new Object[]{getWebSocket().getCurrentUser().toString(), obj.toString()});
        return;

      }

    }

    if (obj == null) {

      // No node? Try to find relationship
      obj = getRelationship(webSocketData.getId());
    }

    GraphObject objToRemove = getNode(idToRemove);

    if (obj != null && objToRemove != null) {

      try {
View Full Code Here

      assertNotNull(rel);

      try (final Tx tx = app.tx()) {
       
        GraphObject  searchRes = app.get(testSix.getUuid());
        assertNotNull(searchRes);
      }
     
      try (final Tx tx = app.tx()) {
       
View Full Code Here

      for (PropertyKey key : propertyKeys.values()) {

        Reference reference = (Reference)key;

        GraphObject referencedEntity = reference.getReferencedEntity(rel);
        PropertyKey referenceKey     = reference.getReferenceKey();
        PropertyKey propertyKey      = reference.getPropertyKey();
       
        if (referencedEntity != null) {
         
          properties.put(propertyKey, referencedEntity.getProperty(referenceKey));
        }
      }
     
      return properties;
    }
View Full Code Here

      for (PropertyKey key : propertyKeys.values()) {

        Reference reference = (Reference)key;
       
        GraphObject referencedEntity = reference.getReferencedEntity(rel);
        PropertyKey referenceKey     = reference.getReferenceKey();
        PropertyKey propertyKey      = reference.getPropertyKey();
       
        if (referencedEntity != null && !reference.isReadOnly()) {
         
          Object value = source.get(propertyKey);
          referencedEntity.setProperty(referenceKey, value);
        }
      }
    }
  }
View Full Code Here

  //~--- methods --------------------------------------------------------

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

    GraphObject obj = getEntity();
    if (obj != null) {

      List<GraphObject> results = new LinkedList<>();

      results.add(obj);
View Full Code Here

TOP

Related Classes of org.structr.core.GraphObject

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.