private List<?> findSelection(Property property) {
   if (property.getSelection() == null) {
     return null;
   }
   return MetaStore.getSelectionList(property.getSelection());
 }
  private Map<String, Object> findFields(final String model, final List<String> names) {
    final Map<String, Object> data = Maps.newHashMap();

    if (Strings.isNullOrEmpty(model)) {
      return data;
    }

    final Class<?> modelClass = findClass(model);
    final Mapper mapper = Mapper.of(modelClass);
    final List<Object> fields = Lists.newArrayList();

    boolean massUpdate = false;
    Object bean = null;
    try {
      bean = modelClass.newInstance();
    } catch (Exception e) {
    }

    for (String name : names) {
      Property p = findField(mapper, name);
      if (p != null) {
        Map<String, Object> map = p.toMap();
        map.put("name", name);
        if (p.getSelection() != null && !"".equals(p.getSelection().trim())) {
          map.put("selection", p.getSelection());
          map.put("selectionList", findSelection(p));
        }
        if (p.getTarget() != null) {
          map.put("perms", MetaStore.getPermissions(p.getTarget()));
        }
        if (p.isMassUpdate()) {
          massUpdate = true;
        }
        // find the default value
        if (!p.isTransient() && !p.isVirtual()) {
          Object obj = null;
          if (name.contains(".")) {
            try {
              obj = p.getEntity().newInstance();
            } catch (Exception e) {
            }
          } else {
            obj = bean;
          }
          if (obj != null) {
            Object defaultValue = p.get(obj);
            if (defaultValue != null) {
              map.put("defaultValue", defaultValue);
            }
          }
        }
        fields.add(map);
      }
    }

    Map<String, Object> perms = MetaStore.getPermissions(modelClass);

    if (massUpdate) {
      if (perms == null) {
        perms = Maps.newHashMap();
      }
      perms.put("massUpdate", massUpdate);
    }

    data.put("perms", perms);
    data.put("fields", fields);

    return data;
  }