Commit 5e30905e authored by Ole Voldsæter's avatar Ole Voldsæter

fixes #2305

parent 9105a686
......@@ -6,16 +6,10 @@ import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import com.nesstar.api.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.nesstar.api.Bank;
import com.nesstar.api.NesstarObject;
import com.nesstar.api.NotAuthorizedException;
import com.nesstar.api.Server;
import com.nesstar.api.Study;
import com.nesstar.api.Variable;
import com.nesstar.api.VariableGroup;
import com.nesstar.api.cube.Cube;
import com.nesstar.rest.common.ETag;
import com.nesstar.rest.common.ETagData;
......@@ -117,7 +111,7 @@ public class CommonEntityTagFilter extends EntityTagFilter {
if ("all-metadata".equalsIgnoreCase(childType)) {
child = parent;
} else if ("variables".equalsIgnoreCase(childType)) {
child = ((Study) parent).getVariables();
child = getVariablesFromParent(parent);
} else if ("variable-groups".equalsIgnoreCase(childType)) {
child = ((Study) parent).getVariableGroups();
} else if ("child-groups".equalsIgnoreCase(childType)) {
......@@ -126,6 +120,15 @@ public class CommonEntityTagFilter extends EntityTagFilter {
return child;
}
private DdiList<Variable> getVariablesFromParent(NesstarObject parent) throws NotAuthorizedException, IOException {
if (parent instanceof Study) {
return ((Study) parent).getVariables();
} else if (parent instanceof VariableGroup) {
return ((VariableGroup) parent).getVariables();
}
throw new IllegalArgumentException("argument must be of type Study of VariableGroup");
}
private NesstarObject getListOfObjectsFromBank(String listType) throws IOException, NotAuthorizedException {
String type = translateListTypeToObjectType(listType);
if (type == null) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment