Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2014 Dell, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dell.doradus.olap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.dell.doradus.common.ApplicationDefinition;
import com.dell.doradus.common.FieldDefinition;
import com.dell.doradus.common.FieldType;
import com.dell.doradus.common.TableDefinition;
import com.dell.doradus.olap.aggregate.AggregationResult;
import com.dell.doradus.service.db.Tenant;
import com.dell.doradus.service.olap.OLAPService;
import com.dell.doradus.service.schema.SchemaService;
// simple REST application based on OLAP
public class Olapp {
private Tenant m_tenant;
private Olap m_olap;
private Map m_parameters;
private StringBuilder m_builder;
public int pcount() { return m_parameters.size(); }
public String getApplication() { return getParam("application"); }
public String getShard() { return getParam("shard"); }
public String getTable() { return getParam("table"); }
public String getQuery() { return getParam("query"); }
public String getField() { return getParam("field"); }
public String getLink() { return getParam("link"); }
private String getParam(String name) {
String value = m_parameters.get(name);
if("null".equals(value)) return null;
return value;
}
public Olapp(Tenant tenant, Olap olap, Map parameters) {
m_tenant = tenant;
m_olap = olap;
m_parameters = parameters;
m_builder = new StringBuilder();
}
public static String process(Tenant tenant, Olap olap, Map parameters) {
Olapp olapp = new Olapp(tenant, olap, parameters);
return olapp.process();
}
private String process() {
if(pcount() == 0) {
return processGetApplications();
} else {
return processAggregate();
}
//throw new IllegalArgumentException("Not supported");
}
private String processGetApplications() {
List appDefs = OLAPService.instance().getAllOLAPApplications(m_tenant);
m_builder.append("