本文整理汇总了Java中com.avaje.ebean.SqlUpdate类的典型用法代码示例。如果您正苦于以下问题:Java SqlUpdate类的具体用法?Java SqlUpdate怎么用?Java SqlUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlUpdate类属于com.avaje.ebean包,在下文中一共展示了SqlUpdate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: saveAccess
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
public Result saveAccess() {
Map<String, String[]> form_data = request().body().asFormUrlEncoded();
Organization org = OrgConfig.get().org;
if (form_data.containsKey("allowed_ip")) {
String sql = "DELETE from allowed_ips where organization_id=:org_id";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("org_id", org.id);
update.execute();
sql = "INSERT into allowed_ips (ip, organization_id) VALUES(:ip, :org_id)";
update = Ebean.createSqlUpdate(sql);
update.setParameter("org_id", org.id);
update.setParameter("ip", form_data.get("allowed_ip")[0]);
update.execute();
}
return redirect(routes.Settings.viewAccess());
}
开发者ID:schmave,项目名称:demschooltools,代码行数:20,代码来源:Settings.java
示例2: savePluginLog
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Creates a plugin log on a specific event associated with the plugin
*
* @param transactionId
* the unique Id for the transaction
* @param pluginConfigurationId
* the unique identifier for the plugin configuration
* @param isError
* true if the log is an error
* @param event
* the type of event
* @param logMessage
* the error message
* @param dataType
* an internal BizDock data type
* @param internalId
* the Id of internal BizDock object to which the transaction is
* associated
* @param externalId
* the Id of the external (third party system) plugin to which
* the transaction is associated
*/
private static void savePluginLog(String transactionId, Long pluginConfigurationId, boolean isError, String event, String logMessage, DataType dataType,
Long internalId, String externalId) {
try {
String sql = "insert into plugin_log (transaction_id, plugin_configuration_id, "
+ "event, is_error, log_message, last_update, data_type, internal_id, external_id)"
+ " values(:transaction_id,:pluginConfigurationId,:event,:is_error,"
+ ":log_message, :last_update, :data_type, :internal_id, :external_id)";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("transaction_id", transactionId);
update.setParameter("pluginConfigurationId", pluginConfigurationId);
update.setParameter("event", event);
update.setParameter("is_error", isError);
update.setParameter("log_message", logMessage != null ? logMessage.replace("\n", "<br/>") : null);
update.setParameter("last_update", new Date());
update.setParameter("data_type", dataType != null ? dataType.getDataTypeClassName() : null);
update.setParameter("internal_id", internalId);
update.setParameter("external_id", externalId);
update.execute();
} catch (Exception e) {
log.warn("Unexpected exception", e);
}
}
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:45,代码来源:PluginLog.java
示例3: delete
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Override
public void delete(String key, String languageCode) {
if (!isLanguageValid(languageCode)) {
throw new IllegalArgumentException("Invalid language code " + languageCode);
}
try {
SqlUpdate updateKeyQuery = Ebean.createSqlUpdate("DELETE FROM `i18n_messages` WHERE `key`=:key and`language`=:language");
updateKeyQuery.setParameter("key", key);
updateKeyQuery.setParameter("language", languageCode);
updateKeyQuery.execute();
synchronized (i18nMessagesStore) {
Hashtable<Object, Object> i18Messages = getI18nMessagesStore().get(languageCode);
if (i18Messages == null) {
i18Messages = new Hashtable<Object, Object>();
}
i18Messages.remove(key);
i18nMessagesStore.put(languageCode, i18Messages);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error while deleting the i18n key : " + key, e);
}
}
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:27,代码来源:I18nMessagesPluginImpl.java
示例4: deleteOldExpiredTokens
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
public static void deleteOldExpiredTokens() {
String sql = "DELETE " +
" FROM pos_token WHERE " +
"accessExpires < :date";
SqlUpdate batchDelete = Ebean.createSqlUpdate(sql);
Date date = new DateTime().minusMonths(1).toDate();
batchDelete.setParameter("date", date);
int rows = batchDelete.execute();
if (rows > 0) {
LOGGER.info("deleted '{}' rows in pos_token", rows);
}
}
开发者ID:metno,项目名称:poseidon-rest,代码行数:17,代码来源:Token.java
示例5: run
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Override
public void run() {
SqlUpdate deletePoints = Ebean.createSqlUpdate(
"DELETE FROM point " +
"WHERE series_id IN (" +
"SELECT id " +
"FROM series " +
"WHERE indicator_id = :indicator_id " +
")");
deletePoints.setParameter("indicator_id", indicator.getId());
deletePoints.execute();
SqlUpdate deleteSeries = Ebean.createSqlUpdate(
"DELETE FROM series " +
"WHERE indicator_id = :indicator_id");
deleteSeries.setParameter("indicator_id", indicator.getId());
deleteSeries.execute();
}
开发者ID:snogaraleal,项目名称:wbi,代码行数:19,代码来源:IndicatorUnloadTask.java
示例6: changeStatusOfIgnoredDocuments
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
private static void changeStatusOfIgnoredDocuments() {
SqlUpdate su = Ebean.createSqlUpdate("update document" +
" set status=" + Document.Status.DELETED.ordinal() +
" where status=" + Document.Status.IGNORED.ordinal() +
" and age(current_status_set) >= interval '1 month'");
Ebean.execute(su);
Promise.promise(new Function0<Boolean>() {
@Override
public Boolean apply() {
List<Document> documents = Document.find.where().eq("status", Document.Status.DELETED.ordinal()).findList();
for (Document document : documents)
deleteHtmlFile(document.htmlFilename());
return true;
}
});
}
开发者ID:ukwa,项目名称:w3act,代码行数:18,代码来源:Documents.java
示例7: processFiles
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
public static Boolean processFiles(String uniq) {
String sql = getUpdateSqlByDbType();
SqlUpdate updateProcess = Ebean.createSqlUpdate(sql);
updateProcess.setParameter("uniq", uniq);
updateProcess.setParameter("status", UploadStatus.UPLOADED.getType());
updateProcess.setParameter("qty", GlobalParams.LIMIT_PROCCESS_FILES);
return Ebean.execute(updateProcess) == 1;
}
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:10,代码来源:S3File.java
示例8: createStatusSQL
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
private static Boolean createStatusSQL(String sql, String id, int status, String jobId, String response) {
SqlUpdate updateStatus = Ebean.createSqlUpdate(sql);
updateStatus.setParameter("id", id);
updateStatus.setParameter("status", status);
if(!jobId.isEmpty()) {
updateStatus.setParameter("job", jobId);
}
if(!response.isEmpty()) {
updateStatus.setParameter("response", response);
}
return Ebean.execute(updateStatus) == 1;
}
开发者ID:webinerds,项目名称:s3-proxy-chunk-upload,代码行数:15,代码来源:S3File.java
示例9: removePersonAtMeeting
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Secured.Auth(UserRole.ROLE_EDIT_7_DAY_JC)
public Result removePersonAtMeeting(Integer meeting_id, Integer person_id,
Integer role) {
SqlUpdate update = Ebean.createSqlUpdate(
"DELETE from person_at_meeting where meeting_id = :meeting_id"+
" and person_id = :person_id and role = :role");
update.setParameter("meeting_id", meeting_id);
update.setParameter("person_id", person_id);
update.setParameter("role", role);
Ebean.execute(update);
return ok();
}
开发者ID:schmave,项目名称:demschooltools,代码行数:15,代码来源:ApplicationEditing.java
示例10: removePersonAtCase
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Secured.Auth(UserRole.ROLE_EDIT_7_DAY_JC)
public Result removePersonAtCase(Integer case_id, Integer person_id, Integer role)
{
SqlUpdate update = Ebean.createSqlUpdate(
"DELETE from person_at_case where case_id = :case_id "+
"and person_id = :person_id "+
"and role = :role");
update.setParameter("case_id", case_id);
update.setParameter("person_id", person_id);
update.setParameter("role", role);
Ebean.execute(update);
return ok();
}
开发者ID:schmave,项目名称:demschooltools,代码行数:15,代码来源:ApplicationEditing.java
示例11: storeAccountChest
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Override
public boolean storeAccountChest(AccountChest chest) {
SqlUpdate storeChest = db.createSqlUpdate(
"insert into gringotts_accountchest (world,x,y,z,account) values (:world, :x, :y, :z, (select id from gringotts_account where owner=:owner and type=:type))");
Sign mark = chest.sign;
storeChest.setParameter("world", mark.getWorld().getName());
storeChest.setParameter("x", mark.getX());
storeChest.setParameter("y", mark.getY());
storeChest.setParameter("z", mark.getZ());
storeChest.setParameter("owner", chest.account.owner.getId());
storeChest.setParameter("type", chest.account.owner.getType());
return storeChest.execute() > 0;
}
开发者ID:sakunc,项目名称:Gringotts-,代码行数:15,代码来源:EBeanDAO.java
示例12: deleteAccountChest
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
private boolean deleteAccountChest(String world, int x, int y, int z) {
SqlUpdate deleteChest = db.createSqlUpdate(
"delete from gringotts_accountchest where world = :world and x = :x and y = :y and z = :z");
deleteChest.setParameter("world", world);
deleteChest.setParameter("x", x);
deleteChest.setParameter("y", y);
deleteChest.setParameter("z", z);
return deleteChest.execute() > 0;
}
开发者ID:sakunc,项目名称:Gringotts-,代码行数:11,代码来源:EBeanDAO.java
示例13: storeCents
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
@Override
public boolean storeCents(GringottsAccount account, long amount) {
SqlUpdate up = db.createSqlUpdate("UPDATE gringotts_account SET cents = :cents WHERE owner = :owner and type = :type");
up.setParameter("cents", amount);
up.setParameter("owner", account.owner.getId());
up.setParameter("type", account.owner.getType());
return up.execute() == 1;
}
开发者ID:sakunc,项目名称:Gringotts-,代码行数:10,代码来源:EBeanDAO.java
示例14: flushPluginLog
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Flush all log messages for the specified pluginConfiguration
*
* @return the number of logs deleted
*/
public static int flushPluginLog(Long pluginConfigurationId) {
String sql = "delete from plugin_log where plugin_configuration_id=:plugin_configuration_id";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("plugin_configuration_id", pluginConfigurationId);
return Ebean.execute(update);
}
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:12,代码来源:PluginLog.java
示例15: flushLinksForPlugin
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Flush all associations for the specified pluginConfiguration
*
* @return the number of links deleted
*/
public static int flushLinksForPlugin(Long pluginConfigurationId) {
String sql = "delete plugin_identification_link where plugin_configuration_id=:plugin_configuration_id";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("plugin_configuration_id", pluginConfigurationId);
return Ebean.execute(update);
}
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:12,代码来源:PluginIdentificationLink.java
示例16: updateIndicatorStatus
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Update the {@link Indicator.Status} of the specified {@link Indicator}.
*
* @param indicator Indicator to update.
* @param status New indicator status.
*/
private static void updateIndicatorStatus(
Indicator indicator, Indicator.Status status) {
SqlUpdate updateIndicator = Ebean.createSqlUpdate(
"UPDATE indicator " +
"SET status = :status " +
"WHERE id = :id");
updateIndicator.setParameter("status", status);
updateIndicator.setParameter("id", indicator.getId());
updateIndicator.execute();
indicator.setStatus(status);
}
开发者ID:snogaraleal,项目名称:wbi,代码行数:21,代码来源:WBIManagementService.java
示例17: addI18nKey
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Add a i18k key.
*
* @param key
* the key
* @param value
* the value
* @param languageCode
* the language
*/
private void addI18nKey(String key, String value, String languageCode) {
SqlUpdate insertKeyQuery = Ebean.createSqlUpdate("insert into i18n_messages (`key`, language, value) values (:key, :language, :value)");
insertKeyQuery.setParameter("value", value);
insertKeyQuery.setParameter("key", key);
insertKeyQuery.setParameter("language", languageCode);
insertKeyQuery.execute();
}
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:18,代码来源:DatabaseDependencyServiceImpl.java
示例18: createLink
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* Create a new identification link
*
* @param pluginConfigurationId
* a plugin configuration id
* @param internalId
* the id of the internal BizDock object
* @param externalId
* the id of the external object to which the BizDock object is
* linked
* @param linkType
* a type of link
* @return 1 of the creation was successfull
*/
public static int createLink(Long pluginConfigurationId, Long internalId, String externalId, String linkType) {
String sql = "insert into plugin_identification_link (plugin_configuration_id, internal_id, external_id, link_type, last_update)"
+ " values (:pluginConfigurationId,:internalId,:externalId,:linkType, NOW())";
SqlUpdate update = Ebean.createSqlUpdate(sql);
update.setParameter("pluginConfigurationId", pluginConfigurationId);
update.setParameter("internalId", internalId);
update.setParameter("externalId", externalId);
update.setParameter("linkType", linkType);
return update.execute();
}
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:25,代码来源:PluginIdentificationLink.java
示例19: unactivateOrgUnits
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* WARNING: use carefully this method since it unactivate ALL THE ORG UNITS
* in the database.
*
* @param whereClause
* a where clause (without the where statement)
*/
public static int unactivateOrgUnits(String whereClause) {
String sql = "update org_unit set is_active=0 " + (StringUtils.isBlank(whereClause) ? "" : "where " + whereClause);
SqlUpdate update = Ebean.createSqlUpdate(sql);
return Ebean.execute(update);
}
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:13,代码来源:OrgUnitDao.java
示例20: unactivateActors
import com.avaje.ebean.SqlUpdate; //导入依赖的package包/类
/**
* WARNING: user carefully this method since it unactivate ALL THE ACTORS in
* the database.
*
* @param whereClause
* a where clause (without the where statement)
*/
public static int unactivateActors(String whereClause) {
String sql = "update actor set is_active=0 " + (StringUtils.isBlank(whereClause) ? "" : "where " + whereClause);
SqlUpdate update = Ebean.createSqlUpdate(sql);
return Ebean.execute(update);
}
开发者ID:theAgileFactory,项目名称:maf-desktop-app,代码行数:13,代码来源:ActorDao.java
注:本文中的com.avaje.ebean.SqlUpdate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论