public static Filter getFilter(Env env, Value filterIdV) { int filterId; int defaultFilterId = FILTER_UNSAFE_RAW; if (filterIdV.isDefault()) { // XXX: lookup in ini filterId = defaultFilterId; } else if (filterIdV.isArray()) { Value value = filterIdV.get(env.createString("filter")); if (value.isNull()) { filterId = defaultFilterId; } else { filterId = value.toInt(); } } else { filterId = filterIdV.toInt(); } Filter filter = _filterMap.get(filterId); if (filter == null) { throw new UnimplementedException( L.l("filter not implemented: {0} ({1})", filterIdV, filterId)); } return filter; }
/** * Converts node tree to a valid xml string. * * @return xml string */ public final Value asXML(Env env, @Optional Value filename) { Value value = toXML(env); if (!value.isString()) { return value; } StringValue str = value.toStringValue(env); if (filename.isDefault()) { return str; } else { Path path = env.lookupPwd(filename); OutputStream os = null; try { os = path.openWrite(); str.writeTo(os); return BooleanValue.TRUE; } catch (IOException e) { env.warning(e); return BooleanValue.FALSE; } finally { if (os != null) { IoUtil.close(os); } } } }
public static String gae_users_create_login_url( Env env, String destinationUrl, @Optional String authDomain, @Optional String federatedIdentity, @Optional Value attributesRequest) { Set<String> attributeSet = null; if (!attributesRequest.isDefault()) { attributeSet = new HashSet<String>(); ArrayValue array = attributesRequest.toArrayValue(env); for (Map.Entry<Value, Value> entrySet : array.entrySet()) { attributeSet.add(entrySet.getValue().toString()); } } return GaeUserService.createLoginURL( destinationUrl, authDomain, federatedIdentity, attributeSet); }