当前位置: 首页>>代码示例>>Java>>正文


Java ServiceContext类代码示例

本文整理汇总了Java中com.liferay.portal.kernel.service.ServiceContext的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext类的具体用法?Java ServiceContext怎么用?Java ServiceContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ServiceContext类属于com.liferay.portal.kernel.service包,在下文中一共展示了ServiceContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
/**
 * Create Dummy data
 *
 * @param request
 * @throws Exception
 */
public void create(ActionRequest request) throws Exception {

	T paramContext = getContext(request);

       if(!validate(paramContext)) {
           throw new Exception("Validation Error");
       }

	ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
	ServiceContext serviceContext = ServiceContextFactory.getInstance(Group.class.getName(), request);

	paramContext.setThemeDisplay(themeDisplay);
	paramContext.setServiceContext(serviceContext);

	exec(request, paramContext);
}
 
开发者ID:yasuflatland-lf,项目名称:liferay-dummy-factory,代码行数:23,代码来源:DummyGenerator.java

示例2: removeDeliverabletypes

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public Response removeDeliverabletypes(HttpServletRequest request, HttpHeaders header, Company company,
		Locale locale, User user, ServiceContext serviceContext, String id) {
	// TODO Remove Deliverable Type
	BackendAuth auth = new BackendAuthImpl();

	long groupId = GetterUtil.getLong(header.getHeaderString("groupId"));

	try {

		if (!auth.isAuth(serviceContext)) {
			throw new UnauthenticationException();
		}

		DeliverableTypesActions action = new DeliverableTypesActionsImpl();

		DeliverableType deliverableType = action.removeDeliverableType(groupId, id);

		DeliverableTypeDetailModel result = DeliverableTypesUtils.mappingToDeliverableTypesModel(deliverableType);

		return Response.status(200).entity(result).build();

	} catch (Exception e) {
		return processException(e);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:DeliverableTypesManagementImpl.java

示例3: _addComment

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
private Comment _addComment(
	CommentableIdentifier commentableIdentifier, CommentForm commentForm,
	CurrentUser currentUser) {

	User user = currentUser.getUser();

	Function<String, ServiceContext> createServiceContextFunction =
		string -> new ServiceContext();

	Try<Long> commentIdLongTry = Try.fromFallible(
		() -> _commentManager.addComment(
			user.getUserId(), commentableIdentifier.getGroupId(),
			commentableIdentifier.getClassName(),
			commentableIdentifier.getClassPK(), commentForm.getText(),
			createServiceContextFunction));

	return commentIdLongTry.map(
		_commentManager::fetchComment
	).getUnchecked();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:21,代码来源:CommentNestedCollectionResource.java

示例4: getFormScriptByRegistrationTemplateId

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public Response getFormScriptByRegistrationTemplateId(HttpServletRequest request, HttpHeaders header,
		Company company, Locale locale, User user, ServiceContext serviceContext, long registrationTemplateId) {
	// TODO Get FormScript of RegistrationTemplates
	BackendAuth auth = new BackendAuthImpl();

	RegistrationTemplateFormScriptInputUpdateModel result = new RegistrationTemplateFormScriptInputUpdateModel();
	long groupId = GetterUtil.getLong(header.getHeaderString("groupId"));
	try {

		if (!auth.isAuth(serviceContext)) {
			throw new UnauthenticationException();
		}

		RegistrationTemplates registrationTemplate = RegistrationTemplatesLocalServiceUtil
				.getRegTempbyRegId(groupId, registrationTemplateId);

		result.setFormScript(registrationTemplate.getFormScript());

		return Response.status(200).entity(result).build();

	} catch (Exception e) {
		_log.error(e);
		return processException(e);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:RegistrationTemplatesManagementImpl.java

示例5: getFileEntry

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public FileEntry getFileEntry(long id, ServiceContext serviceContext) {

	FileEntry fileEntry = null;

	Employee employee = EmployeeLocalServiceUtil.fetchEmployee(id);

	try {
		if (employee.getPhotoFileEntryId() > 0) {
			fileEntry = DLAppLocalServiceUtil.getFileEntry(
				employee.getPhotoFileEntryId());
		}
	}
	catch (PortalException e) {
		_log.error(
			"Can not get employee photo with employee.getPhotoFileEntryId() " +
				employee.getPhotoFileEntryId());
	}

	return fileEntry;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:22,代码来源:EmployeeActions.java

示例6: addRegistrationFormbaseonRegTemplate

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public void addRegistrationFormbaseonRegTemplate(long groupId, long companyId, long registrationId, String govAgencyCode,
		ServiceContext serviceContext) throws PortalException, SystemException {
	// get lstRegistrationTemplate
	List<RegistrationTemplates> lstRegistrationTemplate = RegistrationTemplatesLocalServiceUtil
			.getRegistrationTemplatesbyGOVCODE(groupId, govAgencyCode);

	// add registrationForm
	for (RegistrationTemplates registrationTemplates : lstRegistrationTemplate) {
		// create referenceUid
		String referenceUid = UUID.randomUUID().toString();

		RegistrationFormLocalServiceUtil.addRegistrationForm(groupId, companyId, registrationId, referenceUid,
				registrationTemplates.getFormNo(), registrationTemplates.getFormName(),
				registrationTemplates.getSampleData(), registrationTemplates.getFormScript(),
				registrationTemplates.getFormReport(), 0, false, false, serviceContext);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:19,代码来源:RegistrationFormActionsImpl.java

示例7: deleteFormbyRegId

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@DELETE
@Path("/registrations/{id}/forms/{referenceUid}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
public Response deleteFormbyRegId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@PathParam("id") long id,
		@PathParam("referenceUid") String referenceUid);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:10,代码来源:RegistrationFormManagement.java

示例8: getMappingDataByDeliverableTypeId

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public Response getMappingDataByDeliverableTypeId(HttpServletRequest request, HttpHeaders header, Company company,
		Locale locale, User user, ServiceContext serviceContext, long deliverableTypeId) {
	// TODO Get MappingData of Deliverable Type
	BackendAuth auth = new BackendAuthImpl();

	try {

		if (!auth.isAuth(serviceContext)) {
			throw new UnauthenticationException();
		}

		DeliverableType deliverableType = DeliverableTypeLocalServiceUtil.getDeliverableType(deliverableTypeId);

		return Response.status(200).entity(deliverableType.getMappingData()).build();

	} catch (Exception e) {
		return processException(e);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:21,代码来源:DeliverableTypesManagementImpl.java

示例9: create

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public Employee create(
	long userId, long companyId, long groupId, String employeeNo,
	String fullName, String email, String gender, Date birthDate,
	String telNo, String mobile, String title, String workingStatus,
	Date recruitDate, Date leaveDate, ServiceContext serviceContext)
	throws NoSuchUserException, UnauthenticationException,
	UnauthorizationException, DuplicateEmployeeNoException,
	DuplicateEmployeeEmailException, PortalException {

	Employee ett = null;

	ett = EmployeeLocalServiceUtil.addEmployee(
		userId, groupId, fullName, employeeNo, GetterUtil.get(gender, 0),
		birthDate, telNo, mobile, email, GetterUtil.get(workingStatus, 1),
		0l, title, false, recruitDate, leaveDate, serviceContext);

	return ett;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:20,代码来源:EmployeeActions.java

示例10: addDossierFileByDossierId

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@POST
@Path("/{id}/files")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "addDossierFileByDossierId)", response = DossierFileModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addDossierFileByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file,
		@ApiParam(value = "id of dossier", required = true) @PathParam("id") String id,
		@ApiParam(value = "Metadata of DossierFile", required = true) @Multipart("referenceUid") String referenceUid,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierTemplateNo") String dossierTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("dossierPartNo") String dossierPartNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileTemplateNo") String fileTemplateNo,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("displayName") String displayName,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("fileType") String fileType,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("isSync") String isSync,
		@ApiParam(value = "Metadata of DossierFile") @Multipart("formData") @Nullable String formData);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:DossierFileManagement.java

示例11: updateProcessStep

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public ProcessStep updateProcessStep(long groupId, String oldStepCode, String newStepCode, String stepName,
		long serviceProcessId, String sequenceNo, String dossierStatus, String dossierSubStatus, int durationCount,
		String customProcessUrl, String stepInstruction, String briefNote, boolean editable, ServiceContext context)
		throws PortalException {
	
	ProcessStep step = ProcessStepLocalServiceUtil.fetchBySC_GID(oldStepCode, groupId, serviceProcessId);
	
	long processStepId = 0;
	
	if (Validator.isNotNull(step)) {
		processStepId = step.getProcessStepId();
	}
	
	return ProcessStepLocalServiceUtil.updateProcessStep(groupId, processStepId, newStepCode, stepName,
			serviceProcessId, sequenceNo, dossierStatus, dossierSubStatus, durationCount, customProcessUrl,
			stepInstruction, briefNote, editable, context);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:19,代码来源:ServiceProcessActionsImpl.java

示例12: pullFormData

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
private void pullFormData(long desGroupId, String fileRef, String dossierTemplateNo, long dossierId,
		String formData, DossierPart part, ServiceContext serviceContext) {
	try {
		DossierFile dossierFile = DossierFileLocalServiceUtil.getDossierFileByReferenceUid(dossierId, fileRef);

		if (Validator.isNull(dossierFile)) {
			// create dossierFile
			dossierFile = DossierFileLocalServiceUtil.addDossierFile(desGroupId, dossierId,
					PortalUUIDUtil.generate(), dossierTemplateNo, part.getPartNo(), part.getFileTemplateNo(),
					part.getPartName(), StringPool.BLANK, 0, null, StringPool.BLANK, StringPool.FALSE,
					serviceContext);
		}

		dossierFile.setFormData(formData);

		DossierFileLocalServiceUtil.updateDossierFile(dossierFile);

	} catch (Exception e) {
		_log.error(e);
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:22,代码来源:DossierPullScheduler.java

示例13: updateFileApproval

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@Override
public PaymentFile updateFileApproval(long groupId, long id, String referenceUid, String approveDatetime,
		String accountUserName, String govAgencyTaxNo, String invoiceTemplateNo, String invoiceIssueNo,
		String invoiceNo, ServiceContext serviceContext)
		throws SystemException, PortalException, java.text.ParseException {

	PaymentFile paymentFile = PaymentFileLocalServiceUtil.updateFileApproval(groupId, id, referenceUid,
			approveDatetime, accountUserName, govAgencyTaxNo, invoiceTemplateNo, invoiceIssueNo, invoiceNo,
			serviceContext);

	// Add PaymentFileSync

	Dossier dossier = DossierLocalServiceUtil.getDossier(paymentFile.getDossierId());
	// TODO review serverNo on this
	DossierSyncLocalServiceUtil.updateDossierSync(groupId, serviceContext.getUserId(), paymentFile.getDossierId(),
			dossier.getReferenceUid(), false, 3, paymentFile.getPrimaryKey(), paymentFile.getReferenceUid(),
			StringPool.BLANK);

	return paymentFile;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:21,代码来源:PaymentFileActionsImpl.java

示例14: updateServiceProcess

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update a ServiceProcesses", response = ServiceProcessDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the ServiceProcesses was update", response = ServiceProcessDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response updateServiceProcess(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id,
		@BeanParam ServiceProcessInputModel input);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:16,代码来源:ServiceProcessManagement.java

示例15: updateOfficeSitePreferences

import com.liferay.portal.kernel.service.ServiceContext; //导入依赖的package包/类
@PUT
@Path("/{id}/preferences")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response updateOfficeSitePreferences(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam OfficeSiteInputModel input);
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:8,代码来源:OfficeSiteManagement.java


注:本文中的com.liferay.portal.kernel.service.ServiceContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。