List of usage examples for com.liferay.portal.kernel.service ServiceContext setCompanyId
public void setCompanyId(long companyId)
From source file:com.bemis.portal.customer.service.impl.CustomerLocationLocalServiceImpl.java
License:Open Source License
@Override public void updateOrAddCustomerLocation(List<CustomerLocation> customerLocations) throws PortalException { for (CustomerLocation customerLocation : customerLocations) { long companyId = _bemisPortalService.getDefaultCompanyId(); User user = _bemisPortalService.getDefaultUser(); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setUserId(user.getUserId()); CustomerLocation storedCustomerLocation = customerLocationPersistence .fetchByBemisCustomerId(customerLocation.getBemisCustomerId()); if (storedCustomerLocation == null) { storedCustomerLocation = addCustomerLocation(customerLocation.getBemisCustomerId(), customerLocation.getBemisParentId(), customerLocation.getCustomerName(), customerLocation.getCustomerAddress1(), customerLocation.getCustomerAddress2(), customerLocation.getCustomerAddress3(), customerLocation.getCustomerCity(), customerLocation.getCustomerState(), customerLocation.getCustomerPostalCde(), customerLocation.getCustomerCountry(), customerLocation.getCustomerPhoneNbr(), customerLocation.getCustomerPoBox(), customerLocation.getCustomerPoCity(), customerLocation.getCustomerPoState(), customerLocation.getCustomerPoPostalCde(), customerLocation.getCustomerActiveStatusCde(), serviceContext); } else {//w w w . j a va 2 s .c o m storedCustomerLocation = updateCustomerLocation(storedCustomerLocation.getCustomerLocationId(), customerLocation.getBemisParentId(), customerLocation.getCustomerName(), customerLocation.getCustomerAddress1(), customerLocation.getCustomerAddress2(), customerLocation.getCustomerAddress3(), customerLocation.getCustomerCity(), customerLocation.getCustomerState(), customerLocation.getCustomerPostalCde(), customerLocation.getCustomerCountry(), customerLocation.getCustomerPhoneNbr(), customerLocation.getCustomerPoBox(), customerLocation.getCustomerPoCity(), customerLocation.getCustomerPoState(), customerLocation.getCustomerPoPostalCde(), customerLocation.getCustomerActiveStatusCde(), serviceContext); } } }
From source file:com.bemis.portal.fileuploader.service.impl.FileUploaderLocalServiceImpl.java
License:Open Source License
/** * Uploads the file into the destination folder * If the file does not exist, adds the file. If exists, updates the existing file * Adds tags and categories to documents * * @param companyId/*from w w w. jav a 2 s . co m*/ * @param groupId * @param userId * @param file * @param fileDescription * @param title * @param folderId * @param changeLog * @param assetTagNames * @return FileEntry * @throws PortalException */ public FileEntry uploadFile(long companyId, long groupId, long userId, File file, String fileDescription, String title, long folderId, String changeLog, String[] assetTagNames) throws PortalException { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(companyId); serviceContext.setScopeGroupId(groupId); serviceContext.setUserId(userId); serviceContext.setAssetTagNames(assetTagNames); serviceContext.setAttribute(FileUploaderConstants.DESTINATION_FOLDER_ID, folderId); return uploadFile(file, fileDescription, title, changeLog, serviceContext); }
From source file:com.liferay.asset.test.util.BaseAssetSearchTestCase.java
License:Open Source License
protected List<BaseModel<?>> addBaseModels(Group[] groups, String keywords, ServiceContext serviceContext) throws Exception { List<BaseModel<?>> baseModels = new ArrayList<>(); for (Group group : groups) { User user = UserTestUtil.getAdminUser(group.getCompanyId()); serviceContext.setCompanyId(group.getCompanyId()); serviceContext.setScopeGroupId(group.getGroupId()); serviceContext.setUserId(user.getUserId()); BaseModel<?> parentBaseModel = getParentBaseModel(group, serviceContext); baseModels.add(addBaseModel(parentBaseModel, keywords, serviceContext)); }// w ww . j a v a2 s . c o m return baseModels; }
From source file:com.liferay.calendar.service.test.CalendarBookingLocalServiceTest.java
License:Open Source License
protected ServiceContext createServiceContext() { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(_user.getCompanyId()); return serviceContext; }
From source file:com.liferay.calendar.service.test.CalendarBookingServiceTest.java
License:Open Source License
protected ServiceContext createServiceContext() { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(_user1.getCompanyId()); serviceContext.setUserId(_user1.getUserId()); return serviceContext; }
From source file:com.liferay.calendar.test.util.CalendarBookingTestUtil.java
License:Open Source License
public static CalendarBooking addCalendarBookingWithAction(User user, int action) throws PortalException { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(user.getCompanyId()); serviceContext.setWorkflowAction(action); CalendarResource calendarResource = CalendarResourceUtil.getUserCalendarResource(user.getUserId(), serviceContext);/* ww w . jav a2s . co m*/ Calendar calendar = calendarResource.getDefaultCalendar(); long startTime = System.currentTimeMillis(); return addRegularCalendarBooking(user, calendar, startTime, startTime + (Time.HOUR * 10), serviceContext); }
From source file:com.liferay.calendar.test.util.CalendarNotificationTemplateTestUtil.java
License:Open Source License
protected static ServiceContext createServiceContext(User user) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(user.getCompanyId()); serviceContext.setUserId(user.getUserId()); return serviceContext; }
From source file:com.liferay.calendar.test.util.CalendarStagingTestUtil.java
License:Open Source License
public static ServiceContext createServiceContext(User user) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(user.getCompanyId()); serviceContext.setUserId(user.getUserId()); return serviceContext; }
From source file:com.liferay.calendar.upgrade.test.UpgradeCalendarTest.java
License:Open Source License
@Test public void testUpgradeSetsUserCalendarTimeZoneId() throws Exception { _user.setTimeZoneId("Asia/Shangai"); UserLocalServiceUtil.updateUser(_user); ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(_user.getCompanyId()); CalendarResource calendarResource = CalendarResourceUtil.getUserCalendarResource(_user.getUserId(), serviceContext);/*from w w w.j a v a 2 s . c o m*/ upgrade(); List<Calendar> calendars = CalendarLocalServiceUtil.getCalendarResourceCalendars(_user.getGroupId(), calendarResource.getCalendarResourceId()); Calendar calendar = calendars.get(0); Assert.assertEquals("Asia/Shangai", calendar.getTimeZoneId()); }
From source file:com.liferay.calendar.upgrade.v1_0_6.test.UpgradeSchemaTest.java
License:Open Source License
protected Calendar addCalendar() throws PortalException { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(); serviceContext.setCompanyId(_user.getCompanyId()); CalendarResource calendarResource = CalendarResourceUtil.getUserCalendarResource(_user.getUserId(), serviceContext);/*from ww w . j av a 2 s . com*/ return calendarResource.getDefaultCalendar(); }