Skip to content

Commit

Permalink
Merge branch 'hotfix-3.4.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed May 22, 2017
2 parents 73492e1 + 4cc4dd9 commit fce8432
Show file tree
Hide file tree
Showing 18 changed files with 1,055 additions and 97 deletions.
2 changes: 1 addition & 1 deletion commons-datastore/commons-datastore-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.commons</groupId>
<artifactId>commons-datastore</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public class QueryOptions extends ObjectMap {
public static final String TIMEOUT = "timeout";
public static final String SKIP_COUNT = "skipCount";

public static final String FACET = "facet";
public static final String FACET_RANGE = "facetRange";
public static final String FACET_INTERSECTION = "facetIntersection";

public QueryOptions() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@

package org.opencb.commons.datastore.core;

import org.opencb.commons.datastore.core.result.AbstractResult;

import java.util.ArrayList;
import java.util.List;

/**
* Created by imedina on 20/03/14.
*/
public class QueryResult<T> {
public class QueryResult<T> extends AbstractResult {

private String id;
@Deprecated
private int time;
private int dbTime;
private int numResults;
private long numTotalResults;
private String warningMsg;
private String errorMsg;
// private String id;
// @Deprecated
// private int time;
// private int dbTime;
// private int numResults;
// private long numTotalResults;
// private String warningMsg;
// private String errorMsg;
// @Deprecated
// private String featureType;

Expand All @@ -48,12 +50,7 @@ public QueryResult(String id) {
}

public QueryResult(String id, int dbTime, int numResults, long numTotalResults, String warningMsg, String errorMsg, List<T> result) {
this.id = id;
this.dbTime = dbTime;
this.numResults = numResults;
this.numTotalResults = numTotalResults;
this.warningMsg = warningMsg;
this.errorMsg = errorMsg;
super(id, dbTime, numResults, numTotalResults, warningMsg, errorMsg);
this.resultType = result != null && !result.isEmpty() && result.get(0) != null ? result.get(0).getClass().getCanonicalName() : "";
this.result = result;
}
Expand All @@ -69,86 +66,75 @@ public T first() {
public String toString() {
final StringBuilder sb = new StringBuilder("QueryResult{");
sb.append("id='").append(id).append('\'');
sb.append(", time=").append(time);
// sb.append(", time=").append(time);
sb.append(", dbTime=").append(dbTime);
sb.append(", numResults=").append(numResults);
sb.append(", numTotalResults=").append(numTotalResults);
sb.append(", warningMsg='").append(warningMsg).append('\'');
sb.append(", errorMsg='").append(errorMsg).append('\'');
// sb.append(", featureType='").append(featureType).append('\'');
sb.append(", resultType='").append(resultType).append('\'');
sb.append(", clazz=").append(clazz);
sb.append(", result=").append(result);
sb.append('}');
return sb.toString();
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

@Deprecated
public int getTime() {
return time;
}

@Deprecated
public void setTime(int time) {
this.time = time;
}

public int getDbTime() {
return dbTime;
}

public void setDbTime(int dbTime) {
this.dbTime = dbTime;
}

public int getNumResults() {
return numResults;
}

public void setNumResults(int numResults) {
this.numResults = numResults;
}

public long getNumTotalResults() {
return numTotalResults;
}

public void setNumTotalResults(long numTotalResults) {
this.numTotalResults = numTotalResults;
}

public String getWarningMsg() {
return warningMsg;
}

public void setWarningMsg(String warningMsg) {
this.warningMsg = warningMsg;
}

public String getErrorMsg() {
return errorMsg;
}

public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// @Deprecated
// public String getFeatureType() {
// return featureType;
// public int getTime() {
// return time;
// }
//
// @Deprecated
// public void setFeatureType(String featureType) {
// this.featureType = featureType;
// public void setTime(int time) {
// this.time = time;
// }
//
// public int getDbTime() {
// return dbTime;
// }
//
// public void setDbTime(int dbTime) {
// this.dbTime = dbTime;
// }
//
// public int getNumResults() {
// return numResults;
// }
//
// public void setNumResults(int numResults) {
// this.numResults = numResults;
// }
//
// public long getNumTotalResults() {
// return numTotalResults;
// }
//
// public void setNumTotalResults(long numTotalResults) {
// this.numTotalResults = numTotalResults;
// }
//
// public String getWarningMsg() {
// return warningMsg;
// }
//
// public void setWarningMsg(String warningMsg) {
// this.warningMsg = warningMsg;
// }
//
// public String getErrorMsg() {
// return errorMsg;
// }
//
// public void setErrorMsg(String errorMsg) {
// this.errorMsg = errorMsg;
// }

public String getResultType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* Copyright 2015-2017 OpenCB
*
* 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 org.opencb.commons.datastore.core.result;

/**
* Created by imedina on 23/03/17.
*/
public class AbstractResult {

protected String id;
protected int dbTime;
protected int numResults;
protected long numTotalResults;
protected String warningMsg;
protected String errorMsg;

public AbstractResult() {
}

public AbstractResult(String id, int dbTime, int numResults, long numTotalResults, String warningMsg, String errorMsg) {
this.id = id;
this.dbTime = dbTime;
this.numResults = numResults;
this.numTotalResults = numTotalResults;
this.warningMsg = warningMsg;
this.errorMsg = errorMsg;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("AbstractResult{");
sb.append("id='").append(id).append('\'');
sb.append(", dbTime=").append(dbTime);
sb.append(", numResults=").append(numResults);
sb.append(", numTotalResults=").append(numTotalResults);
sb.append(", warningMsg='").append(warningMsg).append('\'');
sb.append(", errorMsg='").append(errorMsg).append('\'');
sb.append('}');
return sb.toString();
}

public String getId() {
return id;
}

public AbstractResult setId(String id) {
this.id = id;
return this;
}

public int getDbTime() {
return dbTime;
}

public AbstractResult setDbTime(int dbTime) {
this.dbTime = dbTime;
return this;
}

public int getNumResults() {
return numResults;
}

public AbstractResult setNumResults(int numResults) {
this.numResults = numResults;
return this;
}

public long getNumTotalResults() {
return numTotalResults;
}

public AbstractResult setNumTotalResults(long numTotalResults) {
this.numTotalResults = numTotalResults;
return this;
}

public String getWarningMsg() {
return warningMsg;
}

public AbstractResult setWarningMsg(String warningMsg) {
this.warningMsg = warningMsg;
return this;
}

public String getErrorMsg() {
return errorMsg;
}

public AbstractResult setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2015-2017 OpenCB
*
* 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 org.opencb.commons.datastore.core.result;

/**
* Created by jtarraga on 09/03/17.
*/
public class FacetedQueryResult extends AbstractResult {

private FacetedQueryResultItem result;

public FacetedQueryResult() {
}

public FacetedQueryResult(String id, int dbTime, int numResults, long numTotalResults, String warningMsg, String errorMsg,
FacetedQueryResultItem result) {
super(id, dbTime, numResults, numTotalResults, warningMsg, errorMsg);
this.result = result;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("FacetedQueryResult{");
sb.append("id='").append(id).append('\'');
sb.append(", dbTime=").append(dbTime);
sb.append(", numResults=").append(numResults);
sb.append(", numTotalResults=").append(numTotalResults);
sb.append(", warningMsg='").append(warningMsg).append('\'');
sb.append(", errorMsg='").append(errorMsg).append('\'');
sb.append(", result=").append(result);
sb.append('}');
return sb.toString();
}

public FacetedQueryResultItem getResult() {
return result;
}

public FacetedQueryResult setResult(FacetedQueryResultItem result) {
this.result = result;
return this;
}
}
Loading

0 comments on commit fce8432

Please sign in to comment.