本文整理汇总了Java中net.java.ao.DBParam类的典型用法代码示例。如果您正苦于以下问题:Java DBParam类的具体用法?Java DBParam怎么用?Java DBParam使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DBParam类属于net.java.ao包,在下文中一共展示了DBParam类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import net.java.ao.DBParam; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public MessageMapping create(final Map<String, Object> message, final String[] tags)
{
return activeObjects.executeInTransaction(new TransactionCallback<MessageMapping>()
{
@Override
public MessageMapping doInTransaction()
{
MessageMapping result = activeObjects.create(MessageMapping.class, message);
for (String tag : tags)
{
activeObjects.create(MessageTagMapping.class, //
new DBParam(MessageTagMapping.MESSAGE, result.getID()), //
new DBParam(MessageTagMapping.TAG, tag) //
);
}
return result;
}
});
}
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:26,代码来源:MessageDaoImpl.java
示例2: getProjectJamTimestamp
import net.java.ao.DBParam; //导入依赖的package包/类
public static Long getProjectJamTimestamp(Project project) {
AOWrapper aoWrapper = ComponentAccessor.getOSGiComponentInstanceOfType(AOWrapper.class);
ActiveObjects activeObjects = aoWrapper.getActiveObjects();
JamPluginTimestamp[] mappings = activeObjects.find(JamPluginTimestamp.class, "PROJECT_ID = ?", project.getId());
if ( mappings.length > 0) {
return mappings[0].getJamTimestamp();
}
Long now = System.currentTimeMillis();
activeObjects.create(
JamPluginTimestamp.class,
new DBParam("JAM_TIMESTAMP", now),
new DBParam("PROJECT_ID", project.getId())
);
return now;
}
开发者ID:SAP,项目名称:SAPJamWorkPatternJIRAIntegration,代码行数:19,代码来源:JamClient.java
示例3: createOrUpdateUserKey
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public SshKeyEntity createOrUpdateUserKey(ApplicationUser user, String text, String label) {
return ao.executeInTransaction(new TransactionCallback<SshKeyEntity>() {
@Override
public SshKeyEntity doInTransaction() {
SshKeyEntity key = findSingleUserKey(user);
if (null != key) {
key.setText(text);
key.setLabel(label);
key.setCreatedDate(new Date());
key.save();
log.debug("Updated existing key for user");
} else {
key = ao.create(SshKeyEntity.class, new DBParam("TYPE", SshKeyEntity.KeyType.USER), new DBParam("USERID", user.getId()), new DBParam("TEXT", text), new DBParam("LABEL", label), new DBParam("CREATED", new Date()));
log.debug("created new key for user");
}
return key;
}
});
}
开发者ID:libertymutual,项目名称:ssh-key-enforcer-stash,代码行数:23,代码来源:EnterpriseKeyRepositoryImpl.java
示例4: update
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public void update(EntityManager em) throws Exception {
em.migrate(SshKeyEntity.class);
// create an expired and non-expired ID.
// Also create a BYPASS ID so that all types are present
// IMPORTANT - only use APPROVED_PUBLIC_KEY to make sure validation rules dont allow UNAPPROVED key in test sabove
DateTime now = new DateTime();
expiredKey = em.create(SshKeyEntity.class, new DBParam("USERID", EXPIRED_USER_ID), new DBParam("KEYID",
EXPIRED_STASH_KEY_ID), new DBParam("TEXT", APPROVED_PUBLIC_KEY_ONE), new DBParam("LABEL", "COMPROMISED"), new DBParam("TYPE", KeyType.USER),
new DBParam("CREATED", now.minusDays(DAYS_ALLOWED+1).toDate()));
validKey = em.create(SshKeyEntity.class, new DBParam("USERID", VALID_USER_ID), new DBParam("KEYID",
VALID_STASH_KEY_ID), new DBParam("TEXT", APPROVED_PUBLIC_KEY_ONE), new DBParam("LABEL", "VALID"), new DBParam("TYPE", KeyType.USER),
new DBParam("CREATED", now.minusDays(DAYS_ALLOWED-1).toDate()));
SshKeyEntity bypassKey = em.create(SshKeyEntity.class, new DBParam("USERID", VALID_USER_ID), new DBParam("KEYID",
VALID_BYPASS_KEY_ID), new DBParam("TEXT", APPROVED_PUBLIC_KEY_ONE), new DBParam("LABEL", "BYPASS"), new DBParam("TYPE", KeyType.BYPASS),
new DBParam("CREATED", now.minusDays(DAYS_ALLOWED-1).toDate()));
}
开发者ID:libertymutual,项目名称:ssh-key-enforcer-stash,代码行数:23,代码来源:EnterpriseSshKeyManagerImplTest.java
示例5: add
import net.java.ao.DBParam; //导入依赖的package包/类
/**
* Adds a thread
*
* @param title
* @param description
* @param sticky
* @param date
*/
@Override
public ThreadAO add(String title, String description, boolean sticky,
Date date, int forumID, String userKey) {
rightsManagement.isAuthorized(userKey,
PermissionConfig.PERMISSIONS.get("createThread"), forumID);
final ThreadAO thread = ao.create(ThreadAO.class, new DBParam("TITLE",
title), new DBParam("DESCRIPTION", description), new DBParam(
"STICKY", sticky), new DBParam("CREATION_DATE", date),
new DBParam("USER_KEY", userKey), new DBParam("LAST_CHANGED_DATE", date));
ForumAO[] forums = ao.find(ForumAO.class, "ID = ?", forumID);
ForumAO forum = null;
for (ForumAO forumAO : forums) {
forum = forumAO;
}
thread.setForum(forum);
thread.save();
StateAO state = ao.create(StateAO.class, new DBParam("CLOSED", false), new DBParam("THREAD_ID", thread.getID()));
state.save();
return thread;
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:29,代码来源:ThreadRepositoryImplement.java
示例6: add
import net.java.ao.DBParam; //导入依赖的package包/类
/**
* Adds a item
*
* @param message
* @param date
* @param threadID
* @param threadID
*/
@Override
public PostAO add(String message, Date date, int threadID, String userKey) {
ThreadAO threadAO = ao.get(ThreadAO.class, threadID);
if (!threadAO.getState().getClosed()){
int forumID = ao.get(ThreadAO.class, threadID).getForum().getID();
rightsManagement.isAuthorized(userKey, PermissionConfig.PERMISSIONS.get("createItem"), forumID);
final PostAO item = ao.create(PostAO.class, new DBParam("MESSAGE",
message), new DBParam("CREATION_DATE", date), new DBParam("LAST_EDITED_DATE", date),
new DBParam("USER_KEY", userKey));
ThreadAO thread = ao.get(ThreadAO.class, threadID);
setLastChangedDate(date, thread);
item.setThread(thread);
item.save();
return item;
}
else
{
throw new ThreadIsClosedException();
}
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:29,代码来源:ItemRepositoryImplement.java
示例7: createQuote
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public PostAO createQuote(String userKey, int itemID, Date date, int quotedItemId) {
PostAO editedItem = getItem(itemID);
checkAnyOwnRights(editedItem, userKey, PermissionConfig.get("addAnyQuote"), PermissionConfig.get("addOwnQuote"));
PostAO quotedItem = getItem(quotedItemId);
String quotedItemMessage = quotedItem.getMessage();
int quotedItemUserId = rightsManagement.getUser(quotedItem.getUserKey(), quotedItem.getThread().getForum().getID()).getID();
QuoteAO quoteAO = ao.create(QuoteAO.class, new DBParam("MESSAGE", quotedItemMessage),
new DBParam("QUOTE_DATE", date),
new DBParam("USER_ID", quotedItemUserId));
quoteAO.save();
editedItem.setQuote(quoteAO);
editedItem.setLastEditedDate(date);
editedItem.save();
return editedItem;
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:17,代码来源:ItemRepositoryImplement.java
示例8: setUp
import net.java.ao.DBParam; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
assertNotNull(entityManager);
ao = new TestActiveObjects(entityManager);
forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
forumAO.setDescription("ForumDescription");
forumAO.save();
forumID = forumAO.getID();
userManagementRepository = new UserManagementRepositoryImplement(ao);
roleManagementRepository = new RoleManagementRepositoryImplement(ao);
permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
forumRepository = new ForumRepositoryImplement(ao);
rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
itemRepository = new ItemRepositoryImplement(ao, rightsManagement);
mockAdminUser = MockConfluenceUserFactory.mockUser();
mockParticipantUser = MockConfluenceUserFactory.mockUser();
userKeyAdmin = mockAdminUser.getKey().getStringValue();
userKeyParticipant = mockParticipantUser.getKey().getStringValue();
rightsManagement.initPermissions();
rightsManagement.initAdmin(userKeyAdmin, forumID);
rightsManagement.addUser(userKeyAdmin, userKeyParticipant, "Admin",
forumID);
AuthenticatedUserThreadLocal.set(mockAdminUser);
AuthenticatedUserThreadLocal.set(mockParticipantUser);
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:27,代码来源:ThreadRepositoryTest.java
示例9: setUp
import net.java.ao.DBParam; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
assertNotNull(entityManager);
ao = new TestActiveObjects(entityManager);
forum = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
forum.setDescription(FORUMDESCRIPTION);
forum.save();
forum2 = ao.create(ForumAO.class, new DBParam("TITLE", FORUMTITLE));
forum2.setDescription(FORUMDESCRIPTION);
forum2.save();
FORUMID = forum.getID();
FORUMID2 = forum2.getID();
userManagementRepository = new UserManagementRepositoryImplement(ao);
roleManagementRepository = new RoleManagementRepositoryImplement(ao);
permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
forumRepository = new ForumRepositoryImplement(ao);
rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
rightsManagement.initPermissions();
rightsManagement.initAdmin(ADMINUSERKEY, FORUMID);
rightsManagement.initAdmin(ADMINUSERKEY, FORUMID2);
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:24,代码来源:RightsManagementTest.java
示例10: setUp
import net.java.ao.DBParam; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
assertNotNull(entityManager);
ao = new TestActiveObjects(entityManager);
forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
forumAO.setDescription("ForumDescription");
forumAO.save();
forumID = forumAO.getID();
userManagementRepository = new UserManagementRepositoryImplement(ao);
roleManagementRepository = new RoleManagementRepositoryImplement(ao);
permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
forumRepository = new ForumRepositoryImplement(ao);
rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
itemRepository = new ItemRepositoryImplement(ao, rightsManagement);
itemRestService = new ItemRestService(itemRepository, sanitizer);
mockAdminUser = MockConfluenceUserFactory.mockUser();
userKeyAdmin = mockAdminUser.getKey().getStringValue();
rightsManagement.initPermissions();
rightsManagement.initAdmin(userKeyAdmin, forumID);
AuthenticatedUserThreadLocal.set(mockAdminUser);
thread = threadRepository.add(threadTitle, threadDescription,
threadSticky, date, forumID, userKeyAdmin);
item = itemRepository.add(itemMessage, date, thread.getID(),
userKeyAdmin);
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:27,代码来源:ItemRestServiceTest.java
示例11: setUp
import net.java.ao.DBParam; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
assertNotNull(entityManager);
ao = new TestActiveObjects(entityManager);
forumAO = ao.create(ForumAO.class, new DBParam("TITLE", "ForumTitle"));
forumAO.setDescription("ForumDescription");
forumAO.save();
forumID = forumAO.getID();
userManagementRepository = new UserManagementRepositoryImplement(ao);
roleManagementRepository = new RoleManagementRepositoryImplement(ao);
permissionManagementRepository = new PermissionManagementRepositoryImplement(ao);
forumRepository = new ForumRepositoryImplement(ao);
rightsManagement = new RightsManagementImplement(userManagementRepository, roleManagementRepository, permissionManagementRepository, forumRepository);
threadRepository = new ThreadRepositoryImplement(ao, rightsManagement);
threadRestService = new ThreadRestService(threadRepository, sanitizer);
mockAdminUser = MockConfluenceUserFactory.mockUser();
userKeyAdmin = mockAdminUser.getKey().getStringValue();
rightsManagement.initPermissions();
rightsManagement.initAdmin(userKeyAdmin, forumID);
AuthenticatedUserThreadLocal.set(mockAdminUser);
thread = threadRepository.add(threadTitle, threadDescription,
threadSticky, threadDate, forumID, userKeyAdmin);
}
开发者ID:confluence-fourum,项目名称:Fourum-Plugin,代码行数:24,代码来源:ThreadRestServiceTest.java
示例12: add
import net.java.ao.DBParam; //导入依赖的package包/类
public Verifications add(int hazardID, String description, VerificationStatus status, VerificationType type,
String responsibleParty, Date estimatedCompletionDate, Hazard_Controls associatedControl) {
Verifications verification = ao.create(Verifications.class, new DBParam("VERIFICATION_DESC", description));
Hazards hazard = hazardService.getHazardById(hazardID);
verification.setVerificationStatus(status);
verification.setVerificationType(type);
verification.setResponsibleParty(responsibleParty);
verification.setEstCompletionDate(estimatedCompletionDate);
verification.setVerificationNumber(updateAssociation(hazard, associatedControl, verification));
verification.setLastUpdated(new Date());
verification.save();
final VerifcToHazard verifcToHazard = ao.create(VerifcToHazard.class);
verifcToHazard.setHazard(hazard);
verifcToHazard.setVerification(verification);
verifcToHazard.save();
return verification;
}
开发者ID:FraunhoferCESE,项目名称:HazardTrackingSystem,代码行数:19,代码来源:VerificationService.java
示例13: add
import net.java.ao.DBParam; //导入依赖的package包/类
public Hazard_Causes add(int hazardID, String title, String owner, Risk_Categories risk,
Risk_Likelihoods likelihood, String description, String effects, String safetyFeatures) {
Hazard_Causes cause = ao.create(Hazard_Causes.class, new DBParam("TITLE", title));
Hazards hazard = hazardService.getHazardById(hazardID);
cause.setCauseNumber(hazard.getHazardCauses().length + 1);
cause.setTransfer(0);
cause.setOwner(owner);
cause.setRiskCategory(risk);
cause.setRiskLikelihood(likelihood);
cause.setDescription(description);
cause.setEffects(effects);
cause.setAdditionalSafetyFeatures(safetyFeatures);
cause.setOriginalDate(new Date());
cause.setLastUpdated(new Date());
cause.save();
associateCauseToHazard(hazard, cause);
return cause;
}
开发者ID:FraunhoferCESE,项目名称:HazardTrackingSystem,代码行数:19,代码来源:CauseService.java
示例14: getByRepository
import net.java.ao.DBParam; //导入依赖的package包/类
public static DisapprovalConfiguration getByRepository(final ActiveObjects ao, final Repository repo)
throws SQLException {
DisapprovalConfiguration[] configs =
ao.find(DisapprovalConfiguration.class, Query.select().where("REPO_ID = ?", repo.getId()));
if (configs.length == 0) {
DisapprovalConfiguration dpc =
ao.create(DisapprovalConfiguration.class, new DBParam("REPO_ID", repo.getId()));
dpc.save();
configs = ao.find(DisapprovalConfiguration.class, Query.select().where("REPO_ID = ?", repo.getId()));
if (configs.length == 0) {
throw new IllegalStateException("Failed to create a DisapprovalConfiguration for unknown reason");
}
return configs[0];
}
return configs[0];
}
开发者ID:palantir,项目名称:stash-disapproval-plugin,代码行数:17,代码来源:DisapprovalConfigurationImpl.java
示例15: setPullRequestDisapproval
import net.java.ao.DBParam; //导入依赖的package包/类
public static void setPullRequestDisapproval(ActiveObjects ao, PullRequest pr, String username,
boolean isDisapproved) throws SQLException {
Repository repo = pr.getToRef().getRepository();
PullRequestDisapproval[] disapprovals =
ao.find(PullRequestDisapproval.class,
Query.select().where("REPO_ID = ? and PR_ID = ?", repo.getId(), pr.getId()));
if (disapprovals.length == 0) {
PullRequestDisapproval prd =
ao.create(PullRequestDisapproval.class, new DBParam("REPO_ID", repo.getId()),
new DBParam("PR_ID", pr.getId()), new DBParam("USERNAME", username));
prd.setDisapproved(isDisapproved);
prd.save();
return;
}
disapprovals[0].setDisapprovedBy(username);
disapprovals[0].setDisapproved(isDisapproved);
disapprovals[0].save();
}
开发者ID:palantir,项目名称:stash-disapproval-plugin,代码行数:19,代码来源:PullRequestDisapprovalImpl.java
示例16: setRepositorySettings
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public RepositorySettings setRepositorySettings (
Repository repository,
String refRegex) {
String repoId = repository.getProject().getKey() + "^" + repository.getSlug();
RepositorySettings[] settings;
synchronized (ao) {
settings = ao.find(RepositorySettings.class,
Query.select().where("REPOSITORY_ID = ?", repoId));
}
if (settings.length > 0) {
settings[0].setRefRegex(refRegex);
settings[0].save();
return settings[0];
}
synchronized (ao) {
return ao.create(RepositorySettings.class, new DBParam("REPOSITORY_ID", repoId),
new DBParam("REF_REGEX", refRegex)
);
}
}
开发者ID:palantir,项目名称:stash-codesearch-plugin,代码行数:22,代码来源:SettingsManagerImpl.java
示例17: upgrade
import net.java.ao.DBParam; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void upgrade(ModelVersion currentVersion, ActiveObjects ao) {
if (!currentVersion.isSame(ModelVersion.valueOf("1"))) {
throw new IllegalStateException("ConfigurationV2UpgradeTask can only upgrade from version 1");
}
// Migrate the old table to base the info off it.
ao.migrate(RepositoryConfiguration.class);
// Migrate the new table so we can populate it
ao.migrate(JobTypeStatusMapping.class);
for (RepositoryConfiguration rc : ao.find(RepositoryConfiguration.class)) {
for (JobType jt : ImmutableList.of(JobType.PUBLISH, JobType.VERIFY_COMMIT, JobType.VERIFY_PR)) {
ao.create(JobTypeStatusMapping.class,
new DBParam("REPO_CONFIG_ID", rc.getID()),
new DBParam("IS_ENABLED", true),
new DBParam("JOB_TYPE_RAW", jt.name()));
}
}
}
开发者ID:palantir,项目名称:stashbot,代码行数:21,代码来源:ConfigurationV2UpgradeTask.java
示例18: getJenkinsServerConfiguration
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public JenkinsServerConfiguration getJenkinsServerConfiguration(String name)
throws SQLException {
if (name == null) {
name = DEFAULT_JENKINS_SERVER_CONFIG_KEY;
}
JenkinsServerConfiguration[] configs = ao.find(
JenkinsServerConfiguration.class,
Query.select().where("NAME = ?", name));
if (configs.length == 0) {
// just use the defaults
return ao.create(JenkinsServerConfiguration.class, new DBParam(
"NAME", name));
}
String url = configs[0].getUrl();
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
configs[0].setUrl(url);
configs[0].save();
}
return configs[0];
}
开发者ID:palantir,项目名称:stashbot,代码行数:24,代码来源:ConfigurationPersistenceImpl.java
示例19: getRepositoryConfigurationForRepository
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public RepositoryConfiguration getRepositoryConfigurationForRepository(
Repository repo) throws SQLException {
RepositoryConfiguration[] repos = ao.find(
RepositoryConfiguration.class,
Query.select().where("REPO_ID = ?", repo.getId()));
if (repos.length == 0) {
// just use the defaults
RepositoryConfiguration rc = ao.create(
RepositoryConfiguration.class,
new DBParam("REPO_ID", repo.getId()));
rc.save();
// default the 3 base job types to enabled
setJobTypeStatusMapping(rc, JobType.VERIFY_COMMIT, true);
setJobTypeStatusMapping(rc, JobType.VERIFY_PR, true);
setJobTypeStatusMapping(rc, JobType.PUBLISH, true);
return rc;
}
return repos[0];
}
开发者ID:palantir,项目名称:stashbot,代码行数:21,代码来源:ConfigurationPersistenceImpl.java
示例20: getPullRequestMetadata
import net.java.ao.DBParam; //导入依赖的package包/类
@Override
public PullRequestMetadata getPullRequestMetadata(int repoId, Long prId, String fromSha, String toSha) {
// We have to check repoId being equal to -1 so that this works with old data.
PullRequestMetadata[] prms = ao.find(PullRequestMetadata.class,
"(REPO_ID = ? OR REPO_ID = -1) AND PULL_REQUEST_ID = ? and TO_SHA = ? and FROM_SHA = ?", repoId, prId,
toSha, fromSha);
if (prms.length == 0) {
// new/updated PR, create a new object
log.info("Creating PR Metadata for pull request: repo id:" + repoId
+ "pr id: " + prId + ", fromSha: " + fromSha + ", toSha: " + toSha);
PullRequestMetadata prm =
ao.create(
PullRequestMetadata.class,
new DBParam("REPO_ID", repoId),
new DBParam("PULL_REQUEST_ID", prId),
new DBParam("TO_SHA", toSha),
new DBParam("FROM_SHA", fromSha));
prm.save();
return prm;
}
return prms[0];
}
开发者ID:palantir,项目名称:stashbot,代码行数:24,代码来源:ConfigurationPersistenceImpl.java
注:本文中的net.java.ao.DBParam类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论