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


Java ServiceContext.setUserId方法代码示例

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


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

示例1: onAfterCreate

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterCreate(PaymentFile model) throws ModelListenerException {
	String content = "On PaymentFile Created";
	String notificationType = "";
	String payload = DossierLogUtils.createPayload(null, model, null);
	
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	try {
		DossierLogLocalServiceUtil.addDossierLog(model.getGroupId(), model.getDossierId(), model.getUserName(), content,
				notificationType, payload, serviceContext);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
	super.onAfterCreate(model);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:18,代码来源:PaymentFileListenner.java

示例2: onAfterRemove

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterRemove(PaymentFile model) throws ModelListenerException {
	String content = "On PaymentFile Delete";
	String notificationType = "";
	String payload = DossierLogUtils.createPayload(null, model, null);
	
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	
	try {
		DossierLogLocalServiceUtil.addDossierLog(model.getGroupId(), model.getDossierId(), model.getUserName(), content,
				notificationType, payload, serviceContext);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:18,代码来源:PaymentFileListenner.java

示例3: onAfterUpdate

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterUpdate(PaymentFile model) throws ModelListenerException {
	String content = "On PaymentFile Update";
	String notificationType = "";
	String payload = DossierLogUtils.createPayload(null, model, null);
	
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	
	try {
		boolean hasChangedStatus = modelBeforeUpdate.getPaymentStatus() == model.getPaymentStatus();
		if (hasChangedStatus && model.getPaymentStatus() ==1 ) {
			notificationType = NotificationType.DOSSIER_07;
		} else if (hasChangedStatus && model.getPaymentStatus() ==2 ) {
			notificationType = NotificationType.DOSSIER_08;
		}
		
		DossierLogLocalServiceUtil.addDossierLog(model.getGroupId(), model.getDossierId(), model.getUserName(), content,
				notificationType, payload, serviceContext);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:25,代码来源:PaymentFileListenner.java

示例4: onAfterCreate

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterCreate(DossierFile model) throws ModelListenerException {
	_log.info("After Created........... ");
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	try {
		// Binhth add message bus to processing KySO file
		Message message = new Message();
		DossierPart dossierPart = DossierPartLocalServiceUtil.fetchByTemplatePartNo(model.getGroupId(),
				model.getDossierTemplateNo(), model.getDossierPartNo());
		
		JSONObject msgDataESign = JSONFactoryUtil.createJSONObject();
		msgDataESign.put("userId", model.getUserId());
		msgDataESign.put("eSign", dossierPart.getESign());
		msgDataESign.put("fileEntryId", model.getFileEntryId());

		message.put("msgToEngine", msgDataESign);
		MessageBusUtil.sendMessage("kyso/engine/out/destination", message);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:24,代码来源:DossierFileKySoListenner.java

示例5: onAfterRemove

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterRemove(DossierFile model) throws ModelListenerException {
	String content = "On DossiserFile Delete";
	String notificationType = "";
	String payload = DossierLogUtils.createPayload(model, null, null);

	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());

	try {
		DossierLogLocalServiceUtil.addDossierLog(model.getGroupId(), model.getDossierId(), model.getUserName(),
				content, notificationType, payload, serviceContext);
	} catch (SystemException | PortalException e) {
		e.printStackTrace();
	}
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:18,代码来源:DossierFileListenner.java

示例6: onAfterUpdate

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterUpdate(DossierFile model) throws ModelListenerException {
	
	ServiceContext serviceContext = new ServiceContext();
	serviceContext.setCompanyId(model.getCompanyId());
	serviceContext.setUserId(model.getUserId());
	
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:9,代码来源:DossierFileKySoListenner.java

示例7: createDossierLog

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
static void createDossierLog(Dossier model, boolean isUpdated, boolean isChangedStatus) {

		try {

			String content = StringPool.BLANK;
			String notificationType = StringPool.BLANK;
			String payload = DossierLogUtils.createPayload(null, null, model);
			Applicant applicant = ApplicantLocalServiceUtil.fetchByMappingID(model.getUserId());
			ServiceContext serviceContext = new ServiceContext();

			serviceContext.setCompanyId(model.getCompanyId());
			serviceContext.setUserId(model.getUserId());

			// when update dossier and dossierStatus is changed
			if (isUpdated && isChangedStatus) {

				String dossierStatus = model.getDossierStatus();
				switch (dossierStatus) {

				case DossierStatusConstants.WAITING:
					notificationType = NotificationType.DOSSIER_01;
					content = "On Dossiser Updated new status: " + DossierStatusConstants.WAITING;
					break;
				case DossierStatusConstants.PAYING:
					notificationType = NotificationType.DOSSIER_02;
					content = "On Dossiser Updated new status: " + DossierStatusConstants.PAYING;
					break;
				case DossierStatusConstants.PROCESSING:
					notificationType = NotificationType.DOSSIER_03;
					content = "On Dossiser Updated new status: " + DossierStatusConstants.PROCESSING;
					break;
				case DossierStatusConstants.RECEIVING:
					notificationType = NotificationType.DOSSIER_04;
					content = "On Dossiser Updated new status: " + DossierStatusConstants.RECEIVING;
					break;
				case DossierStatusConstants.CANCELLED:
					notificationType = NotificationType.DOSSIER_05;
					content = "On Dossiser Updated new status: " + DossierStatusConstants.CANCELLED;
					break;

				default:
					notificationType = StringPool.BLANK;
					content = "On Dossiser Updated new status: " + dossierStatus;
					break;
				}

			}
			// when update but status isn't changed
			else if (isUpdated) {
				content = "On Dossiser Updated";
			}
			// when create
			else {
				notificationType = "Dossier-00";
				content = "On Dossiser Created";
			}

			DossierLogLocalServiceUtil.addDossierLog(model.getGroupId(), model.getDossierId(),
					(applicant != null && Validator.isNotNull(applicant.getApplicantName()))
							? applicant.getApplicantName() : model.getUserName(),
					content, notificationType, payload, serviceContext);

		} catch (Exception e) {
			e.printStackTrace();

		}

	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:69,代码来源:DossierListennerUltils.java

示例8: notificationByType

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static void notificationByType(String[] notificationTypeList) {

		List<NotificationQueue> listQueue = NotificationQueueLocalServiceUtil.getNotificationQueues(QueryUtil.ALL_POS,
				QueryUtil.ALL_POS);

		ServiceContext serviceContext = new ServiceContext();

		for (NotificationQueue notificationQueue : listQueue) {
			
			serviceContext.setCompanyId(notificationQueue.getCompanyId());
			serviceContext.setUserId(notificationQueue.getUserId());
			serviceContext.setScopeGroupId(notificationQueue.getGroupId());
			
			long groupId = notificationQueue.getGroupId();

			String queueType = notificationQueue.getNotificationType();

			try {

				JSONObject payLoadData = JSONFactoryUtil.createJSONObject(notificationQueue.getPayload());

				for (String type : notificationTypeList) {

					if (queueType.equals(type)) {

						Notificationtemplate notificationtemplate = NotificationtemplateLocalServiceUtil
								.fetchByF_NotificationtemplateByType(groupId, type);

						JSONObject payLoad = JSONFactoryUtil.createJSONObject();

						payLoad.put("toName", payLoadData.get("toName") );
						payLoad.put("toAddress", payLoadData.get("toAddress"));
						payLoad.put("subject", payLoadData.get("subject"));
						payLoad.put("body", payLoadData.get("body") );
						
//								StringUtil.replace(notificationtemplate.getEmailBody(),
//										new String[] { "[$USERNAME$]", "[$USEREMAIL$]", "[$PASSWORD$]", "[$PASSWORD_CODE$]", "[$USERSTATUS$]" },
//										new String[] { payLoadData.getString("USERNAME"),
//												payLoadData.getString("toName"),
//												payLoadData.getString("PASSWORD"),
//												payLoadData.getString("PASSWORD_CODE"),
//												payLoadData.getString("USERSTATUS") }));

						SendMailUtils.sendEmailNotification(payLoad, serviceContext);

						try {
							NotificationQueueLocalServiceUtil.deleteNotificationQueue(
									notificationQueue.getNotificationQueueId(), serviceContext);
						} catch (NoSuchNotificationQueueException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}

					}

				}

			} catch (JSONException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}

		}

	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:66,代码来源:SchedulerUtilProcessing.java

示例9: mapperUsersPermissionsList

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static List<JobposPermissionModel> mapperUsersPermissionsList(String[] listPermissions, long userId,
		ServiceContext serviceContext) {
	
	serviceContext.setUserId(userId);
	
	List<JobposPermissionModel> results = new ArrayList<>();
	
	BackendAuthImpl authImpl = new BackendAuthImpl();
	
	try {
		
		JobposPermissionModel ett = null;

		for (String actionKey : listPermissions) {
			ett = new JobposPermissionModel();

			ett.setActionId(actionKey);
			ett.setActionName(LanguageUtil.get(locale, actionKey));

			boolean selected = authImpl.userHasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER, actionKey);
					
			
			ett.setSelected(selected);

			results.add(ett);
		}

	} catch (Exception e) {
		_log.error(e);
	}

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

示例10: mapperJobposPermissionsList

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static List<JobposPermissionModel> mapperJobposPermissionsList(String[] listPermissions, long userId, long jobPposId,
			ServiceContext serviceContext) {
		
		serviceContext.setUserId(userId);
		
		List<JobposPermissionModel> results = new ArrayList<>();

		BackendAuthImpl authImpl = new BackendAuthImpl();

		try {
			
			JobPos jobPos = JobPosLocalServiceUtil.fetchJobPos(jobPposId);
			
			JobposPermissionModel ett = null;

			for (String actionKey : listPermissions) {
				ett = new JobposPermissionModel();

				ett.setActionId(actionKey);
				ett.setActionName(LanguageUtil.get(locale, actionKey));

				long mappingRoleId = Validator.isNotNull(jobPos)?jobPos.getMappingRoleId():0;
				
				boolean selected = ResourcePermissionLocalServiceUtil.hasResourcePermission(
						serviceContext.getCompanyId(), ModelNameKeys.WORKINGUNIT_MGT_CENTER,
						ResourceConstants.SCOPE_INDIVIDUAL,
						String.valueOf(mappingRoleId), mappingRoleId,
						actionKey);
						
//						authImpl.userHasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER,
//						actionKey);
				
				ett.setSelected(selected);

				results.add(ett);
			}

		} catch (Exception e) {
			_log.error(e);
		}

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


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