Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Aug 23, 2018
2 parents f4a2aa9 + ea95bf0 commit 09be42e
Show file tree
Hide file tree
Showing 30 changed files with 1,004 additions and 1,231 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.6.0</version>
<version>3.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,4 +547,21 @@ public Collection<Object> values() {
public Set<Entry<String, Object>> entrySet() {
return objectMap.entrySet();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ObjectMap)) {
return false;
}
ObjectMap objectMap1 = (ObjectMap) o;
return Objects.equals(objectMap, objectMap1.objectMap);
}

@Override
public int hashCode() {
return Objects.hash(objectMap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public <E extends Enum<E> & QueryParam> void validate(Class<E> enumType)
put(queryParam.key(), getAsStringList(queryParam.key()));
break;
case INTEGER:
case LONG:
put(queryParam.key(), getLong(queryParam.key()));
break;
case INTEGER_ARRAY:
case LONG_ARRAY:
put(queryParam.key(), getAsLongList(queryParam.key()));
break;
case DECIMAL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ enum Type {
DOUBLE,
DECIMAL,
DECIMAL_ARRAY,
LONG,
LONG_ARRAY,
BOOLEAN,
DATE
BOOLEAN_ARRAY,
DATE,
TIMESTAMP
}

String key();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,21 @@

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> extends AbstractResult {
public class QueryResult<T> {

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

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

public QueryResult(String id, int dbTime, int numResults, long numTotalResults, String warningMsg, String errorMsg, List<T> result) {
super(id, dbTime, numResults, numTotalResults, warningMsg, errorMsg);
this.id = id;
this.dbTime = dbTime;
this.numResults = numResults;
this.numTotalResults = numTotalResults;
this.warningMsg = warningMsg;
this.errorMsg = errorMsg;
this.resultType = result != null && !result.isEmpty() && result.get(0) != null ? result.get(0).getClass().getCanonicalName() : "";
this.result = result;
}
Expand Down Expand Up @@ -79,63 +81,53 @@ public String toString() {
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;
}

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() {
return resultType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,38 @@

package org.opencb.commons.datastore.core.result;

import java.util.List;

/**
* 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;
protected long numMatches;
protected List<Error> warning;
protected Error error;

public AbstractResult() {
}

public AbstractResult(String id, int dbTime, int numResults, long numTotalResults, String warningMsg, String errorMsg) {
public AbstractResult(String id, int dbTime, long numMatches, List<Error> warning, Error error) {
this.id = id;
this.dbTime = dbTime;
this.numResults = numResults;
this.numTotalResults = numTotalResults;
this.warningMsg = warningMsg;
this.errorMsg = errorMsg;
this.numMatches = numMatches;
this.warning = warning;
this.error = error;
}

@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(", numMatches=").append(numMatches);
sb.append(", warning=").append(warning);
sb.append(", error=").append(error);
sb.append('}');
return sb.toString();
}
Expand All @@ -71,39 +70,30 @@ public AbstractResult setDbTime(int dbTime) {
return this;
}

public int getNumResults() {
return numResults;
}

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

public long getNumTotalResults() {
return numTotalResults;
public long getNumMatches() {
return numMatches;
}

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

public String getWarningMsg() {
return warningMsg;
public List<Error> getWarning() {
return warning;
}

public AbstractResult setWarningMsg(String warningMsg) {
this.warningMsg = warningMsg;
public AbstractResult setWarning(List<Error> warning) {
this.warning = warning;
return this;
}

public String getErrorMsg() {
return errorMsg;
public Error getError() {
return error;
}

public AbstractResult setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
public AbstractResult setError(Error error) {
this.error = error;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.opencb.commons.datastore.core.result;

public class Error {

private int code;

/**
* example: USER_NOT_FOUND, ...
*/
private String name;
private String description;

public Error() {
}

public Error(int code, String name, String description) {
this.code = code;
this.name = name;
this.description = description;
}


@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Error{");
sb.append("code=").append(code);
sb.append(", name='").append(name).append('\'');
sb.append(", description='").append(description).append('\'');
sb.append('}');
return sb.toString();
}

public int getCode() {
return code;
}

public Error setCode(int code) {
this.code = code;
return this;
}

public String getName() {
return name;
}

public Error setName(String name) {
this.name = name;
return this;
}

public String getDescription() {
return description;
}

public Error setDescription(String description) {
this.description = description;
return this;
}
}
Loading

0 comments on commit 09be42e

Please sign in to comment.