code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public Where<T, ID> raw(String rawStatement, ArgumentHolder... args) {
for (ArgumentHolder arg : args) {
String columnName = arg.getColumnName();
if (columnName == null) {
if (arg.getSqlType() == null) {
throw new IllegalArgumentException("Either the column name or SqlType must be set on each argument"... | java |
public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException {
addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator));
return this;
} | java |
public Where<T, ID> reset() {
for (int i = 0; i < clauseStackLevel; i++) {
// help with gc
clauseStack[i] = null;
}
clauseStackLevel = 0;
return this;
} | java |
public String getStatement() throws SQLException {
StringBuilder sb = new StringBuilder();
appendSql(null, sb, new ArrayList<ArgumentHolder>());
return sb.toString();
} | java |
public int execute(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache)
throws SQLException {
try {
// the arguments are the new-id and old-id
Object[] args = new Object[] { convertIdToFieldObject(newId), extractIdToFieldObject(data) };
int rowC = databaseConnection.update(sta... | java |
public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException {
DatabaseFieldConfig config = new DatabaseFieldConfig();
boolean anything = false;
while (true) {
String line;
try {
line = reader.readLine();
} catch (IOException e) {
throw SqlExceptionUtil.create("Could no... | java |
public static void write(BufferedWriter writer, DatabaseFieldConfig config, String tableName) throws SQLException {
try {
writeConfig(writer, config, tableName);
} catch (IOException e) {
throw SqlExceptionUtil.create("Could not write config to writer", e);
}
} | java |
public UpdateBuilder<T, ID> updateColumnValue(String columnName, Object value) throws SQLException {
FieldType fieldType = verifyColumnName(columnName);
if (fieldType.isForeignCollection()) {
throw new SQLException("Can't update foreign colletion field: " + columnName);
}
addUpdateColumnToList(columnName, ne... | java |
public UpdateBuilder<T, ID> updateColumnExpression(String columnName, String expression) throws SQLException {
FieldType fieldType = verifyColumnName(columnName);
if (fieldType.isForeignCollection()) {
throw new SQLException("Can't update foreign colletion field: " + columnName);
}
addUpdateColumnToList(colu... | java |
public void initialize() {
if (dataClass == null) {
throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName());
}
if (tableName == null) {
tableName = extractTableName(databaseType, dataClass);
}
} | java |
public void extractFieldTypes(DatabaseType databaseType) throws SQLException {
if (fieldTypes == null) {
if (fieldConfigs == null) {
fieldTypes = extractFieldTypes(databaseType, dataClass, tableName);
} else {
fieldTypes = convertFieldConfigs(databaseType, tableName, fieldConfigs);
}
}
} | java |
public static <T> DatabaseTableConfig<T> fromClass(DatabaseType databaseType, Class<T> clazz) throws SQLException {
String tableName = extractTableName(databaseType, clazz);
if (databaseType.isEntityNamesMustBeUpCase()) {
tableName = databaseType.upCaseEntityName(tableName);
}
return new DatabaseTableConfig<... | java |
public static <T> String extractTableName(DatabaseType databaseType, Class<T> clazz) {
DatabaseTable databaseTable = clazz.getAnnotation(DatabaseTable.class);
String name = null;
if (databaseTable != null && databaseTable.tableName() != null && databaseTable.tableName().length() > 0) {
name = databaseTable.tab... | java |
public static void openLogFile(String logPath) {
if (logPath == null) {
printStream = System.out;
} else {
try {
printStream = new PrintStream(new File(logPath));
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Log file " + logPath + " was not found", e);
}
}
} | java |
public long queryForCountStar(DatabaseConnection databaseConnection) throws SQLException {
if (countStarQuery == null) {
StringBuilder sb = new StringBuilder(64);
sb.append("SELECT COUNT(*) FROM ");
databaseType.appendEscapedEntityName(sb, tableInfo.getTableName());
countStarQuery = sb.toString();
}
l... | java |
public long queryForLong(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt) throws SQLException {
CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT_LONG);
DatabaseResults results = null;
try {
results = compiledStatement.runQuery(null);
if ... | java |
public SelectIterator<T, ID> buildIterator(BaseDaoImpl<T, ID> classDao, ConnectionSource connectionSource,
int resultFlags, ObjectCache objectCache) throws SQLException {
prepareQueryForAll();
return buildIterator(classDao, connectionSource, preparedQueryForAll, objectCache, resultFlags);
} | java |
public int updateRaw(DatabaseConnection connection, String statement, String[] arguments) throws SQLException {
logger.debug("running raw update statement: {}", statement);
if (arguments.length > 0) {
// need to do the (Object) cast to force args to be a single object
logger.trace("update arguments: {}", (Obj... | java |
public int create(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
if (mappedInsert == null) {
mappedInsert = MappedCreate.build(dao, tableInfo);
}
int result = mappedInsert.insert(databaseType, databaseConnection, data, objectCache);
if (dao != null && !localIsIn... | java |
public int updateId(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache)
throws SQLException {
if (mappedUpdateId == null) {
mappedUpdateId = MappedUpdateId.build(dao, tableInfo);
}
int result = mappedUpdateId.execute(databaseConnection, data, newId, objectCache);
if (dao != n... | java |
public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException {
CompiledStatement compiledStatement = preparedUpdate.compile(databaseConnection, StatementType.UPDATE);
try {
int result = compiledStatement.runUpdate();
if (dao != null && !localIsInBatchMode.get(... | java |
public int refresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
if (mappedRefresh == null) {
mappedRefresh = MappedRefresh.build(dao, tableInfo);
}
return mappedRefresh.executeRefresh(databaseConnection, data, objectCache);
} | java |
public int delete(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
if (mappedDelete == null) {
mappedDelete = MappedDelete.build(dao, tableInfo);
}
int result = mappedDelete.delete(databaseConnection, data, objectCache);
if (dao != null && !localIsInBatchMode.get(... | java |
public int deleteById(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException {
if (mappedDelete == null) {
mappedDelete = MappedDelete.build(dao, tableInfo);
}
int result = mappedDelete.deleteById(databaseConnection, id, objectCache);
if (dao != null && !localIsInBatchMode... | java |
public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException {
CompiledStatement compiledStatement = preparedDelete.compile(databaseConnection, StatementType.DELETE);
try {
int result = compiledStatement.runUpdate();
if (dao != null && !localIsInBatchMode.get(... | java |
public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException {
if (connectionSource.isSingleConnection(tableInfo.getTableName())) {
synchronized (this) {
return doCallBatchTasks(connectionSource, callable);
}
} else {
return doCallBatchTasks(connectionSour... | java |
public static SQLException create(String message, Throwable cause) {
SQLException sqlException;
if (cause instanceof SQLException) {
// if the cause is another SQLException, pass alot of the SQL state
sqlException = new SQLException(message, ((SQLException) cause).getSQLState());
} else {
sqlException = ... | java |
public void initialize() throws SQLException {
if (initialized) {
// just skip it if already initialized
return;
}
if (connectionSource == null) {
throw new IllegalStateException("connectionSource was never set on " + getClass().getSimpleName());
}
databaseType = connectionSource.getDatabaseType();... | java |
static <T, ID> Dao<T, ID> createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException {
return new BaseDaoImpl<T, ID>(connectionSource, clazz) {
};
} | java |
private Constructor<T> findNoArgConstructor(Class<T> dataClass) {
Constructor<T>[] constructors;
try {
@SuppressWarnings("unchecked")
Constructor<T>[] consts = (Constructor<T>[]) dataClass.getDeclaredConstructors();
// i do this [grossness] to be able to move the Suppress inside the method
constructors ... | java |
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions)
throws IllegalArgumentException {
Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions,
methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false),
... | java |
public static Method findSetMethod(Field field, DatabaseType databaseType, boolean throwExceptions)
throws IllegalArgumentException {
Method fieldSetMethod = findMethodFromNames(field, false, throwExceptions,
methodFromField(field, "set", databaseType, true), methodFromField(field, "set", databaseType, false))... | java |
public void postProcess() {
if (foreignColumnName != null) {
foreignAutoRefresh = true;
}
if (foreignAutoRefresh && maxForeignAutoRefreshLevel == NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED) {
maxForeignAutoRefreshLevel = DatabaseField.DEFAULT_MAX_FOREIGN_AUTO_REFRESH_LEVEL;
}
} | java |
public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName) {
if (unknownEnumName == null || unknownEnumName.length() == 0) {
return null;
}
for (Enum<?> enumVal : (Enum<?>[]) field.getType().getEnumConstants()) {
if (enumVal.name().equals(unknownEnumName)) {
return enumVal;
}
}
... | java |
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)
throws SQLException {
@SuppressWarnings("unchecked")
ID id = (ID) idField.extractJavaFieldValue(data);
// we don't care about the cache here
T result = super.execute(databaseConnection, id, null);
if (result =... | java |
public QueryBuilder<T, ID> selectColumns(String... columns) {
for (String column : columns) {
addSelectColumnToList(column);
}
return this;
} | java |
public QueryBuilder<T, ID> groupBy(String columnName) {
FieldType fieldType = verifyColumnName(columnName);
if (fieldType.isForeignCollection()) {
throw new IllegalArgumentException("Can't groupBy foreign collection field: " + columnName);
}
addGroupBy(ColumnNameOrRawSql.withColumnName(columnName));
return... | java |
public QueryBuilder<T, ID> groupByRaw(String rawSql) {
addGroupBy(ColumnNameOrRawSql.withRawSql(rawSql));
return this;
} | java |
public QueryBuilder<T, ID> orderBy(String columnName, boolean ascending) {
FieldType fieldType = verifyColumnName(columnName);
if (fieldType.isForeignCollection()) {
throw new IllegalArgumentException("Can't orderBy foreign collection field: " + columnName);
}
addOrderBy(new OrderBy(columnName, ascending));
... | java |
public QueryBuilder<T, ID> orderByRaw(String rawSql) {
addOrderBy(new OrderBy(rawSql, (ArgumentHolder[]) null));
return this;
} | java |
public QueryBuilder<T, ID> join(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException {
addJoinInfo(JoinType.INNER, null, null, joinedQueryBuilder, JoinWhereOperation.AND);
return this;
} | java |
private void addJoinInfo(JoinType type, String localColumnName, String joinedColumnName,
QueryBuilder<?, ?> joinedQueryBuilder, JoinWhereOperation operation) throws SQLException {
JoinInfo joinInfo = new JoinInfo(type, joinedQueryBuilder, operation);
if (localColumnName == null) {
matchJoinedFields(joinInfo, ... | java |
public String objectToString(T object) {
StringBuilder sb = new StringBuilder(64);
sb.append(object.getClass().getSimpleName());
for (FieldType fieldType : fieldTypes) {
sb.append(' ').append(fieldType.getColumnName()).append('=');
try {
sb.append(fieldType.extractJavaFieldValue(object));
} catch (Ex... | java |
private static void logVersionWarnings(String label1, String version1, String label2, String version2) {
if (version1 == null) {
if (version2 != null) {
warning(null, "Unknown version", " for {}, version for {} is '{}'", new Object[] { label1, label2,
version2 });
}
} else {
if (version2 == null)... | java |
protected MappedPreparedStmt<T, ID> prepareStatement(Long limit, boolean cacheStore) throws SQLException {
List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>();
String statement = buildStatementString(argList);
ArgumentHolder[] selectArgs = argList.toArray(new ArgumentHolder[argList.size()]);
FieldTyp... | java |
public String prepareStatementString() throws SQLException {
List<ArgumentHolder> argList = new ArrayList<ArgumentHolder>();
return buildStatementString(argList);
} | java |
protected boolean appendWhereStatement(StringBuilder sb, List<ArgumentHolder> argList, WhereOperation operation)
throws SQLException {
if (where == null) {
return operation == WhereOperation.FIRST;
}
operation.appendBefore(sb);
where.appendSql((addTableName ? getTableName() : null), sb, argList);
operat... | java |
private static <T, ID> MappedDeleteCollection<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, int dataSize)
throws SQLException {
FieldType idField = tableInfo.getIdField();
if (idField == null) {
throw new SQLException(
"Cannot delete " + tableInfo.getDataClass() + " because it doesn't have an ... | java |
@Override
public T next() {
SQLException sqlException = null;
try {
T result = nextThrow();
if (result != null) {
return result;
}
} catch (SQLException e) {
sqlException = e;
}
// we have to throw if there is no next or on a SQLException
last = null;
closeQuietly();
throw new IllegalSt... | java |
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException {
Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass);
return doCreateTable(dao, false);
} | java |
public static <T> int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig)
throws SQLException {
Dao<T, ?> dao = DaoManager.createDao(connectionSource, tableConfig);
return doCreateTable(dao, false);
} | java |
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors)
throws SQLException {
Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass);
return dropTable(dao, ignoreErrors);
} | java |
public static <T, ID> int dropTable(Dao<T, ID> dao, boolean ignoreErrors) throws SQLException {
ConnectionSource connectionSource = dao.getConnectionSource();
Class<T> dataClass = dao.getDataClass();
DatabaseType databaseType = connectionSource.getDatabaseType();
if (dao instanceof BaseDaoImpl<?, ?>) {
retur... | java |
public static <T, ID> int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors) throws SQLException {
DatabaseType databaseType = connectionSource.getDatabaseType();
Dao<T, ID> dao = DaoManager.createDao(connectionSource, tableConfig);
if (dao instanceof BaseDao... | java |
private static <T, ID> void addDropTableStatements(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
List<String> statements, boolean logDetails) {
List<String> statementsBefore = new ArrayList<String>();
List<String> statementsAfter = new ArrayList<String>();
for (FieldType fieldType : tableInfo.getField... | java |
private static <T, ID> void addCreateTableStatements(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
List<String> statements, List<String> queriesAfter, boolean ifNotExists, boolean logDetails)
throws SQLException {
StringBuilder sb = new StringBuilder(256);
if (logDetails) {
logger.info("creating t... | java |
public void assignField(ConnectionSource connectionSource, Object data, Object val, boolean parentObject,
ObjectCache objectCache) throws SQLException {
if (logger.isLevelEnabled(Level.TRACE)) {
logger.trace("assiging from data {}, val {}: {}", (data == null ? "null" : data.getClass()),
(val == null ? "nu... | java |
public Object assignIdValue(ConnectionSource connectionSource, Object data, Number val, ObjectCache objectCache)
throws SQLException {
Object idVal = dataPersister.convertIdNumber(val);
if (idVal == null) {
throw new SQLException("Invalid class " + dataPersister + " for sequence-id " + this);
} else {
as... | java |
public <FV> FV extractRawJavaFieldValue(Object object) throws SQLException {
Object val;
if (fieldGetMethod == null) {
try {
// field object may not be a T yet
val = field.get(object);
} catch (Exception e) {
throw SqlExceptionUtil.create("Could not get field value for " + this, e);
}
} else ... | java |
public Object extractJavaFieldValue(Object object) throws SQLException {
Object val = extractRawJavaFieldValue(object);
// if this is a foreign object then we want its reference field
if (foreignRefField != null && val != null) {
val = foreignRefField.extractRawJavaFieldValue(val);
}
return val;
} | java |
public Object convertJavaFieldToSqlArgValue(Object fieldVal) throws SQLException {
/*
* Limitation here. Some people may want to override the null with their own value in the converter but we
* currently don't allow that. Specifying a default value I guess is a better mechanism.
*/
if (fieldVal == null) {
... | java |
public Object convertStringToJavaField(String value, int columnPos) throws SQLException {
if (value == null) {
return null;
} else {
return fieldConverter.resultStringToJava(this, value, columnPos);
}
} | java |
public Object moveToNextValue(Object val) throws SQLException {
if (dataPersister == null) {
return null;
} else {
return dataPersister.moveToNextValue(val);
}
} | java |
public <FT, FID> BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id) throws SQLException {
// this can happen if we have a foreign-auto-refresh scenario
if (foreignFieldType == null) {
return null;
}
@SuppressWarnings("unchecked")
Dao<FT, FID> castDao = (Dao<FT, FID>) foreignDao;
... | java |
public <FV> FV getFieldValueIfNotDefault(Object object) throws SQLException {
@SuppressWarnings("unchecked")
FV fieldValue = (FV) extractJavaFieldValue(object);
if (isFieldValueDefault(fieldValue)) {
return null;
} else {
return fieldValue;
}
} | java |
public boolean isObjectsFieldValueDefault(Object object) throws SQLException {
Object fieldValue = extractJavaFieldValue(object);
return isFieldValueDefault(fieldValue);
} | java |
public Object getJavaDefaultValueDefault() {
if (field.getType() == boolean.class) {
return DEFAULT_VALUE_BOOLEAN;
} else if (field.getType() == byte.class || field.getType() == Byte.class) {
return DEFAULT_VALUE_BYTE;
} else if (field.getType() == char.class || field.getType() == Character.class) {
retu... | java |
private <FT, FID> FT createForeignShell(ConnectionSource connectionSource, Object val, ObjectCache objectCache)
throws SQLException {
@SuppressWarnings("unchecked")
Dao<FT, FID> castDao = (Dao<FT, FID>) foreignDao;
FT foreignObject = castDao.createObjectInstance();
foreignIdField.assignField(connectionSource... | java |
private FieldType findForeignFieldType(Class<?> clazz, Class<?> foreignClass, Dao<?, ?> foreignDao)
throws SQLException {
String foreignColumnName = fieldConfig.getForeignCollectionForeignFieldName();
for (FieldType fieldType : foreignDao.getTableInfo().getFieldTypes()) {
if (fieldType.getType() == foreignCla... | java |
public T execute(DatabaseConnection databaseConnection, ID id, ObjectCache objectCache) throws SQLException {
if (objectCache != null) {
T result = objectCache.get(clazz, id);
if (result != null) {
return result;
}
}
Object[] args = new Object[] { convertIdToFieldObject(id) };
// @SuppressWarnings(... | java |
protected void appendStringType(StringBuilder sb, FieldType fieldType, int fieldWidth) {
if (isVarcharFieldWidthSupported()) {
sb.append("VARCHAR(").append(fieldWidth).append(')');
} else {
sb.append("VARCHAR");
}
} | java |
private void appendDefaultValue(StringBuilder sb, FieldType fieldType, Object defaultValue) {
if (fieldType.isEscapedDefaultValue()) {
appendEscapedWord(sb, defaultValue.toString());
} else {
sb.append(defaultValue);
}
} | java |
private void addSingleUnique(StringBuilder sb, FieldType fieldType, List<String> additionalArgs,
List<String> statementsAfter) {
StringBuilder alterSb = new StringBuilder();
alterSb.append(" UNIQUE (");
appendEscapedEntityName(alterSb, fieldType.getColumnName());
alterSb.append(')');
additionalArgs.add(alt... | java |
public static void registerDataPersisters(DataPersister... dataPersisters) {
// we build the map and replace it to lower the chance of concurrency issues
List<DataPersister> newList = new ArrayList<DataPersister>();
if (registeredPersisters != null) {
newList.addAll(registeredPersisters);
}
for (DataPersis... | java |
public static DataPersister lookupForField(Field field) {
// see if the any of the registered persisters are valid first
if (registeredPersisters != null) {
for (DataPersister persister : registeredPersisters) {
if (persister.isValidForField(field)) {
return persister;
}
// check the classes in... | java |
public int update(DatabaseConnection databaseConnection, T data, ObjectCache objectCache) throws SQLException {
try {
// there is always and id field as an argument so just return 0 lines updated
if (argFieldTypes.length <= 1) {
return 0;
}
Object[] args = getFieldObjects(data);
Object newVersion =... | java |
protected Object[] getFieldObjects(Object data) throws SQLException {
Object[] objects = new Object[argFieldTypes.length];
for (int i = 0; i < argFieldTypes.length; i++) {
FieldType fieldType = argFieldTypes[i];
if (fieldType.isAllowGeneratedIdInsert()) {
objects[i] = fieldType.getFieldValueIfNotDefault(d... | java |
private CompiledStatement assignStatementArguments(CompiledStatement stmt) throws SQLException {
boolean ok = false;
try {
if (limit != null) {
// we use this if SQL statement LIMITs are not supported by this database type
stmt.setMaxRows(limit.intValue());
}
// set any arguments if we are logging ... | java |
protected DatabaseConnection getSavedConnection() {
NestedConnection nested = specialConnection.get();
if (nested == null) {
return null;
} else {
return nested.connection;
}
} | java |
protected boolean isSavedConnection(DatabaseConnection connection) {
NestedConnection currentSaved = specialConnection.get();
if (currentSaved == null) {
return false;
} else if (currentSaved.connection == connection) {
// ignore the release when we have a saved connection
return true;
} else {
retu... | java |
protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {
NestedConnection currentSaved = specialConnection.get();
boolean cleared = false;
if (connection == null) {
// ignored
} else if (currentSaved == null) {
logger.error("no connection has been saved when clear() called");
} els... | java |
protected boolean isSingleConnection(DatabaseConnection conn1, DatabaseConnection conn2) throws SQLException {
// initialize the connections auto-commit flags
conn1.setAutoCommit(true);
conn2.setAutoCommit(true);
try {
// change conn1's auto-commit to be false
conn1.setAutoCommit(false);
if (conn2.isAu... | java |
public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException {
List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>();
while (true) {
DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader);
if (config == null) {
... | java |
public static <T> DatabaseTableConfig<T> fromReader(BufferedReader reader) throws SQLException {
DatabaseTableConfig<T> config = new DatabaseTableConfig<T>();
boolean anything = false;
while (true) {
String line;
try {
line = reader.readLine();
} catch (IOException e) {
throw SqlExceptionUtil.cre... | java |
public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException {
try {
writeConfig(writer, config);
} catch (IOException e) {
throw SqlExceptionUtil.create("Could not write config to writer", e);
}
} | java |
private static <T> void writeConfig(BufferedWriter writer, DatabaseTableConfig<T> config) throws IOException,
SQLException {
writer.append(CONFIG_FILE_START_MARKER);
writer.newLine();
if (config.getDataClass() != null) {
writer.append(FIELD_NAME_DATA_CLASS).append('=').append(config.getDataClass().getName()... | java |
private static <T> void readTableField(DatabaseTableConfig<T> config, String field, String value) {
if (field.equals(FIELD_NAME_DATA_CLASS)) {
try {
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) Class.forName(value);
config.setDataClass(clazz);
} catch (ClassNotFoundException e) {
t... | java |
private static <T> void readFields(BufferedReader reader, DatabaseTableConfig<T> config) throws SQLException {
List<DatabaseFieldConfig> fields = new ArrayList<DatabaseFieldConfig>();
while (true) {
String line;
try {
line = reader.readLine();
} catch (IOException e) {
throw SqlExceptionUtil.create... | java |
private Object readKey(
FieldDescriptor field,
JsonParser parser,
DeserializationContext context
) throws IOException {
if (parser.getCurrentToken() != JsonToken.FIELD_NAME) {
throw reportWrongToken(JsonToken.FIELD_NAME, context, "Expected FIELD_NAME token");
}
String ... | java |
public static void populateSubject(final LinkedHashMap<String, CommonProfile> profiles) {
if (profiles != null && profiles.size() > 0) {
final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles);
try {
if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAu... | java |
@Override
public String getName() {
CommonProfile profile = this.getProfile();
if(null == principalNameAttribute) {
return profile.getId();
}
Object attrValue = profile.getAttribute(principalNameAttribute);
return (null == attrValue) ? null : String.valueOf(attrVa... | java |
public static void showBooks(final ListOfBooks booksList){
if(booksList != null && booksList.getBook() != null && !booksList.getBook().isEmpty()){
List<BookType> books = booksList.getBook();
System.out.println("\nNumber of books: " + books.size());
int cnt = 0;
for (BookType book : boo... | java |
public void contextInitialized(ServletContextEvent event) {
this.context = event.getServletContext();
// Output a simple message to the server's console
System.out.println("The Simple Web App. Is Ready");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
... | java |
private void serializeEPR(EndpointReferenceType wsAddr, Node parent) throws ServiceLocatorException {
try {
JAXBElement<EndpointReferenceType> ep =
WSA_OBJECT_FACTORY.createEndpointReference(wsAddr);
createMarshaller().marshal(ep, parent);
} catch (JAXBException e... | java |
private static EndpointReferenceType createEPR(String address, SLProperties props) {
EndpointReferenceType epr = WSAEndpointReferenceUtils.getEndpointReference(address);
if (props != null) {
addProperties(epr, props);
}
return epr;
} | java |
private static EndpointReferenceType createEPR(Server server, String address, SLProperties props) {
EndpointReferenceType sourceEPR = server.getEndpoint().getEndpointInfo().getTarget();
EndpointReferenceType targetEPR = WSAEndpointReferenceUtils.duplicate(sourceEPR);
WSAEndpointReferenceUtils.se... | java |
private static void addProperties(EndpointReferenceType epr, SLProperties props) {
MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr);
ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props);
JAXBElement<ServiceLocatorPropertiesTyp... | java |
private static QName getServiceName(Server server) {
QName serviceName;
String bindingId = getBindingId(server);
EndpointInfo eInfo = server.getEndpoint().getEndpointInfo();
if (JAXRS_BINDING_ID.equals(bindingId)) {
serviceName = eInfo.getName();
} else {
... | java |
private static String getBindingId(Server server) {
Endpoint ep = server.getEndpoint();
BindingInfo bi = ep.getBinding().getBindingInfo();
return bi.getBindingId();
} | java |
private static BindingType map2BindingType(String bindingId) {
BindingType type;
if (SOAP11_BINDING_ID.equals(bindingId)) {
type = BindingType.SOAP11;
} else if (SOAP12_BINDING_ID.equals(bindingId)) {
type = BindingType.SOAP12;
} else if (JAXRS_BINDING_ID.equals(b... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.