本文整理汇总了Java中com.liferay.portal.service.UserLocalServiceUtil.getUser方法的典型用法代码示例。如果您正苦于以下问题:Java UserLocalServiceUtil.getUser方法的具体用法?Java UserLocalServiceUtil.getUser怎么用?Java UserLocalServiceUtil.getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.service.UserLocalServiceUtil
的用法示例。
在下文中一共展示了UserLocalServiceUtil.getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setParameterIntoResponse
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private void setParameterIntoResponse(ActionResponse response,
Employee employee) throws PortalException, SystemException {
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAPPINGUSERID,String.valueOf(employee.getMappingUserId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.WORKINGUNITID,String.valueOf(employee.getWorkingUnitId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAINJOBPOSID,String.valueOf(employee.getMainJobPosId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMPLOYEENO,String.valueOf(employee.getEmployeeNo()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.PERSONELDOCNO,String.valueOf(employee.getPersonelDocNo()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.FULLNAME,String.valueOf(employee.getFullName()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.GENDER,String.valueOf(employee.getGender()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.BIRTHDATE,String.valueOf(employee.getBirthdate()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.OFFICETEL,String.valueOf(employee.getOfficeTel()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.HOMETEL,String.valueOf(employee.getHomeTel()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MOBILE,String.valueOf(employee.getMobile()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMAIL,String.valueOf(employee.getEmail()));
if (employee.getMappingUserId() > 0){
User user = UserLocalServiceUtil.getUser(employee.getMappingUserId());
response.setRenderParameter(EmployeeKeys.AddEditAttributes.SCREENNAME,String.valueOf(user.getScreenName()));
//response.setRenderParameter(EmployeeKeys.AddEditAttributes.PASSWORD,String.valueOf(user.getPassword()));
//response.setRenderParameter(EmployeeKeys.AddEditAttributes.REPASSWORD,String.valueOf(user.get()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(1));
}else {
response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(0));
}
}
示例2: criaContribuicao
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
/**
* Cria uma nova contribuição para o artigo especificado
*
* @param userId
* @param artigoId
* @param textoArtigo
* @param descricao
* @throws SystemException
* @throws PortalException
*/
@Override
public void criaContribuicao(long userId, long artigoId,
String textoArtigo, String descricao) throws SystemException, PortalException {
User user = UserLocalServiceUtil.getUser(userId);
Artigo artigo = ArtigoLocalServiceUtil.getArtigo(artigoId);
Contribuicao contrib = createContribuicao(counterLocalService.increment());
contrib.setUserId(userId);
contrib.setUserName(user.getFullName());
contrib.setArtigoId(artigo.getArtigoId());
contrib.setData(new Date());
contrib.setTexto(textoArtigo);
contrib.setDescricao(descricao);
updateContribuicao(contrib, true);
}
示例3: getActiveUser
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public static User getActiveUser() {
User user = null;
FacesContext liferayFacesContext = FacesContext.getCurrentInstance();
PortletRequest request = liferayFacesContext != null ? (PortletRequest) liferayFacesContext.getExternalContext().getRequest() : null;
String remoteUser = request != null ? request.getRemoteUser() : null;
if (StringUtil.isNotEmpty(remoteUser)) {
try {
user = UserLocalServiceUtil.getUser(Long.parseLong(remoteUser));
} catch (Exception e) {
logger.error(e);
}
}
return user;
}
示例4: addAppMessage
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
/**
* Thêm mới một thông điệp gửi tới người dùng
*
* Version: OEP 2.0
*
* History:
* DATE AUTHOR DESCRIPTION
* -------------------------------------------------
* 21-September-2015 trungdk Tạo mới
* @param fromApplication mã của ứng dụng
* @param toUser người dùng nhận thông báo
* @param messageType kiểu thông điệp
* @param messageCode mã thông báo
* @param messageText thông điệp
* @param messageValue giá trị thông điệp
* @param messageUrl địa chỉ URL gửi thông điệp
* @param visitDate ngày người dùng xem thông điệp chung
* @param serviceContext ngữ cảnh dịch vụ
* @return: thông điệp tới người dùng mới được thêm vào
*/
@Indexable(type = IndexableType.REINDEX)
public AppMessage addAppMessage(
long userId,
String fromApplication,
Date createDate,
String toUser,
String messageType,
String messageCode,
String messageText,
String messageValue,
String messageUrl) throws SystemException, PortalException {
long id = counterLocalService.increment();
AppMessage appMessage = appMessagePersistence.create(id);
User user = UserLocalServiceUtil.getUser(userId);
appMessage.setCompanyId(user.getCompanyId());
appMessage.setGroupId(user.getGroupId());
appMessage.setUserId(userId);
appMessage.setCreateDate(createDate);
appMessage.setFromApplication(fromApplication);
appMessage.setToUser(toUser);
appMessage.setMessageType(messageType);
appMessage.setMessageCode(messageCode);
appMessage.setMessageText(messageText);
appMessage.setMessageValue(messageValue);
appMessage.setMessageUrl(messageUrl);
appMessagePersistence.update(appMessage);
if (_log.isInfoEnabled()) {
_log.info("Create new app message " + id);
}
return getAppMessage(id);
}
示例5: testLdap
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void testLdap(ActionRequest request, ActionResponse response) throws Exception{
ManagerLdap tg = new ManagerLdap();
User user = UserLocalServiceUtil.getUser(30115);
ServiceContext serviceContext = ServiceContextThreadLocal
.getServiceContext();
//tg.ExportToLdap(serviceContext, user);//(serviceContext,user);
// tg.look();
if (!SessionErrors.isEmpty(request)) {
response.sendRedirect(ParamUtil.getString(request,
PortletKeys.REDIRECT_PAGE));
} else {
PortalUtil.copyRequestParameters(request, response);
}
}
示例6: deleteURL
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void deleteURL(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
long actId = ParamUtil.getInteger(actionRequest, "resId");
long userId = ParamUtil.getInteger(actionRequest, "userId");
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
if(log.isDebugEnabled()){
log.debug(actId);
log.debug(userId);
}
LearningActivity la = LearningActivityLocalServiceUtil.getLearningActivity(actId);
User user = UserLocalServiceUtil.getUser(userId);
if(la!=null&&user!=null){
Message message=new Message();
message.put("learningActivity",la);
message.put("user",user);
message.put("userc",themeDisplay.getUser());
message.setResponseId("1111");
//message.setResponseDestinationName("liferay/lms/cleanTriesUser");
//MessageBusUtil.sendMessage("liferay/lms/cleanTriesUser", message);
log.debug("Learning Activity: "+la.getTitle(themeDisplay.getLocale()));
log.debug("User "+user.getScreenName());
String resultado = (String)MessageBusUtil.sendSynchronousMessage("liferay/lms/cleanTriesUser", message);
log.debug("Result "+resultado);
}
actionResponse.setRenderParameter("resId", String.valueOf(actId));
actionResponse.setRenderParameter("userId", String.valueOf(userId));
actionResponse.setRenderParameter("califications", String.valueOf(true));
}
示例7: editInscriptionDates
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void editInscriptionDates(ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception
{
long courseId = ParamUtil.getLong(actionRequest, "courseId", 0);
long userId = ParamUtil.getLong(actionRequest, "userId", 0);
User user = UserLocalServiceUtil.getUser(userId);
Course course = CourseLocalServiceUtil.getCourse(courseId);
int startMonth = ParamUtil.getInteger(actionRequest, "startMon");
int startYear = ParamUtil.getInteger(actionRequest, "startYear");
int startDay = ParamUtil.getInteger(actionRequest, "startDay");
int stopMonth = ParamUtil.getInteger(actionRequest, "stopMon");
int stopYear = ParamUtil.getInteger(actionRequest, "stopYear");
int stopDay = ParamUtil.getInteger(actionRequest, "stopDay");
boolean startDateEnabled=ParamUtil.getBoolean(actionRequest,"startdate-enabled",false);
boolean stopDateEnabled=ParamUtil.getBoolean(actionRequest,"stopdate-enabled",false);
Date allowStartDate = PortalUtil.getDate(startMonth, startDay, startYear,
0, 0, user.getTimeZone(),
new EntryDisplayDateException());
if(!startDateEnabled)
{
allowStartDate=null;
}
Date allowFinishDate = PortalUtil.getDate(stopMonth, stopDay, stopYear,
0, 0, user.getTimeZone(),
new EntryDisplayDateException());
if(!stopDateEnabled)
{
allowFinishDate=null;
}
CourseServiceUtil.editUserInscriptionDates(courseId,userId,allowStartDate,allowFinishDate);
actionResponse.setRenderParameters(actionRequest.getParameterMap());
}
示例8: addCategoryMessagesAdmin
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private void addCategoryMessagesAdmin(long groupId ,MBCategory categoria, List<DadosForumAdminWrapper> dadosRetorno) throws SystemException, PortalException {
for(MBMessage mensagem : MBMessageUtil.filterFindByG_C(groupId, categoria.getCategoryId())) {
DadosForumAdminWrapper dadosForumAdmin = new DadosForumAdminWrapper();
dadosForumAdmin.setDataCriacao(mensagem.getCreateDate());
if(mensagem.getCategoryId() != 0l){
dadosForumAdmin.setEixo(categoria.getName());
dadosForumAdmin.setIdEixo(categoria.getCategoryId());
dadosForumAdmin.setIdEixoPai(categoria.getParentCategoryId());
}
dadosForumAdmin.setIdFase(categoria.getGroupId());
dadosForumAdmin.setIdMensagem(mensagem.getMessageId());
dadosForumAdmin.setIdMensagemPai(mensagem.getParentMessageId());
dadosForumAdmin.setIdMensagemRaiz(mensagem.getRootMessageId());
dadosForumAdmin.setIdProposta(mensagem.getThreadId());
if(!mensagem.isAnonymous()) {
dadosForumAdmin.setIdUsuario(mensagem.getUserId());
dadosForumAdmin.setUsuario(mensagem.getUserName());
try {
User user = UserLocalServiceUtil.getUser(mensagem.getUserId());
dadosForumAdmin.setEmail(user.getEmailAddress());
dadosForumAdmin.setUf(getUserUF(user));
} catch (NoSuchUserException e){
//Ignore
}
}
dadosForumAdmin.setProposta(MBMessageLocalServiceUtil.getMBMessage(mensagem.getRootMessageId()).getSubject());
dadosForumAdmin.setTextoMensagem(mensagem.getBody());
RatingsStats ratingStats = RatingsStatsLocalServiceUtil.getStats("com.liferay.portlet.messageboards.model.MBMessage", mensagem.getMessageId());
dadosForumAdmin.setPontuacaoAvaliacoes(((Double)ratingStats.getTotalScore()).longValue());
dadosForumAdmin.setTotalAvaliacoes(((Integer)ratingStats.getTotalEntries()).longValue());
dadosRetorno.add(dadosForumAdmin);
}
}
示例9: deleteVoto
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
/**
* Exclui um voto na propsota especificada
*
* @param propostaId
* @param userId
* @throws SystemException
* @throws PortalException
*/
public void deleteVoto(long propostaId, long userId)
throws SystemException, PortalException {
User user = UserLocalServiceUtil.getUser(userId);
if (user.isDefaultUser())
return;
Proposta proposta = propostaLocalService.getProposta(propostaId);
Configuracao config = configuracaoLocalService
.getConfiguracaoPorGrupo(proposta.getGroupId());
if (!config.isVotacaoAberta()) {
throw new VotacaoFechadaException();
}
Voto voto = votoPersistence.fetchByP_U(propostaId, userId);
if (voto == null || voto.getNumeroVotos() <= 0)
return;
voto.setNumeroVotos(voto.getNumeroVotos()-1);
voto.setVotosDisponiveis(voto.getVotosDisponiveis()+1);
voto.setData(new Date());
if (voto.getNumeroVotos() <= 0) {
deleteVoto(voto);
} else {
updateVoto(voto);
}
}
示例10: getUser
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public User getUser() {
if (user == null) {
if (hasUser()) {
try {
user = UserLocalServiceUtil.getUser(getUserId());
} catch (Exception ex) {
logger.error(ex);
}
}
}
return user;
}
示例11: addEditAppRole2Employee
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void addEditAppRole2Employee(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
if (SessionErrors.isEmpty(request)) {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
long appRoleId = ParamUtil.getLong(request, AppRole2JobPosKeys.AddEditAttributes.APPROLE_ID, PortletKeys.LONG_DEFAULT);
long employeeId = ParamUtil.getLong(request, AppRole2EmployeeKeys.AddEditAttributes.EMPLOYEE_ID, PortletKeys.LONG_DEFAULT);
Long editId = ParamUtil.getLong(request, AppRole2EmployeeKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
if (editId == PortletKeys.LONG_DEFAULT) {
Employee employee = EmployeeLocalServiceUtil.getEmployee(employeeId);
AppRole2EmployeeLocalServiceUtil.addAppRole2Employee(appRoleId, employeeId, serviceContext);
AppRole role = AppRoleLocalServiceUtil.getAppRole(appRoleId);
try {
UserSync userSync = UserSyncLocalServiceUtil.findByApplicationEmployee(role.getApplicationId(), employeeId);
String roles = userSync.getRoles();
userSync.setCheckpoint(new Date());
if (!roles.contains(role.getRoleCode())) {
if (roles.equals(""))
roles = role.getRoleCode();
else
roles += "," + role.getRoleCode();
}
else {
}
UserSyncLocalServiceUtil.updateUserSync(userSync);
}
catch (Exception e) {
e.printStackTrace();
User user = UserLocalServiceUtil.getUser(employee.getMappingUserId());
UserSyncLocalServiceUtil.addUserSync(role.getApplicationId(), employeeId, employee.getMappingUserId(), user.getScreenName(), user.getScreenName(), employee.getFullName(), user.getEmailAddress(), user.getPassword(), 1, role.getRoleCode(), new Date(), null);
}
SessionMessages.add(request, AssignRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ASSIGNROLE2EMPLOYEE_SUCCESS_ADDNEW);
} else {
}
}
SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
if (!SessionErrors.isEmpty(request)) {
PortalUtil.copyRequestParameters(request, response);
} else {
response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
}
}
示例12: changePassword
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
public void changePassword(ActionRequest request, ActionResponse response)
throws Exception {
if (SessionErrors.isEmpty(request)) {
ServiceContext serviceContext = ServiceContextThreadLocal
.getServiceContext();
UploadRequest uploadRequest = PortalUtil
.getUploadPortletRequest(request);
Long editId = ParamUtil.getLong(uploadRequest,
EmployeeKeys.AddEditAttributes.EDIT_ID,
PortletKeys.LONG_DEFAULT);
ManagerLdap ld = new ManagerLdap();
if (editId != PortletKeys.LONG_DEFAULT) {
Employee employee = EmployeeLocalServiceUtil.getEmployee(editId);
//System.out.println(" sssss " + fullName + " " + mainJobPosId + " " + workingUnitId + " " + employee.getMappingUserId());
User user = null;
if (employee.getMappingUserId() != PortletKeys.LONG_DEFAULT){
// System.out.println(" Doi mat khau " + employee.getMappingUserId() + password + " " + repassword);
String password = ParamUtil.getString(uploadRequest,EmployeeKeys.AddEditAttributes.PASSWORD, PortletKeys.TEXT_BOX);
String repassword = ParamUtil.getString(uploadRequest,EmployeeKeys.AddEditAttributes.REPASSWORD, PortletKeys.TEXT_BOX);
try{
Date now = new Date();
//UserLocalServiceUtil.upd
//UserLocalServiceUtil.updatePassword(employee.getMappingUserId(), password, repassword, false);
// false, false, serviceContext.getCreateDate(now));
UserLocalServiceUtil.updatePasswordManually(employee.getMappingUserId() , password, true, false, serviceContext.getCreateDate(now));
user = UserLocalServiceUtil.getUser(employee.getMappingUserId());
if (user != null && ld.getIsZimbraLdap(serviceContext.getCompanyId())){
//employee.setMappingUserId(user.getUserId());
ld.changePassord(serviceContext, user,password);
}
} catch (Exception e) {
System.out.println("Loi o day " + e.getMessage());
}
}
}
}
if (!SessionErrors.isEmpty(request)) {
PortalUtil.copyRequestParameters(request, response);
} else {
response.sendRedirect(ParamUtil.getString(request,
PortletKeys.REDIRECT_PAGE));
}
}
示例13: receive
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
public void receive(Message message) {
if(log.isDebugEnabled()){log.debug("P2pCheckActivity::receive:: Entra en la funcion");}
DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivity.class);
Criterion criterion=PropertyFactoryUtil.forName("typeId").eq(3);
dq.add(criterion);
try{
List<LearningActivity> listActivities=
(java.util.List<LearningActivity>)LearningActivityLocalServiceUtil.dynamicQuery(dq);
if(listActivities!=null && listActivities.size()>0)
{
for(LearningActivity lAct:listActivities){
if(CheckP2pMailingLocalServiceUtil.findByActId(lAct.getActId())==null){
//String sNumFilesToPass = lAct.getExtracontent();
String sNumFilesToPass = LearningActivityLocalServiceUtil.getExtraContentValue(lAct.getActId(), "validaciones");
if(sNumFilesToPass.equals(""))
{
sNumFilesToPass="3";
}
long NumFilesToPass = Long.valueOf(sNumFilesToPass)+1;
//Se le suma 1 puesto que tiene que debe haber el numero de actividades
//mas la del usuario puesto que el no se corrige a si mismo.
List<P2pActivity> ListP2PinAct = P2pActivityLocalServiceUtil.findByActIdOrderByP2pId(lAct.getActId());
boolean deregisterMail;
if(ListP2PinAct.size() > NumFilesToPass){
int cont = 0;
for(P2pActivity myp2p:ListP2PinAct){
long userId = myp2p.getUserId();
User user = UserLocalServiceUtil.getUser(userId);
//Comprobamos que la actividad no esta bloqueada para el usuario.
if(!lAct.isLocked(user)){
cont++;
deregisterMail = false;
if(user.getExpandoBridge().getAttribute(LiferaylmsUtil.DEREGISTER_USER_EXPANDO,false)!=null){
deregisterMail = (Boolean)user.getExpandoBridge().getAttribute(LiferaylmsUtil.DEREGISTER_USER_EXPANDO,false);
}
if(!deregisterMail){
sendMail(user, lAct.getActId());
}
if(cont>NumFilesToPass){
CheckP2pMailing cP2pM = new CheckP2pMailingImpl();
cP2pM.setActId(lAct.getActId());
CheckP2pMailingLocalServiceUtil.addCheckP2pMailing(cP2pM);
break;
}
}
}
}
}
}
}
}
catch(Exception e){
if(log.isErrorEnabled()){
log.error(e);
}
}
}
示例14: doGetDocument
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
@Override
protected Document doGetDocument(Object obj) throws Exception {
Course entry = (Course)obj;
AssetEntry asset=AssetEntryLocalServiceUtil.getEntry(Course.class.getName(), entry.getCourseId());
long companyId = entry.getCompanyId();
long groupId = getParentGroupId(entry.getGroupId());
long scopeGroupId = entry.getGroupId();
long userId = entry.getUserId();
User user=UserLocalServiceUtil.getUser(userId);
String userName = user.getFullName();
long entryId = entry.getCourseId();
String title = entry.getTitle();
String content = HtmlUtil.extractText(entry.getDescription());
Date displayDate = asset.getPublishDate();
long[] assetCategoryIds =AssetCategoryLocalServiceUtil.getCategoryIds(Course.class.getName(), entryId);
String[] assetTagNames =AssetTagLocalServiceUtil.getTagNames(Course.class.getName(), entryId);
ExpandoBridge expandoBridge = entry.getExpandoBridge();
Document document = new DocumentImpl();
document.addUID(PORTLET_ID, entryId);
document.addModifiedDate(displayDate);
document.addKeyword(Field.COMPANY_ID, companyId);
document.addKeyword(Field.PORTLET_ID, PORTLET_ID);
document.addKeyword(Field.GROUP_ID, groupId);
document.addKeyword(Field.SCOPE_GROUP_ID, scopeGroupId);
document.addKeyword(Field.USER_ID, userId);
document.addText(Field.USER_NAME, userName);
document.addText(Field.TITLE, title);
document.addText(Field.CONTENT, content);
document.addKeyword(Field.ASSET_CATEGORY_IDS, assetCategoryIds);
document.addKeyword(Field.ASSET_TAG_NAMES, assetTagNames);
document.addKeyword(Field.ENTRY_CLASS_NAME, LearningActivity.class.getName());
document.addKeyword(Field.ENTRY_CLASS_PK, entryId);
ExpandoBridgeIndexerUtil.addAttributes(document, expandoBridge);
return document;
}
示例15: checarSeUsuarioEDeputado
import com.liferay.portal.service.UserLocalServiceUtil; //导入方法依赖的package包/类
private boolean checarSeUsuarioEDeputado(long userId) throws PortalException, SystemException {
User user = UserLocalServiceUtil.getUser(userId);
String email = user.getEmailAddress();
return email.startsWith("dep.") && (email.endsWith("camara.gov.br") || email.endsWith("camara.leg.br"));
}