@Override public void transform(final GenericValue entity) { entity.set(COUNTER_FIELD, counter); } });
private void populateGenericValueFromComment(Comment updatedComment, GenericValue commentGV) { ApplicationUser updateAuthor = updatedComment.getUpdateAuthorApplicationUser(); commentGV.setString("updateauthor", updateAuthor == null ? null : updateAuthor.getKey()); commentGV.setString("body", updatedComment.getBody()); commentGV.setString("level", updatedComment.getGroupLevel()); commentGV.set("rolelevel", updatedComment.getRoleLevelId()); commentGV.set("updated", JiraDateUtils.copyOrCreateTimestampNullsafe(updatedComment.getUpdated())); }
private void updateGV(String fieldName, Object fieldValue) { if (genericValue != null) { genericValue.set(fieldName, fieldValue); } }
@RequiresXsrfCheck protected String doExecute() throws Exception { GenericValue updatedScheme = getScheme(); updatedScheme.setString("name", getName()); updatedScheme.setString("description", getDescription()); updatedScheme.set("defaultlevel", getDefaultLevel()); ComponentAccessor.getComponent(IssueSecuritySchemeManager.class).updateScheme(updatedScheme); return getRedirect(getRedirectURL()); }
void setNewEstimate(Long newEstimate, GenericValue issueGV) { if (newEstimate != null) { issueGV.set("timeestimate", newEstimate); } }
public Object set(String name, Object value, boolean setIfNull) { if (!constructed) { return super.set(name, value, setIfNull); } throw new UnsupportedOperationException("Cannot set or mutate an ImmutableGenericValue"); }
public static MutableIssue createIssue(long id, String key, long projectId) { GenericValue gv = new MockGenericValue("Issue"); gv.set("id", id); gv.set("key", key); gv.set(IssueFieldConstants.ISSUE_NUMBER, id); gv.set(IssueFieldConstants.PROJECT, projectId); return new IssueImpl(gv, issueManager, projectManager, versionManager, issueSecurityLevelManager, constantsManager, subTaskManager, attachmentManager, labelManager, projectComponentManager, userManager, jiraAuthenticationContext); }
public static MutableIssue createIssue(Long id) { GenericValue gv = new MockGenericValue("Issue"); gv.set("id", id); gv.set("key", "HSP-" + id); gv.set(IssueFieldConstants.ISSUE_NUMBER, id); return new IssueImpl(gv, issueManager, projectManager, versionManager, issueSecurityLevelManager, constantsManager, subTaskManager, attachmentManager, labelManager, projectComponentManager, userManager, jiraAuthenticationContext); }
private void storeGVListSequence(final List<GenericValue> sortedGVList) { for (int i = 0; i < sortedGVList.size(); i++) { final GenericValue genericValue = sortedGVList.get(i); genericValue.set(Column.SEQUENCE, (long) i); } delegator.storeAll(sortedGVList); } }
private static void updateHistoryItemLastViewed(@Nonnull final GenericValue genericValue, final long lastViewed) { genericValue.set(LAST_VIEWED, lastViewed); try { genericValue.store(); } catch (GenericEntityException e) { LOG.error("Exception thrown while updating user history item", e); } }
public void setStatusCategory(final StatusCategory statusCategory) { final Long id = Preconditions.checkNotNull(statusCategory).getId(); genericValue.set(STATUSCATEGORY, id); }
public void editEventType(Long eventTypeId, String name, String description, Long templateId) { GenericValue eventTypeGV = retrieveEntityByPrimaryKey(FieldMap.build("id", eventTypeId)); eventTypeGV.set("name", name); eventTypeGV.set("description", description); eventTypeGV.set("templateId", templateId); delegator.store(eventTypeGV); clearCache(); }
private void storeAndClearCaches(List<GenericValue> reordered) { for (int i = 0; i < reordered.size(); i++) { GenericValue value = reordered.get(i); value.set("sequence", new Long(i + 1)); } ofBizDelegator.storeAll(reordered); clearCaches(); } }
private void storeDirectoryPosition(final Long id, final long position) throws DirectoryNotFoundException { final GenericValue gv = findDirectoryById(id); gv.set("position", position); storeDirectory(gv); }
@Override public void transform(final GenericValue entity) { if (entity.getLong(INDEX_OP_ID) == null || entity.getLong(INDEX_OP_ID) < indexOperationId) { entity.set(INDEX_OP_ID, indexOperationId); } } });
@Override public void update(DraftState state, GenericValue schemeGv) { Long parentId = schemeGv.getLong(SchemeTable.Columns.PARENT); if (parentId == null || !parentId.equals(state.getParentSchemeId())) { throw new DataAccessException("Trying to change the parent of a draft."); } schemeGv.set(SchemeTable.Columns.UPDATED_DATE, currentDate()); schemeGv.set(SchemeTable.Columns.UPDATED_USER, state.getLastModifiedUser()); delegator.store(schemeGv); }
public synchronized Directory update(final Directory directory) throws DirectoryNotFoundException { final GenericValue gv = DirectoryEntity.setData(directory, findDirectoryById(directory.getId())); gv.set(DirectoryEntity.UPDATED_DATE, new Timestamp(System.currentTimeMillis())); storeDirectory(gv); storeAttributes(directory); storeOperations(directory); // Rebuild the full cache (this would be very rare) directoryCache.reset(); // Find the latest copy of the Directory return findById(directory.getId()); }
@Override public void updateCredential(final User user, final PasswordCredential credential, final int credentialHistory) throws UserNotFoundException { Validate.isTrue(credential.isEncryptedCredential(), "credential must be encrypted"); final GenericValue storeGenericValue = findUserGenericValue(user.getDirectoryId(), user.getName()); storeGenericValue.set(UserEntity.CREDENTIAL, credential.getCredential()); storeUser(storeGenericValue); }
private void disableCloneLinkLegacyDirectionFlag() throws GenericEntityException { //this property exists since we just got true form it final GenericValue flag = entityEngine.run(Select.from("OSPropertyEntry") .whereEqual("propertyKey", JIRA_CLONE_LINK_LEGACY_DIRECTION)).singleValue(); final GenericValue value = entityEngine.run(Select.from("OSPropertyNumber") .whereEqual("id", flag.getLong("id"))).singleValue(); value.set("value", 0); value.store(); }