/** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */ public static TasksEntry toModel(TasksEntrySoap soapModel) { if (soapModel == null) { return null; } TasksEntry model = new TasksEntryImpl(); model.setTasksEntryId(soapModel.getTasksEntryId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setUserId(soapModel.getUserId()); model.setUserName(soapModel.getUserName()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setTitle(soapModel.getTitle()); model.setPriority(soapModel.getPriority()); model.setAssigneeUserId(soapModel.getAssigneeUserId()); model.setResolverUserId(soapModel.getResolverUserId()); model.setDueDate(soapModel.getDueDate()); model.setFinishDate(soapModel.getFinishDate()); model.setStatus(soapModel.getStatus()); return model; }
public TasksEntry addTasksEntry( long userId, String title, int priority, long assigneeUserId, int dueDateMonth, int dueDateDay, int dueDateYear, int dueDateHour, int dueDateMinute, boolean neverDue, ServiceContext serviceContext) throws PortalException, SystemException { // Tasks entry User user = UserLocalServiceUtil.getUserById(userId); long groupId = serviceContext.getScopeGroupId(); Date now = new Date(); Date dueDate = null; if (!neverDue) { dueDate = PortalUtil.getDate( dueDateMonth, dueDateDay, dueDateYear, dueDateHour, dueDateMinute, user.getTimeZone(), new TasksEntryDueDateException()); } long tasksEntryId = CounterLocalServiceUtil.increment(); TasksEntry tasksEntry = tasksEntryPersistence.create(tasksEntryId); tasksEntry.setGroupId(groupId); tasksEntry.setCompanyId(user.getCompanyId()); tasksEntry.setUserId(user.getUserId()); tasksEntry.setUserName(user.getFullName()); tasksEntry.setCreateDate(now); tasksEntry.setModifiedDate(now); tasksEntry.setTitle(title); tasksEntry.setPriority(priority); tasksEntry.setAssigneeUserId(assigneeUserId); tasksEntry.setDueDate(dueDate); tasksEntry.setStatus(TasksEntryConstants.STATUS_OPEN); tasksEntryPersistence.update(tasksEntry, false); // Asset updateAsset( userId, tasksEntry, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames()); // Social SocialActivityLocalServiceUtil.addActivity( userId, groupId, TasksEntry.class.getName(), tasksEntryId, TasksActivityKeys.ADD_ENTRY, StringPool.BLANK, assigneeUserId); return tasksEntry; }