Package org.structr.common.error

Examples of org.structr.common.error.FrameworkException


  private T getTypedResult(Result<T> result, Class<T> type) throws FrameworkException {
   
    GraphObject obj = result.get(0);

    if(!type.isAssignableFrom(obj.getClass())) {
      throw new FrameworkException(type.getSimpleName(), new TypeToken(AbstractNode.base, type.getSimpleName()));
    }

    return result.get(0);
  }
View Full Code Here


      case 1 :
       
        T obj = result.get(0);
        //if(!type.getSimpleName().equals(node.getType())) {
        if (!type.isAssignableFrom(obj.getClass())) {
          throw new FrameworkException("base", new TypeToken(propertyKey, type.getSimpleName()));
        }
        return obj;
    }

    if (convertedSource != null) {

      Map<PropertyKey, Object> attributes = new LinkedHashMap<>();

      attributes.put(propertyKey,       convertedSource);
      attributes.put(AbstractNode.type, type.getSimpleName());

      throw new FrameworkException(type.getSimpleName(), new PropertiesNotFoundToken(AbstractNode.base, attributes));
    }
   
    return null;
  }
View Full Code Here

    // ignore result for now
    entity.replaceVariables(securityContext, context, source);

    // check for errors raised by scripting
    if (context.hasError()) {
      throw new FrameworkException(422, context.getErrorBuffer());
    }

    // false means SUCCESS!
    return false;
  }
View Full Code Here

      // check existing relationships
      for (final RelationshipInterface rel : outgoingRels) {

        if (rel.getTargetNode().equals(targetNode)) {

          throw new FrameworkException(getClass().getSimpleName(), new DuplicateRelationshipToken("This relationship already exists"));
        }
      }
    }
  }
View Full Code Here

            return;

          } else {

            throw new FrameworkException(400, "PropertyKey " + jsonName() + " must be indexedWhenEmpty() to be used in not-blank search query.");
          }

        } else {

          throw new FrameworkException(422, "Invalid range pattern.");
        }
      }
     }

    if (requestParameter.contains(",") && requestParameter.contains(";")) {
      throw new FrameworkException(422, "Mixing of AND and OR not allowed in request parameters");
    }

    if (requestParameter.contains(";")) {

      if (multiValueSplitAllowed()) {
View Full Code Here

    try {
      values = formatter.parse(value);
      len    = values.length;

    } catch (ParseException pex) {
      throw new FrameworkException(422, pex.getMessage());
    }

    for (int i=0; i<len; i++) {

      final PropertyKey key                  = keys.get(i);
View Full Code Here

          return new SimpleDateFormat(format).parse(source);
         
        } catch (Throwable t) {

          throw new FrameworkException(declaringClass.getSimpleName(), new DateFormatToken(ISO8601DateProperty.this));

        }

      }
View Full Code Here

    }

    if (!nodesUpToOffset.isEmpty() && !gotOffset) {

      throw new FrameworkException("offsetId", new IdNotFoundToken(offsetId));
    }

    if (offset < 0) {

      // Remove last item
View Full Code Here

          // permit write operation once and
          // lock read-only properties again
          readOnlyPropertiesUnlocked = false;
        } else {

          throw new FrameworkException(this.getType(), new ReadOnlyPropertyToken(key));
        }

      }

      dbNode.removeProperty(key.dbName());
View Full Code Here

    if (key == null) {

      logger.log(Level.SEVERE, "Tried to set property with null key (action was denied)");

      throw new FrameworkException(getClass().getSimpleName(), new NullArgumentToken(base));

    }

    // check for read-only properties
    if (key.isReadOnly() || (key.isWriteOnce() && (dbNode != null) && dbNode.hasProperty(key.dbName()))) {

      if (readOnlyPropertiesUnlocked || securityContext.isSuperUser()) {

        // permit write operation once and
        // lock read-only properties again
        readOnlyPropertiesUnlocked = false;

      } else {

        throw new FrameworkException(getClass().getSimpleName(), new ReadOnlyPropertyToken(key));
      }

    }

    key.setProperty(securityContext, this, value);
View Full Code Here

TOP

Related Classes of org.structr.common.error.FrameworkException

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.