Package org.structr.common.error

Examples of org.structr.common.error.ErrorBuffer


*
* @author Christian Morgner
*/
public class IllegalMethodException extends FrameworkException {
  public IllegalMethodException() {
    super(HttpServletResponse.SC_METHOD_NOT_ALLOWED, new ErrorBuffer());
  }
View Full Code Here


* @author Christian Morgner
*/
public class NotAllowedException extends FrameworkException {

  public NotAllowedException() {
    super(HttpServletResponse.SC_FORBIDDEN, new ErrorBuffer());
  }
View Full Code Here

*
* @author Christian Morgner
*/
public class NotFoundException extends FrameworkException {
  public NotFoundException() {
    super(HttpServletResponse.SC_NOT_FOUND, new ErrorBuffer());
  }
View Full Code Here

* @author Christian Morgner
*/
public class NoResultsException extends FrameworkException {

  public NoResultsException() {
    super(HttpServletResponse.SC_NO_CONTENT, new ErrorBuffer());
  }
View Full Code Here

* @author Christian Morgner
*/
public class IllegalPathException extends FrameworkException {

  public IllegalPathException() {
    super(HttpServletResponse.SC_BAD_REQUEST, new ErrorBuffer());
  }
View Full Code Here

    } else {

      final App app                         = StructrApp.getInstance(securityContext);
      final Relation template               = getRelationshipTemplate();
      final ErrorBuffer errorBuffer         = new ErrorBuffer();

      if (template != null) {

        final NodeInterface sourceNode        = identifyStartNode(template, propertySet);
        final NodeInterface targetNode        = identifyEndNode(template, propertySet);
        final PropertyMap properties          = PropertyMap.inputTypeToJavaType(securityContext, entityClass, propertySet);
        RelationshipInterface newRelationship = null;

        if (sourceNode == null) {
          errorBuffer.add(entityClass.getSimpleName(), new EmptyPropertyToken(template.getSourceIdProperty()));
        }

        if (targetNode == null) {
          errorBuffer.add(entityClass.getSimpleName(), new EmptyPropertyToken(template.getTargetIdProperty()));
        }

        if (errorBuffer.hasError()) {
          throw new FrameworkException(422, errorBuffer);
        }

        newRelationship = app.create(sourceNode, targetNode, entityClass, properties);
View Full Code Here

  public void injectArguments(final Command command) {
  }

  @Override
  public void initialize(final StructrConf config) {
    reloadSchema(new ErrorBuffer());
  }
View Full Code Here

    final Map<String, Set<String>> viewProperties          = new LinkedHashMap<>();
    final Set<String> propertyNames                        = new LinkedHashSet<>();
    final Set<Validator> validators                        = new LinkedHashSet<>();
    final Set<String> enums                                = new LinkedHashSet<>();
    final String _className                                = getProperty(name);
    final ErrorBuffer dummyErrorBuffer                     = new ErrorBuffer();

    // extract properties
    final String propertyDefinitions = SchemaHelper.extractProperties(this, propertyNames, validators, enums, viewProperties, saveActions, dummyErrorBuffer);

    if (!propertyNames.isEmpty() || validators.isEmpty() || !saveActions.isEmpty()) {
View Full Code Here

  }

  public static void expandWidget(SecurityContext securityContext, Page page, DOMNode parent, String baseUrl, Map<String, Object> parameters) throws FrameworkException {

    String _source          = (String)parameters.get("source");
    ErrorBuffer errorBuffer = new ErrorBuffer();

    if (_source == null) {

      errorBuffer.add(Widget.class.getSimpleName(), new EmptyPropertyToken(source));

    } else {

      // check source for mandatory parameters
      Matcher matcher  = threadLocalTemplateMatcher.get();

      // initialize with source
      matcher.reset(_source);

      while (matcher.find()) {

        String group              = matcher.group();
        String source             = group.substring(1, group.length() - 1);
        ReplacementInfo info      = new ReplacementInfo(source);
        ArrayList<String> options = info.getOptions();
        String key                = info.getKey();

        Object value  = parameters.get(key);

        if (value == null) {

          if (!options.isEmpty()) {

            errorBuffer.add(Widget.class.getSimpleName(), new ValueToken(new StringProperty(key), options.toArray()));

          } else {

            errorBuffer.add(Widget.class.getSimpleName(), new EmptyPropertyToken(new StringProperty(key)));
          }

        } else {

          // replace and restart matching process
          _source = _source.replace(group, value.toString());
          matcher.reset(_source);
        }

      }

    }

    if (!errorBuffer.hasError()) {

      Importer importer = new Importer(securityContext, _source, baseUrl, null, 1, true, true);

      importer.parse(true);
      importer.createChildNodes(parent, page);
View Full Code Here

          throw new FrameworkException(500, ioex.getMessage());
        }

      } else {

        final ErrorBuffer errorBuffer = new ErrorBuffer();

        if (StringUtils.isEmpty(subjectId)) {
          errorBuffer.add("LogFile", new EmptyPropertyToken(subjectProperty));
        }

        if (StringUtils.isEmpty(objectId)) {
          errorBuffer.add("LogFile", new EmptyPropertyToken(objectProperty));
        }

        if (StringUtils.isEmpty(action)) {
          errorBuffer.add("LogFile", new EmptyPropertyToken(actionProperty));
        }

        throw new FrameworkException(422, errorBuffer);
      }
    }
View Full Code Here

TOP

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

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.