本文整理汇总了Java中com.liferay.portal.kernel.service.ServiceContext.setCompanyId方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext.setCompanyId方法的具体用法?Java ServiceContext.setCompanyId怎么用?Java ServiceContext.setCompanyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.service.ServiceContext
的用法示例。
在下文中一共展示了ServiceContext.setCompanyId方法的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);
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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());
}
示例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();
}
}
示例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();
}
}
}
示例9: doReceive
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
protected void doReceive(Message message) throws Exception {
Company company = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
List<NotificationQueue> queues = NotificationQueueLocalServiceUtil.getNotificationQueues(QueryUtil.ALL_POS,
QueryUtil.ALL_POS);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(company.getCompanyId());
for (NotificationQueue queue : queues) {
JSONObject jsonPayload = JSONFactoryUtil.createJSONObject(queue.getPayload());
SendMailUtils.sendEmailNotification(jsonPayload, serviceContext);
NotificationQueueLocalServiceUtil.deleteNotificationQueue(queue);
}
}
示例10: onAfterRemove
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
@Override
public void onAfterRemove(DictItem model) throws ModelListenerException {
super.onAfterRemove(model);
_log.info("onAfterRemove DictItem" + model);
try {
long dictItemId = model.getDictItemId();
List<DictItemGroup> listGroups = DictItemGroupLocalServiceUtil.findByF_dictItemId(model.getGroupId(),
dictItemId);
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(model.getCompanyId());
for (DictItemGroup dictItemGroup : listGroups) {
DictItemGroupLocalServiceUtil.deleteDictItemGroupNoneAuthen(dictItemGroup.getDictGroupId(),
serviceContext);
}
} catch (Exception e) {
_log.error(e);
}
}