code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public <E> E load(Class<E> entityClass, DatastoreKey parentKey, long id) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key nativeKey;
if (parentKey == null) {
nativeKey = entityManager.newNativeKeyFactory().setKind(entityMetadata.getKind()).newKey(id);
} else {
... | java |
public <E> E load(Class<E> entityClass, DatastoreKey key) {
return fetch(entityClass, key.nativeKey());
} | java |
public <E> List<E> loadByKey(Class<E> entityClass, List<DatastoreKey> keys) {
Key[] nativeKeys = DatastoreUtils.toNativeKeys(keys);
return fetch(entityClass, nativeKeys);
} | java |
private <E> E fetch(Class<E> entityClass, Key nativeKey) {
try {
Entity nativeEntity = nativeReader.get(nativeKey);
E entity = Unmarshaller.unmarshal(nativeEntity, entityClass);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entity);
return entity;
} catch (DatastoreExcepti... | java |
private <E> List<E> fetch(Class<E> entityClass, Key[] nativeKeys) {
try {
List<Entity> nativeEntities = nativeReader.fetch(nativeKeys);
List<E> entities = DatastoreUtils.toEntities(entityClass, nativeEntities);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entities);
return en... | java |
private Key[] longListToNativeKeys(Class<?> entityClass, List<Long> identifiers) {
if (identifiers == null || identifiers.isEmpty()) {
return new Key[0];
}
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key[] nativeKeys = new Key[identifiers.size()];
KeyFactory key... | java |
private IncompleteKey getIncompleteKey(Object entity) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entity.getClass());
String kind = entityMetadata.getKind();
ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
DatastoreKey parentKey = null;
IncompleteKey ... | java |
public void executeEntityListeners(CallbackType callbackType, Object entity) {
// We may get null entities here. For example loading a nonexistent ID
// or IDs.
if (entity == null) {
return;
}
EntityListenersMetadata entityListenersMetadata = EntityIntrospector
.getEntityListenersMetad... | java |
public void executeEntityListeners(CallbackType callbackType, List<?> entities) {
for (Object entity : entities) {
executeEntityListeners(callbackType, entity);
}
} | java |
private void executeGlobalListeners(CallbackType callbackType, Object entity) {
if (globalCallbacks == null) {
return;
}
List<CallbackMetadata> callbacks = globalCallbacks.get(callbackType);
if (callbacks == null) {
return;
}
for (CallbackMetadata callback : callbacks) {
Object... | java |
private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) {
try {
callbackMethod.invoke(listener, entity);
} catch (Exception exp) {
String message = String.format("Failed to execute callback method %s of class %s",
callbackMethod.getName(), callbackMe... | java |
@SuppressWarnings("unchecked")
private <T extends Indexer> T createIndexer(Class<T> indexerClass) {
synchronized (indexerClass) {
Indexer indexer = cache.get(indexerClass);
if (indexer == null) {
indexer = (Indexer) IntrospectionUtils.instantiateObject(indexerClass);
cache.put(indexerC... | java |
private Indexer getDefaultIndexer(Field field) {
Type type = field.getGenericType();
if (type instanceof Class && type.equals(String.class)) {
return getIndexer(LowerCaseStringIndexer.class);
} else if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType... | java |
private void copyRequestHeaders(HttpServletRequest servletRequest, HttpRequest proxyRequest)
throws URISyntaxException {
// Get an Enumeration of all of the header names sent by the client
Enumeration<?> enumerationOfHeaderNames = servletRequest.getHeaderNames();
while (enumerationOf... | java |
private void copyResponseHeaders(HttpResponse proxyResponse, final HttpServletResponse servletResponse) {
servletResponse.setCharacterEncoding(getContentCharSet(proxyResponse.getEntity()));
from(Arrays.asList(proxyResponse.getAllHeaders())).filter(new Predicate<Header>() {
@Override
... | java |
private String getContentCharSet(final HttpEntity entity) throws ParseException {
if (entity == null) {
return null;
}
String charset = null;
if (entity.getContentType() != null) {
HeaderElement values[] = entity.getContentType().getElements();
if (val... | java |
@SuppressWarnings("unchecked")
public T getDefaultObject() {
if(defaultValue instanceof IModel) {
return ((IModel<T>)defaultValue).getObject();
} else {
return (T) defaultValue;
}
} | java |
public JsonResponse getEmail(String email) throws IOException {
Email emailObj = new Email();
emailObj.setEmail(email);
return apiGet(emailObj);
} | java |
public JsonResponse getSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiGet(ApiAction.send, data);
} | java |
public JsonResponse cancelSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiDelete(ApiAction.send, data);
} | java |
public JsonResponse getBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiGet(blast);
} | java |
public JsonResponse scheduleBlastFromTemplate(String template, String list, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyTemplate(template);
blast.setList(list);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | java |
public JsonResponse scheduleBlastFromBlast(Integer blastId, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyBlast(blastId);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | java |
public JsonResponse updateBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiPost(blast);
} | java |
public JsonResponse deleteBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiDelete(blast);
} | java |
public JsonResponse cancelBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
Date d = null;
blast
.setBlastId(blastId)
.setScheduleTime(d);
return apiPost(blast);
} | java |
public JsonResponse getTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiGet(ApiAction.template, data);
} | java |
public JsonResponse deleteTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiDelete(ApiAction.template, data);
} | java |
public JsonResponse getAlert(String email) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
return apiGet(ApiAction.alert, data);
} | java |
public JsonResponse deleteAlert(String email, String alertId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
data.put(Alert.PARAM_ALERT_ID, alertId);
return apiDelete(ApiAction.alert, data);
} | java |
public Map<String, Object> listStats(ListStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | java |
public Map<String, Object> blastStats(BlastStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | java |
public JsonResponse getJobStatus(String jobId) throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(Job.JOB_ID, jobId);
return apiGet(ApiAction.job, params);
} | java |
public OSchemaHelper linkedClass(String className)
{
checkOProperty();
OClass linkedToClass = schema.getClass(className);
if(linkedToClass==null) throw new IllegalArgumentException("Target OClass '"+className+"' to link to not found");
if(!Objects.equal(linkedToClass, lastProperty.getLinkedClass()))
{
la... | java |
public OSchemaHelper linkedType(OType linkedType)
{
checkOProperty();
if(!Objects.equal(linkedType, lastProperty.getLinkedType()))
{
lastProperty.setLinkedType(linkedType);
}
return this;
} | java |
public OSchemaHelper field(String field, Object value)
{
checkODocument();
lastDocument.field(field, value);
return this;
} | java |
public static <R> R sudo(Function<ODatabaseDocument, R> func) {
return new DBClosure<R>() {
@Override
protected R execute(ODatabaseDocument db) {
return func.apply(db);
}
}.execute();
} | java |
public static void sudoConsumer(Consumer<ODatabaseDocument> consumer) {
new DBClosure<Void>() {
@Override
protected Void execute(ODatabaseDocument db) {
consumer.accept(db);
return null;
}
}.execute();
} | java |
public static void sudoSave(final ODocument... docs) {
if(docs==null || docs.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocument doc : docs) {
db.save(doc);
}
db.commit();
return true;
}
}.execute()... | java |
public static void sudoSave(final ODocumentWrapper... dws) {
if(dws==null || dws.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocumentWrapper dw : dws) {
dw.save();
}
db.commit();
return true;
}
}.exe... | java |
public static String buitify(String string)
{
char[] chars = string.toCharArray();
StringBuilder sb = new StringBuilder();
int lastApplied=0;
for(int i=0; i<chars.length;i++)
{
char pCh = i>0?chars[i-1]:0;
char ch = chars[i];
if(ch=='_' || ch=='-' || Character.isWhitespace(ch))
{
sb.append(ch... | java |
protected Object getDefaultValue(String propName, Class<?> returnType)
{
Object ret = null;
if(returnType.isPrimitive())
{
if(returnType.equals(boolean.class))
{
return false;
}
else if(returnType.equals(char.class))
{
return '\0';
}
else
{
try
{
Class<?> wrapperClass... | java |
public static boolean isAllowed(ORule.ResourceGeneric resource, String specific, OrientPermission... permissions)
{
return OrientDbWebSession.get().getEffectiveUser()
.checkIfAllowed(resource, specific, OrientPermission.combinedPermission(permissions))!=null;
} | java |
public static String getResourceSpecific(String name)
{
ORule.ResourceGeneric generic = getResourceGeneric(name);
String specific = generic!=null?Strings.afterFirst(name, '.'):name;
return Strings.isEmpty(specific)?null:specific;
} | java |
public String resolveOrientDBRestApiUrl()
{
OrientDbWebApplication app = OrientDbWebApplication.get();
OServer server = app.getServer();
if(server!=null)
{
OServerNetworkListener http = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if(http!=null)
{
return "http://"+http.getList... | java |
public boolean isInProgress(RequestCycle cycle)
{
Boolean inProgress = cycle.getMetaData(IN_PROGRESS_KEY);
return inProgress!=null?inProgress:false;
} | java |
public OClass probeOClass(int probeLimit) {
Iterator<ODocument> it = iterator(0, probeLimit, null);
return OSchemaUtils.probeOClass(it, probeLimit);
} | java |
public long size()
{
if(size==null)
{
ODatabaseDocument db = OrientDbWebSession.get().getDatabase();
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>(queryManager.getCountSql());
List<ODocument> ret = db.query(enhanceContextByVariables(query), prepareParams());
if(re... | java |
public OQueryModel<K> setSort(String sortableParameter, SortOrder order)
{
setSortableParameter(sortableParameter);
setAscending(SortOrder.ASCENDING.equals(order));
return this;
} | java |
public static String md5(String data) {
try {
return DigestUtils.md5Hex(data.toString().getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e) {
return DigestUtils.md5Hex(data.toString());
}
} | java |
public static String arrayListToCSV(List<String> list) {
StringBuilder csv = new StringBuilder();
for (String str : list) {
csv.append(str);
csv.append(",");
}
int lastIndex = csv.length() - 1;
char last = csv.charAt(lastIndex);
if (last == ',') {
... | java |
protected Scheme getScheme() {
String scheme;
try {
URI uri = new URI(this.apiUrl);
scheme = uri.getScheme();
} catch (URISyntaxException e) {
scheme = "http";
}
if (scheme.equals("https")) {
return new Scheme(scheme, DEFAULT_HTTPS_... | java |
protected Object httpRequest(ApiAction action, HttpRequestMethod method, Map<String, Object> data) throws IOException {
String url = this.apiUrl + "/" + action.toString().toLowerCase();
Type type = new TypeToken<Map<String, Object>>() {}.getType();
String json = GSON.toJson(data, type);
... | java |
protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException {
ApiAction action = apiParams.getApiCall();
String url = apiUrl + "/" + action.toString().toLowerCase();
String json = GSON.toJson(apiParams, apiParams.getType());
Map<String, String> params =... | java |
private Map<String, String> buildPayload(String jsonPayload) {
Map<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("format", handler.getSailthruResponseHandler().getFormat());
params.put("json", jsonPayload);
params.put("sig", get... | java |
protected String getSignatureHash(Map<String, String> parameters) {
List<String> values = new ArrayList<String>();
StringBuilder data = new StringBuilder();
data.append(this.apiSecret);
for (Entry<String, String> entry : parameters.entrySet()) {
values.add(entry.getValue());... | java |
public JsonResponse apiGet(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.GET, data);
} | java |
public JsonResponse apiPost(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.POST, data);
} | java |
public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException {
return httpRequestJson(HttpRequestMethod.POST, data, fileParams);
} | java |
public JsonResponse apiDelete(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.DELETE, data);
} | java |
static public int obtainNextIncrementInteger(Connection connection, ColumnData autoIncrementIntegerColumn) throws Exception {
try {
String sqlQuery = "SELECT nextval(?);";
// Create SQL command
PreparedStatement pstmt = null;
{
pstmt = connection.prepareStatement(sqlQuery);
// Populate prepa... | java |
static String unescapeEntity(String e) {
// validate
if (e == null || e.isEmpty()) {
return "";
}
// if our entity is an encoded unicode point, parse it.
if (e.charAt(0) == '#') {
int cp;
if (e.charAt(1) == 'x') {
// hex encoded... | java |
private String convertLastSeqObj(Object lastSeqObj) throws Exception {
if( null == lastSeqObj ) {
return null;
} else if( lastSeqObj instanceof String ) {
return (String)lastSeqObj;
} else if( lastSeqObj instanceof Number ) {
// Convert to string
return "" + lastSeqObj;
} else {
throw new Excepti... | java |
public void renameAttachmentTo(String newAttachmentName) throws Exception {
JSONObject doc = documentDescriptor.getJson();
JSONObject _attachments = doc.optJSONObject("_attachments");
JSONObject nunaliit_attachments = doc.getJSONObject(UploadConstants.KEY_DOC_ATTACHMENTS);
JSONObject files = nunaliit_attachment... | java |
static public FSEntry getPositionedFile(String path, File file) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = new FSEntryFile(pathFrags.get(index), file);
--index;
while(index >= 0... | java |
private String computeSelectScore(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if( 0 == searchFields.size() ) {
throw new Exception("Must supply at least one search field");
} else if( 1 == searchFields.size() ) {
pw.print... | java |
private String computeWhereFragment(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
boolean first = true;
for(int loop=0; loop<searchFields.size(); ++loop) {
if( first ) {
first = false;
pw.print(" WHERE ");
} else {
... | java |
private JSONArray executeStatementToJson(
PreparedStatement stmt,
List<SelectedColumn> selectFields) throws Exception {
//logger.info("about to execute: " + stmt.toString());
if( stmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = stmt.getResultSet();
JSONArray array = new JSONArray()... | java |
public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception {
List<SelectedColumn> selectFields = new Vector<SelectedColumn>();
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") );
selectFiel... | java |
static public boolean hasDocumentBeenModified(
JSONObject targetDoc
) {
JSONObject targetManifest = targetDoc.optJSONObject(MANIFEST_KEY);
if( null == targetManifest ) {
// Can not verify digest on target document. Let's assume it has
// been modified
return true;
}
String targetDigest = target... | java |
static public Integer getAttachmentPosition(
JSONObject targetDoc
,String attachmentName
) {
JSONObject targetAttachments = targetDoc.optJSONObject("_attachments");
if( null == targetAttachments ) {
// No attachment on target doc
return null;
}
JSONObject targetAttachment = targetAttachment... | java |
public static void setCompressionType(ImageWriteParam param, BufferedImage image)
{
// avoid error: first compression type is RLE, not optimal and incorrect for color images
// TODO expose this choice to the user?
if (image.getType() == BufferedImage.TYPE_BYTE_BINARY &&
image.get... | java |
static public FSEntry getPositionedResource(String path, ClassLoader classLoader, String resourceName) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = create(pathFrags.get(index), classLoad... | java |
static public FSEntryResource create(ClassLoader classLoader, String resourceName) throws Exception {
return create(null, classLoader, resourceName);
} | java |
static public FSEntryResource create(String name, ClassLoader classLoader, String resourceName) throws Exception {
URL url = classLoader.getResource(resourceName);
if( "jar".equals( url.getProtocol() ) ) {
String path = url.getPath();
if( path.startsWith("file:") ) {
int bangIndex = path.indexOf('!');
... | java |
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean loggedIn = false;
User user = null;
try {
Cookie cookie = getCookieFromRequest(request);
if( null != cookie ) {
user = CookieAuthentication.verifyCookieString(userRepository, cookie.ge... | java |
static public TreeRebalanceProcess.Result createTree(List<? extends TreeElement> elements) throws Exception {
Result results = new Result();
// Compute full interval, next cluster id and legacy nodes
TimeInterval fullRegularInterval = null;
TimeInterval fullOngoingInterval = null;
results.nextClusterId = 1;
... | java |
synchronized public Connection getDb(String db) throws Exception {
Connection con = null;
if (nameToConnection.containsKey(db)) {
con = nameToConnection.get(db);
} else {
ConnectionInfo info = nameToInfo.get(db);
if( null == info ) {
throw new Exception("No information provided for database named... | java |
static public void captureReponseErrors(Object response, String errorMessage) throws Exception {
if( null == response ) {
throw new Exception("Capturing errors from null response");
}
if( false == (response instanceof JSONObject) ) {
// Not an error
return;
}
JSONObject obj = (JSONObject)response;
... | java |
static public File computeAtlasDir(String name) {
File atlasDir = null;
if( null == name ) {
// Current dir
atlasDir = new File(".");
} else {
atlasDir = new File(name);
}
// Force absolute
if( false == atlasDir.isAbsolute() ){
atlasDir = atlasDir.getAbsoluteFile();
}
return atlasDi... | java |
static public File computeInstallDir() {
File installDir = null;
// Try to find the path of a known resource file
File knownResourceFile = null;
{
URL url = Main.class.getClassLoader().getResource("commandResourceDummy.txt");
if( null == url ){
// Nothing we can do since the resource is not found
... | java |
static public File computeContentDir(File installDir) {
if( null != installDir ) {
// Command-line package
File contentDir = new File(installDir, "content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
// Development environment
File nunaliit2Dir = computeNun... | java |
static public File computeBinDir(File installDir) {
if( null != installDir ) {
// Command-line package
File binDir = new File(installDir, "bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
... | java |
static public File computeSiteDesignDir(File installDir) {
if( null != installDir ) {
// Command-line package
File templatesDir = new File(installDir, "internal/siteDesign");
if( templatesDir.exists() && templatesDir.isDirectory() ) {
return templatesDir;
}
// Development environment
File nu... | java |
static public File computeNunaliitDir(File installDir) {
while( null != installDir ){
// The root of the nunalii2 project contains "nunaliit2-couch-command",
// "nunaliit2-couch-sdk" and "nunaliit2-js"
boolean commandExists = (new File(installDir, "nunaliit2-couch-command")).exists();
boolean sdkExists = ... | java |
static public Set<String> getDescendantPathNames(File dir, boolean includeDirectories) {
Set<String> paths = new HashSet<String>();
if( dir.exists() && dir.isDirectory() ) {
String[] names = dir.list();
for(String name : names){
File child = new File(dir,name);
getPathNames(child, paths, null, include... | java |
static public void emptyDirectory(File dir) throws Exception {
String[] fileNames = dir.list();
if( null != fileNames ) {
for(String fileName : fileNames){
File file = new File(dir,fileName);
if( file.isDirectory() ) {
emptyDirectory(file);
}
boolean deleted = false;
try {
deleted =... | java |
static public MailVetterDailyNotificationTask scheduleTask(
CouchDesignDocument serverDesignDoc
,MailNotification mailNotification
){
Timer timer = new Timer();
MailVetterDailyNotificationTask installedTask = new MailVetterDailyNotificationTask(
timer
,serverDesignDoc
,mailNotification
... | java |
public Geometry simplifyGeometryAtResolution(Geometry geometry, double resolution) throws Exception {
double inverseRes = 1/resolution;
double p = Math.log10(inverseRes);
double exp = Math.ceil( p );
if( exp < 0 ) exp = 0;
double factor = Math.pow(10,exp);
Geometry simplifiedGeometry = simplify(geometry, r... | java |
private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String tableName = getTableNameFromRequest(request);
DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(u... | java |
private void performMultiQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String[] queriesStrings = request.getParameterValues("queries");
if( 1 != queriesStrings.length ) {
throw new Exception("Parameter 'queries' ... | java |
private List<FieldSelector> getFieldSelectorsFromRequest(HttpServletRequest request) throws Exception {
String[] fieldSelectorStrings = request.getParameterValues("select");
if( null == fieldSelectorStrings ) {
return null;
}
if( 0 == fieldSelectorStrings.length ) {
return null;
}
List<FieldSele... | java |
private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
String[] orderByStrings = request.getParameterValues("orderBy");
if( null == orderByStrings ) {
return null;
}
if( 0 == orderByStrings.length ) {
return null;
}
List<OrderSpecifier> result = new Vector<OrderS... | java |
public TableSchema getTableSchemaFromName(String tableName, DbUser user) throws Exception {
List<String> tableNames = new Vector<String>();
tableNames.add(tableName);
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,tableNames);
if( false == nameToTableMap.containsKey(tableName) ) ... | java |
public List<TableSchema> getAvailableTablesFromGroups(DbUser user) throws Exception {
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,null);
List<TableSchema> result = new Vector<TableSchema>();
result.addAll(nameToTableMap.values());
return result;
} | java |
static public List<String> breakUpCommand(String command) throws Exception{
try {
List<String> commandTokens = new Vector<String>();
StringBuilder currentToken = null;
boolean isTokenQuoted = false;
StringReader sr = new StringReader(command);
int b = sr.read();
while( b >= 0 ){
char c = (ch... | java |
private UserAndPassword executeStatementToUser(PreparedStatement preparedStmt) throws Exception {
if( preparedStmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = preparedStmt.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numColumns = rsmd.getColumnCount();
if( numColumn... | java |
private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
if( num.doubleValue() == Math.round(num.doubleValue()) ){
// Integer
if( null != numFormat ){
pw.print( numFormat.format(num.intValue()) );
} else {
pw.print( num.intValue() );
}
} else {
if( null != numFormat )... | java |
static public Date parseGpsTimestamp(String gpsTimestamp) throws Exception {
try {
Matcher matcherTime = patternTime.matcher(gpsTimestamp);
if( matcherTime.matches() ) {
int year = Integer.parseInt( matcherTime.group(1) );
int month = Integer.parseInt( matcherTime.group(2) );
int day = Integer.parse... | java |
static public String safeSqlQueryStringValue(String in) throws Exception {
if( null == in ) {
return "NULL";
}
if( in.indexOf('\0') >= 0 ) {
throw new Exception("Null character found in string value");
}
// All quotes should be escaped
in = in.replace("'", "''");
// Add quotes again
return "'" ... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.