public void save(Task item) { TaskService taskService = ApplicationContextUtil.getSpringBean(TaskService.class); item.setSaccountid(AppContext.getAccountId()); if (item.getId() == null) { taskService.saveWithSession(item, AppContext.getUsername()); } else { taskService.updateWithSession(item, AppContext.getUsername()); } }
public void save(MeetingWithBLOBs item) { MeetingService meetingService = ApplicationContextUtil.getSpringBean(MeetingService.class); item.setSaccountid(AppContext.getAccountId()); if (item.getId() == null) { meetingService.saveWithSession(item, AppContext.getUsername()); } else { meetingService.updateWithSession(item, AppContext.getUsername()); } }
private void save(Version item) { VersionService versionService = ApplicationContextUtil.getSpringBean(VersionService.class); item.setSaccountid(AppContext.getAccountId()); item.setProjectid(CurrentProjectVariables.getProjectId()); item.setStatus(StatusI18nEnum.Open.name()); if (item.getId() == null) { versionService.saveWithSession(item, AppContext.getUsername()); } else { versionService.updateWithSession(item, AppContext.getUsername()); } }
private int saveMilestone(Milestone milestone) { MilestoneService milestoneService = ApplicationContextUtil.getSpringBean(MilestoneService.class); milestone.setProjectid(CurrentProjectVariables.getProjectId()); milestone.setSaccountid(AppContext.getAccountId()); if (milestone.getId() == null) { milestone.setCreateduser(AppContext.getUsername()); milestoneService.saveWithSession(milestone, AppContext.getUsername()); } else { milestoneService.updateWithSession(milestone, AppContext.getUsername()); } return milestone.getId(); }
@Override protected void saveTimeInvest(double spentHours, boolean isBillable, Date forDate) { ItemTimeLogging item = new ItemTimeLogging(); item.setLoguser(AppContext.getUsername()); item.setLogvalue(spentHours); item.setTypeid(bean.getId()); item.setType(ProjectTypeConstants.TASK); item.setSaccountid(AppContext.getAccountId()); item.setProjectid(CurrentProjectVariables.getProjectId()); item.setLogforday(forDate); item.setIsbillable(isBillable); itemTimeLoggingService.saveWithSession(item, AppContext.getUsername()); }
public void display() { final CallSearchCriteria criteria = new CallSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); criteria.setAssignUsers(new SetSearchField<>(AppContext.getUsername())); criteria.setIsClosed(BitSearchField.FALSE); tableItem.setSearchCriteria(criteria); }
@Override protected void deleteSelectedItems() { if (!isSelectAll) { Collection<SimpleRole> currentDataList = view.getPagedBeanTable().getCurrentDataList(); List<Role> keyList = new ArrayList<>(); for (SimpleRole item : currentDataList) { if (item.isSelected()) { if (Boolean.TRUE.equals(item.getIssystemrole())) { NotificationUtil.showErrorNotification( String.format( "Can not delete role %s because it is the system role.", item.getRolename())); } else { keyList.add(item); } } } if (keyList.size() > 0) { roleService.massRemoveWithSession( keyList, AppContext.getUsername(), AppContext.getAccountId()); doSearch(searchCriteria); } } else { roleService.removeByCriteria(searchCriteria, AppContext.getAccountId()); doSearch(searchCriteria); } }
@Override protected void updateTimeRemain(double newValue) { ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); bean.setRemainestimate(newValue); taskService.updateWithSession(bean, AppContext.getUsername()); }
private void updateFieldValue(TextField editField) { removeComponent(editField); addComponent(taskLinkLbl); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(task.getTaskname())) { task.setTaskname(newValue); taskLinkLbl.setValue(buildTaskLink()); ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); taskService.updateWithSession(task, AppContext.getUsername()); } isRead = !isRead; }
@Override protected SearchCriteria fillUpSearchCriteria() { OpportunitySearchCriteria searchCriteria = new OpportunitySearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); if (StringUtils.isNotBlank(this.nameField.getValue().trim())) { searchCriteria.setOpportunityName(StringSearchField.and(this.nameField.getValue().trim())); } if (this.myItemCheckbox.getValue()) { searchCriteria.setAssignUsers(new SetSearchField<>(AppContext.getUsername())); } else { searchCriteria.setAssignUsers(null); } return searchCriteria; }
private boolean hasDeletePermission(SimpleComment comment) { return (AppContext.getUsername().equals(comment.getCreateduser()) || AppContext.isAdmin()); }