Package org.beangle.ems.security.restrict

Examples of org.beangle.ems.security.restrict.RestrictField


  }

  public String removeField() {
    Long fieldId = getEntityId("field");
    if (null != fieldId) {
      RestrictField field = (RestrictField) entityDao.get(RestrictField.class, fieldId);
      try {
        for (RestrictEntity entity : field.getEntities()) {
          entity.getFields().remove(field);
        }
        entityDao.saveOrUpdate(field.getEntities());
        entityDao.remove(field);
      } catch (Exception e) {
        return redirect("fields", "info.remove.failure");
      }
      logger.info("remove field with name {}", field.getName());
    }
    return redirect("fields", "info.remove.success");
  }
View Full Code Here


    }
    return redirect("fields", "info.remove.success");
  }

  public String editField() {
    RestrictField field = getEntity(RestrictField.class, "field");
    List<RestrictEntity> entities = entityDao.getAll(RestrictEntity.class);
    entities.removeAll(field.getEntities());
    put("entities", entities);
    put("field", field);
    return forward("fieldForm");
  }
View Full Code Here

  }

  public String saveField() {
    List<RestrictEntity> entities = entityDao.get(RestrictEntity.class, getAll("entityId", Long.class));
    // FIXME Too complex
    RestrictField field = populateEntity(RestrictField.class, "field");
    for (RestrictEntity entity : field.getEntities()) {
      entity.getFields().remove(field);
    }
    for (RestrictEntity entity : entities) {
      entity.getFields().add(field);
    }
    field.getEntities().clear();
    field.getEntities().addAll(entities);
    entityDao.saveOrUpdate(field, entities);
    return redirect("fields", "info.save.success");
  }
View Full Code Here

    return getFieldValues(getRestrictField(fieldName));
  }

  public List<?> getFieldValues(String fieldName, List<? extends Restriction> restrictions) {
    Set<Object> values = CollectUtils.newHashSet();
    RestrictField field = getRestrictField(fieldName);
    boolean gotIt = false;
    for (Restriction restriction : restrictions) {
      Object value = getFieldValue(field, restriction);
      if (null != value) {
        gotIt = true;
View Full Code Here

      for (int i = 0; i < contents.length; i++) {
        String content = contents[i];
        Condition c = new Condition(content);
        List<String> params = c.getParamNames();
        for (final String paramName : params) {
          RestrictField param = pattern.getEntity().getField(paramName);
          String value = restriction.getItem(param);
          if (StringUtils.isNotEmpty(value)) {
            if (value.equals(Restriction.ALL)) {
              content = "";
            } else {
              content = StringUtils.replace(content, ":" + param.getName(),
                  ":" + param.getName() + index);
              paramValues.add(getFieldValue(param, restriction));
            }
          } else {
            throw new RuntimeException(paramName + " had not been initialized");
          }
View Full Code Here

  protected Object clone() throws CloneNotSupportedException {
    return super.clone();
  }

  public String getItem(String paramName) {
    RestrictField param = getPattern().getEntity().getField(paramName);
    if (null == param) {
      return null;
    } else {
      return getItem(param);
    }
View Full Code Here

  }

  private List<Object> getMyRestrictionValues(List<Restriction> restrictions, String name) {
    List<Object> values = CollectUtils.newArrayList();
    for (Restriction restriction : restrictions) {
      RestrictField field = restriction.getPattern().getEntity().getField(name);
      if (null != field) {
        String value = restriction.getItem(field);
        if (null != value) {
          if (field.isMultiple()) {
            values.addAll((Collection<?>) restrictionService.getFieldValue(field, restriction));
          } else {
            values.add(restrictionService.getFieldValue(field, restriction));
          }
        }
View Full Code Here

  protected Object clone() throws CloneNotSupportedException {
    return super.clone();
  }

  public String getItem(String paramName) {
    RestrictField param = getPattern().getEntity().getField(paramName);
    if (null == param) {
      return null;
    } else {
      return getItem(param);
    }
View Full Code Here

TOP

Related Classes of org.beangle.ems.security.restrict.RestrictField

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.