List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED
int STATUS_APPROVED
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED.
Click Source Link
From source file:com.liferay.bookmarks.trash.test.BookmarksFolderTrashHandlerTest.java
License:Open Source License
@Override protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception { BookmarksFolder parentFolder = (BookmarksFolder) parentBaseModel; return BookmarksFolderLocalServiceUtil.getFoldersCount(parentFolder.getGroupId(), parentFolder.getFolderId(), WorkflowConstants.STATUS_APPROVED); }
From source file:com.liferay.bookmarks.uad.test.BookmarksEntryUADEntityTestHelper.java
License:Open Source License
public BookmarksEntry addDataObjectWithStatusByUserId(long userId, long statusByUserId) throws Exception { BookmarksEntry bookmarksEntry = addBookmarksEntry(userId); _bookmarksEntryLocalService.updateStatus(statusByUserId, bookmarksEntry, WorkflowConstants.STATUS_APPROVED); return bookmarksEntry; }
From source file:com.liferay.bookmarks.util.test.BookmarksTestUtil.java
License:Open Source License
public static BookmarksEntry addEntry(String name, long folderId, boolean approved, ServiceContext serviceContext) throws Exception { boolean workflowEnabled = WorkflowThreadLocal.isEnabled(); try {// www .j a v a2s .com WorkflowThreadLocal.setEnabled(true); String url = "http://www.liferay.com"; String description = "This is a test entry."; serviceContext = (ServiceContext) serviceContext.clone(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT); BookmarksEntry entry = BookmarksEntryServiceUtil.addEntry(serviceContext.getScopeGroupId(), folderId, name, url, description, serviceContext); serviceContext.setCommand(Constants.ADD); serviceContext.setLayoutFullURL("http://localhost"); if (approved) { entry.setStatus(WorkflowConstants.STATUS_APPROVED); entry = BookmarksEntryServiceUtil.updateEntry(entry.getEntryId(), serviceContext.getScopeGroupId(), entry.getFolderId(), entry.getName(), entry.getUrl(), entry.getUrl(), serviceContext); } return entry; } finally { WorkflowThreadLocal.setEnabled(workflowEnabled); } }
From source file:com.liferay.bookmarks.web.internal.portlet.action.OpenEntryAction.java
License:Open Source License
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { try {// w w w . ja va 2s .com long entryId = ParamUtil.getLong(request, "entryId"); BookmarksEntry entry = _bookmarksEntryService.getEntry(entryId); if (entry.isInTrash()) { int status = ParamUtil.getInteger(request, "status", WorkflowConstants.STATUS_APPROVED); if (status != WorkflowConstants.STATUS_IN_TRASH) { throw new NoSuchEntryException("{entryId=" + entryId + "}"); } } entry = _bookmarksEntryService.openEntry(entry); response.sendRedirect(entry.getUrl()); return null; } catch (Exception e) { PortalUtil.sendError(e, request, response); return null; } }
From source file:com.liferay.calendar.service.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testAddCalendarBookingWorkflowActionPublish() throws PortalException { ServiceContext serviceContext = createServiceContext(); CalendarResource calendarResource = CalendarResourceUtil.getUserCalendarResource(_user.getUserId(), serviceContext);//from w ww.j a v a2s .c om Calendar calendar = calendarResource.getDefaultCalendar(); long startTime = DateUtil.newTime(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); CalendarBooking calendarBooking = CalendarBookingLocalServiceUtil.addCalendarBooking(_user.getUserId(), calendar.getCalendarId(), new long[0], CalendarBookingConstants.PARENT_CALENDAR_BOOKING_ID_DEFAULT, RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, serviceContext); Assert.assertEquals(WorkflowConstants.STATUS_APPROVED, calendarBooking.getStatus()); }
From source file:com.liferay.calendar.service.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testUpdateCalendarBookingWorkflowActionPublish() throws PortalException { ServiceContext serviceContext = createServiceContext(); CalendarResource calendarResource = CalendarResourceUtil.getUserCalendarResource(_user.getUserId(), serviceContext);//from ww w. ja v a2 s. c o m Calendar calendar = calendarResource.getDefaultCalendar(); long startTime = DateUtil.newTime(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT); CalendarBooking calendarBooking = CalendarBookingLocalServiceUtil.addCalendarBooking(_user.getUserId(), calendar.getCalendarId(), new long[0], CalendarBookingConstants.PARENT_CALENDAR_BOOKING_ID_DEFAULT, RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, serviceContext); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); calendarBooking = CalendarBookingLocalServiceUtil.updateCalendarBooking(_user.getUserId(), calendarBooking.getCalendarBookingId(), calendar.getCalendarId(), new long[0], RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, RandomTestUtil.randomInt(), serviceContext); Assert.assertEquals(WorkflowConstants.STATUS_APPROVED, calendarBooking.getStatus()); }
From source file:com.liferay.calendar.service.impl.CalendarImporterLocalServiceImpl.java
License:Open Source License
protected void addCalendarBooking(String uuid, long calendarBookingId, long companyId, long groupId, long userId, String userName, Date createDate, Date modifiedDate, long calendarId, long calendarResourceId, String title, String description, String location, long startTime, long endTime, boolean allDay, String recurrence, int firstReminder, NotificationType firstReminderType, int secondReminder, NotificationType secondReminderType) { CalendarBooking calendarBooking = calendarBookingPersistence.create(calendarBookingId); calendarBooking.setUuid(uuid);//from w w w .j a v a2 s . co m calendarBooking.setCompanyId(companyId); calendarBooking.setGroupId(groupId); calendarBooking.setUserId(userId); calendarBooking.setUserName(userName); calendarBooking.setCreateDate(createDate); calendarBooking.setModifiedDate(modifiedDate); calendarBooking.setCalendarId(calendarId); calendarBooking.setCalendarResourceId(calendarResourceId); calendarBooking.setParentCalendarBookingId(calendarBookingId); calendarBooking.setTitle(title); calendarBooking.setDescription(description); calendarBooking.setLocation(location); calendarBooking.setStartTime(startTime); calendarBooking.setEndTime(endTime); calendarBooking.setAllDay(allDay); calendarBooking.setRecurrence(recurrence); calendarBooking.setFirstReminder(firstReminder); calendarBooking.setFirstReminderType(firstReminderType.toString()); calendarBooking.setSecondReminder(secondReminder); calendarBooking.setSecondReminderType(secondReminderType.toString()); calendarBooking.setStatus(WorkflowConstants.STATUS_APPROVED); calendarBooking.setStatusByUserId(userId); calendarBooking.setStatusByUserName(userName); calendarBooking.setStatusDate(createDate); calendarBookingPersistence.update(calendarBooking); }
From source file:com.liferay.calendar.service.test.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testPublishCalendarBooking() throws Exception { ServiceContext serviceContext = createServiceContext(); Calendar calendar = CalendarTestUtil.addCalendar(_user, serviceContext); long startTime = System.currentTimeMillis(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); CalendarBooking calendarBooking = CalendarBookingTestUtil.addRegularCalendarBooking(_user, calendar, startTime, startTime + (Time.HOUR * 10), serviceContext); calendarBooking = CalendarBookingLocalServiceUtil .fetchCalendarBooking(calendarBooking.getCalendarBookingId()); Assert.assertEquals(WorkflowConstants.STATUS_APPROVED, calendarBooking.getStatus()); }
From source file:com.liferay.calendar.service.test.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testPublishDraftCalendarBooking() throws Exception { ServiceContext serviceContext = createServiceContext(); Calendar calendar = CalendarTestUtil.addCalendar(_user, serviceContext); long startTime = System.currentTimeMillis(); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_SAVE_DRAFT); CalendarBooking calendarBooking = CalendarBookingTestUtil.addRegularCalendarBooking(_user, calendar, startTime, startTime + (Time.HOUR * 10), serviceContext); serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH); calendarBooking = CalendarBookingLocalServiceUtil.updateCalendarBooking(_user.getUserId(), calendarBooking.getCalendarBookingId(), calendar.getCalendarId(), new long[0], RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, serviceContext);/* w w w. j a v a2s. c o m*/ calendarBooking = CalendarBookingLocalServiceUtil .fetchCalendarBooking(calendarBooking.getCalendarBookingId()); Assert.assertEquals(WorkflowConstants.STATUS_APPROVED, calendarBooking.getStatus()); }
From source file:com.liferay.calendar.util.CalendarICalDataHandler.java
License:Open Source License
protected Attendee toICalAttendee(String fullName, String emailAddress, int status) { Attendee attendee = new Attendee(); URI uri = URI.create("mailto:".concat(emailAddress)); attendee.setCalAddress(uri);//from ww w . ja va2 s.c o m Cn cn = new Cn(fullName); ParameterList parameters = attendee.getParameters(); parameters.add(cn); parameters.add(CuType.INDIVIDUAL); parameters.add(Role.REQ_PARTICIPANT); parameters.add(Rsvp.TRUE); if (status == WorkflowConstants.STATUS_APPROVED) { parameters.add(PartStat.ACCEPTED); } else { parameters.add(PartStat.NEEDS_ACTION); } return attendee; }