本文整理汇总了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);
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
示例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);
}
}
示例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;
}
示例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);
示例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);
}
示例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);
}
}
示例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;
}
示例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);
示例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);