io.infinicast.client.impl.query.BaseQueryExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinicast-client-jdk8 Show documentation
Show all versions of infinicast-client-jdk8 Show documentation
Infinicast SDK to communicate with the cloud.
package io.infinicast.client.impl.query;
import io.infinicast.JArray;
import io.infinicast.JObject;
import io.infinicast.JToken;
import io.infinicast.StringExtensions;
import io.infinicast.client.api.IPath;
import io.infinicast.client.api.errors.ICError;
import io.infinicast.client.api.paths.IAPathContext;
import io.infinicast.client.api.paths.IPathAndEndpointContext;
import io.infinicast.client.api.paths.options.CompleteCallback;
import io.infinicast.client.impl.IConnector;
import io.infinicast.client.impl.contexts.APathContext;
import io.infinicast.client.impl.helper.ErrorHandlingHelper;
import io.infinicast.client.impl.messaging.ConnectorMessageManager;
import java.util.HashMap;
public class BaseQueryExecutor {
public IPath _path;
public ConnectorMessageManager _messageManager;
public IConnector _connector;
public BaseQueryExecutor(IConnector connector, IPath path, ConnectorMessageManager messageManager) {
this._connector = connector;
this._path = path;
this._messageManager = messageManager;
}
public IAPathContext getPathAndEndpointContext(IPathAndEndpointContext ctx) {
APathContext context = new APathContext();
context.setPath(ctx.getPath());
return context;
}
public IAPathContext getPathContext(IPath path) {
APathContext context = new APathContext();
context.setPath(path);
return context;
}
public boolean checkIfHasErrorsAndCallHandlersNew(ICError error, CompleteCallback completeCallback) {
return ErrorHandlingHelper.checkIfHasErrorsAndCallHandlersNew(this._connector, error, completeCallback, this._path);
}
public void checkIfHasErrorsAndCallHandlersFull(ICError error, CompleteCallback completeCallback) {
ErrorHandlingHelper.checkIfHasErrorsAndCallHandlersFull(this._connector, error, completeCallback, this._path);
}
public static HashMap getRoleCountDictionary(JObject json) {
HashMap roleCount = new HashMap();
JArray roleCountArray = json.getJArray("roleCount");
if ((roleCountArray != null)) {
for (JToken roleOb : roleCountArray) {
String role = roleOb.getString("role");
String handlerType = roleOb.getString("handlerType");
int count = roleOb.getInt("count");
if (StringExtensions.areEqual(handlerType, "Message")) {
roleCount.put(role, count);
}
}
}
return roleCount;
}
public void unhandeledError(ICError icErrorResults) {
this._connector.unhandeledErrorInfo(this._path, icErrorResults);
}
}