/** Builds the write query based on the access limits class */ public static Query getWriteQuery(WrapperPolicy policy) { if (policy.getAccessLevel() != AccessLevel.READ_WRITE) { return new Query(null, Filter.EXCLUDE); } else if (policy.getLimits() == null) { return Query.ALL; } else if (policy.getLimits() instanceof VectorAccessLimits) { VectorAccessLimits val = (VectorAccessLimits) policy.getLimits(); return val.getWriteQuery(); } else { throw new IllegalArgumentException( "SecureFeatureStore has been fed " + "with unexpected AccessLimits class " + policy.getLimits().getClass()); } }
protected Query getReadQuery() { if (policy.getAccessLevel() == AccessLevel.HIDDEN || policy.getAccessLevel() == AccessLevel.METADATA) { return new Query(null, Filter.EXCLUDE); } else if (policy.getLimits() == null) { return Query.ALL; } else if (policy.getLimits() instanceof VectorAccessLimits) { VectorAccessLimits val = (VectorAccessLimits) policy.getLimits(); // Ugly hack: during WFS transactions the reads we do are used to count the number of // features // we are deleting/updating: use the write filter instead of the read filter Request request = Dispatcher.REQUEST.get(); if (request != null && request.getService().equalsIgnoreCase("WFS") && request.getRequest().equalsIgnoreCase("Transaction")) { return val.getWriteQuery(); } else { return val.getReadQuery(); } } else { throw new IllegalArgumentException( "SecureFeatureSources has been fed " + "with unexpected AccessLimits class " + policy.getLimits().getClass()); } }