本文整理汇总了Java中com.liferay.portal.kernel.exception.NoSuchUserException类的典型用法代码示例。如果您正苦于以下问题:Java NoSuchUserException类的具体用法?Java NoSuchUserException怎么用?Java NoSuchUserException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoSuchUserException类属于com.liferay.portal.kernel.exception包,在下文中一共展示了NoSuchUserException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的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;
}
示例2: clone
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public void clone(String className, String classPK, long userId, long companyId, long groupId, String sourcePK,
ServiceContext serviceContext)
throws NotFoundException, UnauthenticationException, UnauthorizationException, NoSuchUserException {
List<ResourceRole> resourceRoles = new ArrayList<>(
ResourceRoleLocalServiceUtil.findByF_className_classPK(groupId, className, classPK));
if(Validator.isNotNull(resourceRoles) && resourceRoles.size() > 0){
//Nothing to do here
} else {
List<ResourceRole> resourceRolesSourcePK = new ArrayList<>(
ResourceRoleLocalServiceUtil.findByF_className_classPK(groupId, className, sourcePK));
for (ResourceRole resourceRole : resourceRolesSourcePK) {
ResourceRoleLocalServiceUtil.addResourceRole(userId, groupId, className, classPK, resourceRole.getRoleId(), serviceContext);
}
}
}
示例3: updateOfficeSitePreferences
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public OfficeSite updateOfficeSitePreferences(long userId, long companyId, long groupId, long id,
String preferences, ServiceContext serviceContext)
throws NoSuchUserException, NotFoundException, UnauthenticationException, UnauthorizationException {
OfficeSite officeSite = OfficeSiteLocalServiceUtil.fetchOfficeSite(id);
if (Validator.isNotNull(preferences)) {
officeSite.setPreferences(preferences);
}
officeSite = OfficeSiteLocalServiceUtil.updateOfficeSite(userId, officeSite.getOfficeSiteId(), officeSite.getName(),
officeSite.getEnName(), officeSite.getGovAgencyCode(), officeSite.getAddress(), officeSite.getTelNo(),
officeSite.getFaxNo(), officeSite.getEmail(), officeSite.getWebsite(), officeSite.getLogoFileEntryId(),
officeSite.getSiteGroupId(), officeSite.getAdminUserId(), officeSite.getPreferences(), serviceContext);
return officeSite;
}
示例4: addDictgroupsDictItems
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
public DictItemGroup addDictgroupsDictItems(long userId, long groupId, String code, String groupCode,
String itemCode, ServiceContext serviceContext) throws NoSuchUserException, UnauthenticationException,
UnauthorizationException, DuplicateCategoryException {
DictItemGroup dictItemGroup = null;
DictCollection dictCollection = DictCollectionLocalServiceUtil.fetchByF_dictCollectionCode(code, groupId);
DictGroup dictGroup = DictGroupLocalServiceUtil.fetchByF_DictGroupCode(groupCode, groupId);
DictItem dictItem = DictItemLocalServiceUtil.fetchByF_dictItemCode(itemCode,
dictCollection.getDictCollectionId(), groupId);
dictItemGroup = DictItemGroupLocalServiceUtil.addDictItemGroup(userId, groupId, dictGroup.getDictGroupId(),
dictItem.getDictItemId(), serviceContext);
return dictItemGroup;
}
示例5: clone
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public void clone(String className, String classPK, long userId, long companyId, long groupId, String sourcePK,
ServiceContext serviceContext)
throws NotFoundException, UnauthenticationException, UnauthorizationException, NoSuchUserException {
List<ResourceUser> resourceUsers = new ArrayList<>(
ResourceUserLocalServiceUtil.findByF_className_classPK(groupId, className, classPK));
if (Validator.isNotNull(resourceUsers) && resourceUsers.size() > 0) {
// Nothing to do here
} else {
List<ResourceUser> resourceUsersSourcePK = new ArrayList<>(
ResourceUserLocalServiceUtil.findByF_className_classPK(groupId, className, sourcePK));
for (ResourceUser resourceUser : resourceUsersSourcePK) {
ResourceUserLocalServiceUtil.addResourceUser(userId, groupId, className, classPK,
resourceUser.getToUserId(), resourceUser.getFullname(), resourceUser.getEmail(),
resourceUser.getReadonly(), serviceContext);
}
}
}
示例6: updatePreferences
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public String updatePreferences(long id, long groupId, String key, String value, ServiceContext serviceContext)
throws NoSuchUserException, NotFoundException, UnauthenticationException, UnauthorizationException, DuplicateCategoryException {
Preferences preferences = PreferencesLocalServiceUtil.fetchByF_userId(groupId, id);
JSONObject jsonObject;
try {
jsonObject = JSONFactoryUtil.createJSONObject(preferences.getPreferences());
jsonObject.put(key, value);
preferences = PreferencesLocalServiceUtil.updatePreferences(id, preferences.getPreferencesId(), jsonObject.toJSONString(), serviceContext);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return preferences.getPreferences();
}
示例7: updateMetaDataByItemCode
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
public DictItem updateMetaDataByItemCode(long userId, long groupId, ServiceContext serviceContext, String code,
String itemCode, String metaData) throws DuplicateCategoryException, UnauthenticationException,
UnauthorizationException, NoSuchUserException, NotFoundException, PortalException {
DictCollection dictCollection = DictCollectionLocalServiceUtil.fetchByF_dictCollectionCode(code, groupId);
DictItem ett = DictItemLocalServiceUtil.fetchByF_dictItemCode(itemCode, dictCollection.getDictCollectionId(),
groupId);
if (Validator.isNotNull(metaData)) {
ett.setMetaData(metaData);
}
DictItem dictItem = DictItemLocalServiceUtil.updateDictItem(userId, ett.getDictItemId(),
ett.getDictCollectionId(), ett.getItemCode(), ett.getItemName(), ett.getItemNameEN(),
ett.getItemDescription(), ett.getParentItemId(), ett.getSibling(), ett.getLevel(), ett.getMetaData(),
serviceContext);
return dictItem;
}
示例8: upload
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public FileAttach upload(long userId, long companyId, long groupId, String className, String classPK,
InputStream inputStream, String fileName, String fileType, long fileSize, String destination, String desc,
ServiceContext serviceContext)
throws NoSuchUserException, UnauthenticationException, UnauthorizationException {
FileAttach fileAttach = null;
try {
FileEntry fileEntry = FileUploadUtils.uploadFile(userId, companyId, groupId, inputStream, fileName,
fileType, fileSize, destination, desc, serviceContext);
long fileEntryId = fileEntry.getFileEntryId();
fileAttach = FileAttachLocalServiceUtil.addFileAttach(userId, groupId, className, classPK, StringPool.BLANK,
StringPool.BLANK, fileEntryId, StringPool.BLANK, StringPool.BLANK, 0, fileName, serviceContext);
} catch (Exception e) {
_log.error(e);
}
return fileAttach;
}
示例9: addDataForm
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
/**
* @author binhth
* @param userId
* @param groupId
* @param code
* ( collectionCode unique )
* @param dataform
* @param serviceContext
* @throws NoSuchUserException,
* NotFoundException, UnauthenticationException,
* UnauthorizationException, DuplicateCategoryException
* @return DictCollection
*/
public DictCollection addDataForm(long userId, long groupId, String code, String dataform,
ServiceContext serviceContext) throws NoSuchUserException, NotFoundException, UnauthenticationException,
UnauthorizationException, DuplicateCategoryException {
DictCollection dictCollection = DictCollectionLocalServiceUtil.fetchByF_dictCollectionCode(code,
groupId);
if (Validator.isNotNull(dataform)) {
dictCollection.setDataForm(dataform);
}
dictCollection = DictCollectionLocalServiceUtil.updateDictCollection(userId,
dictCollection.getDictCollectionId(), dictCollection.getCollectionCode(),
dictCollection.getCollectionName(), dictCollection.getCollectionNameEN(),
dictCollection.getDescription(), dictCollection.getDataForm(), serviceContext);
return dictCollection;
}
示例10: _getUserOptional
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
private Optional<User> _getUserOptional(DLFileEntry dlFileEntry) {
try {
return Optional.ofNullable(
_userService.getUserById(dlFileEntry.getUserId()));
}
catch (NoSuchUserException | PrincipalException e) {
throw new NotFoundException(
"Unable to get user " + dlFileEntry.getUserId(), e);
}
catch (PortalException pe) {
throw new ServerErrorException(500, pe);
}
}
示例11: updateJobPosWork
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Indexable(type = IndexableType.REINDEX)
@Override
public JobPosWork updateJobPosWork(long userId, long jobPosWorkId, long jobPostId, String checklistCat,
ServiceContext serviceContext)
throws UnauthenticationException, UnauthorizationException, NoSuchUserException, NotFoundException {
// authen
BackendAuthImpl authImpl = new BackendAuthImpl();
boolean isAuth = authImpl.isAuth(serviceContext, StringPool.BLANK, StringPool.BLANK);
if (!isAuth) {
throw new UnauthenticationException();
}
boolean hasPermission = authImpl.hasResource(serviceContext, ModelNameKeys.WORKINGUNIT_MGT_CENTER,
ActionKeys.EDIT_DATA);
if (!hasPermission) {
throw new UnauthorizationException();
}
Date now = new Date();
User user = userPersistence.findByPrimaryKey(userId);
JobPosWork jobPosWork = jobPosWorkPersistence.fetchByPrimaryKey(jobPosWorkId);
// Audit fields
jobPosWork.setUserId(user.getUserId());
jobPosWork.setUserName(user.getFullName());
jobPosWork.setModifiedDate(serviceContext.getCreateDate(now));
// Other fields
jobPosWork.setJobPostId(jobPostId);
jobPosWork.setChecklistCat(checklistCat);
jobPosWorkPersistence.update(jobPosWork);
return jobPosWork;
}
示例12: updateEmployeeJobpos
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public EmployeeJobPos updateEmployeeJobpos(
long userId, long companyId, long groupId, long id,
long employeeJobPosId, long workingUnitId, long jobPosId,
Boolean isMain, ServiceContext serviceContext)
throws NoSuchUserException, NotFoundException,
UnauthenticationException, UnauthorizationException,
DuplicateCategoryException, PortalException {
EmployeeJobPos ett = EmployeeJobPosLocalServiceUtil.fetchEmployeeJobPos(
employeeJobPosId);
ett.setWorkingUnitId(workingUnitId);
ett.setJobPostId(jobPosId);
ett = EmployeeJobPosLocalServiceUtil.updateEmployeeJobPos(
userId, ett.getEmployeeJobPosId(), ett.getJobPostId(),
ett.getWorkingUnitId(), serviceContext);
if (isMain) {
Employee employee =
EmployeeLocalServiceUtil.fetchEmployee(ett.getEmployeeId());
employee.setMainJobPostId(jobPosId);
employee = EmployeeLocalServiceUtil.updateEmployee(
userId, employee.getEmployeeId(), employee.getFullName(),
employee.getEmployeeNo(), employee.getGender(),
employee.getBirthdate(), employee.getTelNo(),
employee.getMobile(), employee.getEmail(),
employee.getWorkingStatus(), ett.getEmployeeJobPosId(),
employee.getPhotoFileEntryId(), employee.getMappingUserId(),
employee.getTitle(), employee.getRecruitDate(),
employee.getLeaveDate(), serviceContext);
}
return ett;
}
示例13: _getUserOptional
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
private Optional<User> _getUserOptional(BlogsEntry blogsEntry) {
try {
return Optional.ofNullable(
_userService.getUserById(blogsEntry.getUserId()));
}
catch (NoSuchUserException | PrincipalException e) {
throw new NotFoundException(
"Unable to get user " + blogsEntry.getUserId(), e);
}
catch (PortalException pe) {
throw new ServerErrorException(500, pe);
}
}
示例14: create
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
public ResourceRole create(long userId, long groupId, String className, String classPK, Long roleId,
ServiceContext serviceContext)
throws NoSuchUserException, UnauthenticationException, UnauthorizationException, NotFoundException {
ResourceRole ett = null;
ett = ResourceRoleLocalServiceUtil.addResourceRole(userId, groupId, className, classPK, roleId, serviceContext);
return ett;
}
示例15: create
import com.liferay.portal.kernel.exception.NoSuchUserException; //导入依赖的package包/类
@Override
public OfficeSite create(long userId, long companyId, long groupId, String address, String adminEmail, String email,
String enName, String faxNo, String govAgencyCode, String name, String preferences, String siteGroupId,
String telNo, String website, ServiceContext serviceContext)
throws NoSuchUserException, UnauthenticationException, UnauthorizationException, NumberFormatException {
OfficeSite ett = null;
User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, adminEmail);
ett = OfficeSiteLocalServiceUtil.addOfficeSite(userId, groupId, name, enName, govAgencyCode, address, telNo,
faxNo, email, website, 0, GetterUtil.get(siteGroupId, 0), user.getUserId(), preferences,
serviceContext);
return ett;
}