Java Code Examples for ims.core.configuration.domain.objects.AppUser

The following are top voted examples for showing how to use ims.core.configuration.domain.objects.AppUser. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: DailyPatientProgressDlgImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
	if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
		throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

	DomainFactory factory = getDomainFactory();
	AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
	return AppUserVoAssembler.create(doAppUser);
}
 
Example 2
Project: AvoinApotti   File: SMSSenderProvider.java   Source Code and License 5 votes vote down vote up
private String getUserDeliveryAddress(INotification notification)
{
	AppUser doUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, notification.getINotificationUserId());
	if(doUser == null || doUser.getNotificationDetails() == null)
		return null;
	return doUser.getNotificationDetails().getMobilePhone();
}
 
Example 3
Project: AvoinApotti   File: NotificationsImpl.java   Source Code and License 5 votes vote down vote up
public LoggedInUserInfoWebServiceVo getLoggedInUserInfo() 
{
	if(this.getLoggedInUser() == null)
		throw new CodingRuntimeException("Unable to get the logged user.");
	
	DomainFactory factory = getDomainFactory();
	return LoggedInUserInfoWebServiceVoAssembler.create((AppUser)factory.getDomainObject(AppUser.class, this.getLoggedInUser().getUserId()));
}
 
Example 4
Project: AvoinApotti   File: AssignADTWardAndSpecialtyDialogImpl.java   Source Code and License 5 votes vote down vote up
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
	if (hasWardChanged == null)
		throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
	if (emergency == null)
		throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
	if (!emergency.isValidated())
		throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

	//WDEV-10421
	DomainFactory factory = getDomainFactory();
	PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
	if(hasWardChanged)
	{
		AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
		doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
		doAllocWardHist.setAllocatedWardDateTime(new Date());		
		if(getLoggedInUser() != null)
			doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));
	
		doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
	}		
	
	factory.save(doPendingEmergency);
	
	//wdev-16866
	if( tracking != null )
	{
		Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
		factory.save(doTracking);		
	}
	//------------
}
 
Example 5
Project: AvoinApotti   File: CcoContextSetter.java   Source Code and License 5 votes vote down vote up
public void setLoggedInRsno(int userId) 
{
	DomainFactory factory = this.getDomainFactory();
	AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
	AppUserVo appuserVo = AppUserVoAssembler.create(appusr);
	
	String rsnoId = "";
	
	if (appuserVo.getMosIsNotNull())
	{
		if (appuserVo.getMos().getCodeMappingsIsNotNull())
		{
			for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
			{
				TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);					
				if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
				{
					rsnoId = taxmapVo.getTaxonomyCode();
					break;
				}
			}
			
			CcoContextReader.setLoggedInRsno(rsnoId, ctx);
			
		}
		
	}
}
 
Example 6
Project: AvoinApotti   File: UserProvider.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
	String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
	List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
	if (list.size() == 0)
		return null;
	
	return AppUserVoAssembler.create((AppUser)list.get(0));
}
 
Example 7
Project: AvoinApotti   File: ExternalAuthUserProvider.java   Source Code and License 5 votes vote down vote up
public IAppUser getAppUser(int id)
{
	if(id <= 0)
		return null;
	
	AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
	return AppUserVoAssembler.create(domUser); 
}
 
Example 8
Project: AvoinApotti   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void replicateUserToDtoServer(AppUser user) throws DTODomainInterfaceException
{
	if (user.getUsername() == null || user.getUsername().length() == 0)
		throw new DomainRuntimeException("Username cannot be empty");
	
	App_users userRec = (App_users)getDTOInstance(App_users.class);
	userRec.Filter.clear();
	userRec.Filter.Uname = user.getUsername();
	userRec.Filter.User_id = user.getId() + "";
	
	Result res = userRec.get();
	if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
	{
		throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
	}

	if (res != null && res.getId() == DtoErrorCode.NO_DATA_FOUND)
	{
		userRec.DataCollection.add();
		copyUserToDto(userRec, user);
		res = userRec.insert();
		if (res != null && res.getId() < 0 )
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
	else
	{
		copyUserToDto(userRec, user);
		res = userRec.update();
		if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
}
 
Example 9
Project: AvoinApotti   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToDto(App_users userRec, AppUser user)
{
	App_usersRecord rec = userRec.DataCollection.get(0);
	
	if (user.getId() != null)
		rec.User_id = user.getId() + "";
	rec.Uname = user.getUsername();		
	rec.Upass = user.getPassword();
	rec.Dbname = "imsuser";
	rec.Dbpass = "welcome";
	if (user.getSystemInformation().getCreationDateTime() != null)			
	{
		rec.Rdat = new Date(user.getSystemInformation().getCreationDateTime()).toString(DateFormat.ISO);
		rec.Rtim = new DateTime(user.getSystemInformation().getCreationDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Rusr = getUserId(user.getSystemInformation().getCreationUser());

	if (user.getSystemInformation().getLastUpdateDateTime() != null)
	{
		rec.Udat = new Date(user.getSystemInformation().getLastUpdateDateTime()).toString(DateFormat.ISO);
		rec.Utim = new DateTime(user.getSystemInformation().getLastUpdateDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Uusr = getUserId(user.getSystemInformation().getLastUpdateUser());
	rec.Comment = "Replicated from Maxims Web Application";
	
	if (user.getEffectiveFrom() != null)
		rec.Effr = new Date(user.getEffectiveFrom()).toString(DateFormat.ISO);	
	else
		rec.Effr = new Date().toString(DateFormat.ISO);
	if (user.getEffectiveTo() != null)
		rec.Efft = new Date(user.getEffectiveTo()).toString(DateFormat.ISO);			
	if (user.getPwdExpDate() != null)
		rec.Passwd_exp = new Date(user.getPwdExpDate()).toString(DateFormat.ISO);			
	if (user.isIsActive() != null && user.isIsActive().booleanValue() == false)
		rec.Active = "I";
	else
		rec.Active = "A";		
}
 
Example 10
Project: AvoinApotti   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToHeartsDto(User userRec, AppUser user, IAppRoleLight role)
{
	UserRecord rec = userRec.DataCollection.get(0);

	rec.User = user.getUsername();	
	
	if(user.getEncodedPassword() != null)
		rec.Pass = Configuration.decryptPasswordWithCloak(user.getEncodedPassword());
	
	rec.Hpcd = "NA";
	rec.Maxims="Y";
	// If this user has been assigned the administrator role, set opt = SUPER - admin in Hearts
	if (role != null)
		rec.Opt="SUPER";
}
 
Example 11
Project: AvoinApotti   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private String getUserId(String userName)
{
	if (userName == null)
		return "";
	
	AppUser createUser = AppUser.getAppUserFromUsername(this.getDomainFactory(), userName);
	if (createUser == null)
		return "";
		
	return createUser.getId().toString();
}
 
Example 12
Project: AvoinApotti   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
	IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
	imsc.equal("id", appUser.getID_AppUser());
	List users = imsc.find();
	if (users.size()>0)
	{
		AppUser user= (AppUser) users.get(0);
		return UserEmailAccountVoAssembler.create(user.getEmailAccount());
	}
	else
		return null;
}
 
Example 13
Project: AvoinApotti   File: LDAPLoginImpl.java   Source Code and License 5 votes vote down vote up
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
	DomainFactory factory = getDomainFactory();
	
	AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
	domUser.setLDAPUsername(username);
	domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));
	
	factory.save(domUser);
	AppUserVo fullUser = AppUserVoAssembler.create(domUser);
	user = fullUser;
	factory.getDomainSession().setUser(user);		
	
	return user;
}
 
Example 14
Project: AvoinApotti   File: SystemJobsImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUsersShort(AppUserShortVo voRef) 
{
	if (voRef == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	AppUser domAppUser = (AppUser)factory.getDomainObject(AppUser.class, voRef.getID_AppUser()); 
	
	return AppUserShortVoAssembler.create(domAppUser);
}
 
Example 15
Project: AvoinApotti   File: RulesEditorComponentImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUserShortVo(AppUserRefVo refVo)
{
	if (refVo == null)
		throw new RuntimeException("Cannot get AppUserShortVo for null AppUserShortRefVo");

	AppUser doAppUser = (AppUser) getDomainFactory().getDomainObject(AppUser.class, refVo.getID_AppUser());
	return AppUserShortVoAssembler.create(doAppUser);		
}
 
Example 16
Project: AvoinApotti   File: PathwayConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 17
Project: AvoinApotti   File: EventConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 18
Project: openMAXIMS   File: DailyPatientProgressDlgImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
	if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
		throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

	DomainFactory factory = getDomainFactory();
	AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
	return AppUserVoAssembler.create(doAppUser);
}
 
Example 19
Project: openMAXIMS   File: SMSSenderProvider.java   Source Code and License 5 votes vote down vote up
private String getUserDeliveryAddress(INotification notification)
{
	AppUser doUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, notification.getINotificationUserId());
	if(doUser == null || doUser.getNotificationDetails() == null)
		return null;
	return doUser.getNotificationDetails().getMobilePhone();
}
 
Example 20
Project: openMAXIMS   File: PdsDomainHelperImpl.java   Source Code and License 5 votes vote down vote up
@Override
public AppUserNotificationVo getAppUserById(AppUserRefVo user)
{
	if(user == null)
		throw new CodingRuntimeException("The user param is null in getAppUserById() function call !");
	
	return AppUserNotificationVoAssembler.create((AppUser) getDomainFactory().getDomainObject(user));
}
 
Example 21
Project: openMAXIMS   File: NotificationsImpl.java   Source Code and License 5 votes vote down vote up
public LoggedInUserInfoWebServiceVo getLoggedInUserInfo() 
{
	if(this.getLoggedInUser() == null)
		throw new CodingRuntimeException("Unable to get the logged user.");
	
	DomainFactory factory = getDomainFactory();
	return LoggedInUserInfoWebServiceVoAssembler.create((AppUser)factory.getDomainObject(AppUser.class, this.getLoggedInUser().getUserId()));
}
 
Example 22
Project: openMAXIMS   File: PDSPatientSearchImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo getAppUser(AppUserRefVo appUserRef) 
{
	if (appUserRef != null)
	{	
	 AppUser user = (AppUser) getDomainFactory().getDomainObject(AppUser.class,appUserRef.getID_AppUser());
		AppUserVo voUser = AppUserVoAssembler.create(user);
		return voUser;
		
	}
	return null;
}
 
Example 23
Project: openMAXIMS   File: AssignADTWardAndSpecialtyDialogImpl.java   Source Code and License 5 votes vote down vote up
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
	if (hasWardChanged == null)
		throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
	if (emergency == null)
		throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
	if (!emergency.isValidated())
		throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

	//WDEV-10421
	DomainFactory factory = getDomainFactory();
	PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
	if(hasWardChanged)
	{
		AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
		doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
		doAllocWardHist.setAllocatedWardDateTime(new Date());		
		if(getLoggedInUser() != null)
			doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));
	
		doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
	}		
	
	factory.save(doPendingEmergency);
	
	//wdev-16866
	if( tracking != null )
	{
		Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
		factory.save(doTracking);		
	}
	//------------
}
 
Example 24
Project: openMAXIMS   File: ContextSetter.java   Source Code and License 5 votes vote down vote up
public void setLoggedInRsno(int userId) 
{
	DomainFactory factory = this.getDomainFactory();
	AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
	AppUserVo appuserVo = AppUserVoAssembler.create(appusr);
	
	String rsnoId = "";
	
	if (appuserVo.getMosIsNotNull())
	{
		if (appuserVo.getMos().getCodeMappingsIsNotNull())
		{
			for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
			{
				TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);					
				if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
				{
					rsnoId = taxmapVo.getTaxonomyCode();
					break;
				}
			}
			
			ContextReader.setLoggedInRsno(rsnoId, ctx);
			
		}
		
	}
}
 
Example 25
Project: openMAXIMS   File: CcoContextSetter.java   Source Code and License 5 votes vote down vote up
public void setLoggedInRsno(int userId) 
{
	DomainFactory factory = this.getDomainFactory();
	AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
	AppUserVo appuserVo = AppUserVoAssembler.create(appusr);
	
	String rsnoId = "";
	
	if (appuserVo.getMosIsNotNull())
	{
		if (appuserVo.getMos().getCodeMappingsIsNotNull())
		{
			for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
			{
				TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);					
				if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
				{
					rsnoId = taxmapVo.getTaxonomyCode();
					break;
				}
			}
			
			CcoContextReader.setLoggedInRsno(rsnoId, ctx);
			
		}
		
	}
}
 
Example 26
Project: openMAXIMS   File: UserProvider.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
	String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
	List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
	if (list.size() == 0)
		return null;
	
	return AppUserVoAssembler.create((AppUser)list.get(0));
}
 
Example 27
Project: openMAXIMS   File: UserProvider.java   Source Code and License 5 votes vote down vote up
public IAppUser lockAccount(IAppUser user, boolean value) throws Exception 
{
	DomainFactory factory = getDomainFactory();
	AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
	domUser.setLocked(Boolean.valueOf(value));
					
	factory.save(domUser);
	
	AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
	user = fulluser;	
	
	return user;
}
 
Example 28
Project: openMAXIMS   File: ExternalAuthUserProvider.java   Source Code and License 5 votes vote down vote up
public IAppUser getAppUser(int id)
{
	if(id <= 0)
		return null;
	
	AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
	return AppUserVoAssembler.create(domUser); 
}
 
Example 29
Project: openMAXIMS   File: ExternalAuthUserProvider.java   Source Code and License 5 votes vote down vote up
public IAppUser lockAccount(IAppUser user, boolean value) throws Exception 
{
	DomainFactory factory = getDomainFactory();
	AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
	domUser.setLocked(Boolean.valueOf(value));
					
	factory.save(domUser);
	
	AppUserVo fulluser = AppUserVoAssembler.create(domUser); 
	user = fulluser;	
	
	return user;
}
 
Example 30
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo updateAppUser(AppUserVo appUser) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	AppUser domUser = AppUserVoAssembler.extractAppUser(factory, appUser);
	factory.save(domUser);
	return AppUserVoAssembler.create(domUser);
}
 
Example 31
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void replicateUserToDtoServer(AppUser user) throws DTODomainInterfaceException
{
	if (user.getUsername() == null || user.getUsername().length() == 0)
		throw new DomainRuntimeException("Username cannot be empty");
	
	App_users userRec = (App_users)getDTOInstance(App_users.class);
	userRec.Filter.clear();
	userRec.Filter.Uname = user.getUsername();
	userRec.Filter.User_id = user.getId() + "";
	
	Result res = userRec.get();
	if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
	{
		throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
	}

	if (res != null && res.getId() == DtoErrorCode.NO_DATA_FOUND)
	{
		userRec.DataCollection.add();
		copyUserToDto(userRec, user);
		res = userRec.insert();
		if (res != null && res.getId() < 0 )
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
	else
	{
		copyUserToDto(userRec, user);
		res = userRec.update();
		if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
}
 
Example 32
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToDto(App_users userRec, AppUser user)
{
	App_usersRecord rec = userRec.DataCollection.get(0);
	
	if (user.getId() != null)
		rec.User_id = user.getId() + "";
	rec.Uname = user.getUsername();		
	rec.Upass = user.getPassword();
	rec.Dbname = "imsuser";
	rec.Dbpass = "welcome";
	if (user.getSystemInformation().getCreationDateTime() != null)			
	{
		rec.Rdat = new Date(user.getSystemInformation().getCreationDateTime()).toString(DateFormat.ISO);
		rec.Rtim = new DateTime(user.getSystemInformation().getCreationDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Rusr = getUserId(user.getSystemInformation().getCreationUser());

	if (user.getSystemInformation().getLastUpdateDateTime() != null)
	{
		rec.Udat = new Date(user.getSystemInformation().getLastUpdateDateTime()).toString(DateFormat.ISO);
		rec.Utim = new DateTime(user.getSystemInformation().getLastUpdateDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Uusr = getUserId(user.getSystemInformation().getLastUpdateUser());
	rec.Comment = "Replicated from Maxims Web Application";
	
	if (user.getEffectiveFrom() != null)
		rec.Effr = new Date(user.getEffectiveFrom()).toString(DateFormat.ISO);	
	else
		rec.Effr = new Date().toString(DateFormat.ISO);
	if (user.getEffectiveTo() != null)
		rec.Efft = new Date(user.getEffectiveTo()).toString(DateFormat.ISO);			
	if (user.getPwdExpDate() != null)
		rec.Passwd_exp = new Date(user.getPwdExpDate()).toString(DateFormat.ISO);			
	if (user.isIsActive() != null && user.isIsActive().booleanValue() == false)
		rec.Active = "I";
	else
		rec.Active = "A";		
}
 
Example 33
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToHeartsDto(User userRec, AppUser user, IAppRoleLight role)
{
	UserRecord rec = userRec.DataCollection.get(0);

	rec.User = user.getUsername();	
	
	if(user.getEncodedPassword() != null)
		rec.Pass = Configuration.decryptPasswordWithCloak(user.getEncodedPassword());
	
	rec.Hpcd = "NA";
	rec.Maxims="Y";
	// If this user has been assigned the administrator role, set opt = SUPER - admin in Hearts
	if (role != null)
		rec.Opt="SUPER";
}
 
Example 34
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private String getUserId(String userName)
{
	if (userName == null)
		return "";
	
	AppUser createUser = AppUser.getAppUserFromUsername(this.getDomainFactory(), userName);
	if (createUser == null)
		return "";
		
	return createUser.getId().toString();
}
 
Example 35
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
	IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
	imsc.equal("id", appUser.getID_AppUser());
	List users = imsc.find();
	if (users.size()>0)
	{
		AppUser user= (AppUser) users.get(0);
		return UserEmailAccountVoAssembler.create(user.getEmailAccount());
	}
	else
		return null;
}
 
Example 36
Project: openMAXIMS   File: LDAPLoginImpl.java   Source Code and License 5 votes vote down vote up
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
	DomainFactory factory = getDomainFactory();
	
	AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
	domUser.setLDAPUsername(username);
	domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));
	
	factory.save(domUser);
	AppUserVo fullUser = AppUserVoAssembler.create(domUser);
	user = fullUser;
	factory.getDomainSession().setUser(user);		
	
	return user;
}
 
Example 37
Project: openMAXIMS   File: PatientSearchConfigurationImpl.java   Source Code and License 5 votes vote down vote up
@Override
public AppUserShortVo getApptUserShort(AppUserRefVo userId) 
{
	if (userId != null)
	{	
	 AppUser user = (AppUser) getDomainFactory().getDomainObject(AppUser.class,userId.getID_AppUser());
		return AppUserShortVoAssembler.create(user);
	}
	return null;
}
 
Example 38
Project: openMAXIMS   File: SystemJobsImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUsersShort(AppUserShortVo voRef) 
{
	if (voRef == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	AppUser domAppUser = (AppUser)factory.getDomainObject(AppUser.class, voRef.getID_AppUser()); 
	
	return AppUserShortVoAssembler.create(domAppUser);
}
 
Example 39
Project: openMAXIMS   File: RulesEditorComponentImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUserShortVo(AppUserRefVo refVo)
{
	if (refVo == null)
		throw new RuntimeException("Cannot get AppUserShortVo for null AppUserShortRefVo");

	AppUser doAppUser = (AppUser) getDomainFactory().getDomainObject(AppUser.class, refVo.getID_AppUser());
	return AppUserShortVoAssembler.create(doAppUser);		
}
 
Example 40
Project: openMAXIMS   File: PathwayConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 41
Project: openMAXIMS   File: EventConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 42
Project: openMAXIMS   File: DailyPatientProgressDlgImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
	if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
		throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

	DomainFactory factory = getDomainFactory();
	AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
	return AppUserVoAssembler.create(doAppUser);
}
 
Example 43
Project: openMAXIMS   File: SMSSenderProvider.java   Source Code and License 5 votes vote down vote up
private String getUserDeliveryAddress(INotification notification)
{
	AppUser doUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, notification.getINotificationUserId());
	if(doUser == null || doUser.getNotificationDetails() == null)
		return null;
	return doUser.getNotificationDetails().getMobilePhone();
}
 
Example 44
Project: openMAXIMS   File: NotificationsImpl.java   Source Code and License 5 votes vote down vote up
public LoggedInUserInfoWebServiceVo getLoggedInUserInfo() 
{
	if(this.getLoggedInUser() == null)
		throw new CodingRuntimeException("Unable to get the logged user.");
	
	DomainFactory factory = getDomainFactory();
	return LoggedInUserInfoWebServiceVoAssembler.create((AppUser)factory.getDomainObject(AppUser.class, this.getLoggedInUser().getUserId()));
}
 
Example 45
Project: openMAXIMS   File: AssignADTWardAndSpecialtyDialogImpl.java   Source Code and License 5 votes vote down vote up
/**
* savePendingEmergency
*/
public void savePendingEmergency(ims.core.vo.PendingEmergencyAdmissionLiteVo emergency, Boolean hasWardChanged,TrackingForADTWardAndSpecialtyDialogVo tracking) throws ims.domain.exceptions.StaleObjectException
{
	if (hasWardChanged == null)
		throw new CodingRuntimeException("hasWardChanged cannot be null in method savePendingEmergency");
	if (emergency == null)
		throw new CodingRuntimeException("emergency is null in method savePendingEmergency");
	if (!emergency.isValidated())
		throw new CodingRuntimeException("emergency has not been validated in method savePendingEmergency");

	//WDEV-10421
	DomainFactory factory = getDomainFactory();
	PendingEmergencyAdmission doPendingEmergency = PendingEmergencyAdmissionLiteVoAssembler.extractPendingEmergencyAdmission(factory, emergency);
	if(hasWardChanged)
	{
		AllocatedWardHistory doAllocWardHist = new AllocatedWardHistory();
		doAllocWardHist.setAllocatedWard(doPendingEmergency.getAllocatedWard());
		doAllocWardHist.setAllocatedWardDateTime(new Date());		
		if(getLoggedInUser() != null)
			doAllocWardHist.setAllocatingUser((AppUser) getDomainFactory().getDomainObject((AppUserRefVo) getLoggedInUser()));
	
		doPendingEmergency.getAllocatedWardHistory().add(doAllocWardHist);
	}		
	
	factory.save(doPendingEmergency);
	
	//wdev-16866
	if( tracking != null )
	{
		Tracking doTracking =  TrackingForADTWardAndSpecialtyDialogVoAssembler.extractTracking(factory, tracking);
		factory.save(doTracking);		
	}
	//------------
}
 
Example 46
Project: openMAXIMS   File: CcoContextSetter.java   Source Code and License 5 votes vote down vote up
public void setLoggedInRsno(int userId) 
{
	DomainFactory factory = this.getDomainFactory();
	AppUser appusr = (AppUser)factory.getDomainObject(AppUser.class, userId);
	AppUserVo appuserVo = AppUserVoAssembler.create(appusr);
	
	String rsnoId = "";
	
	if (appuserVo.getMosIsNotNull())
	{
		if (appuserVo.getMos().getCodeMappingsIsNotNull())
		{
			for (int i=0; i < appuserVo.getMos().getCodeMappings().size();i++)
			{
				TaxonomyMap taxmapVo = appuserVo.getMos().getCodeMappings().get(i);					
				if (taxmapVo.getTaxonomyNameIsNotNull() && taxmapVo.getTaxonomyName().equals(TaxonomyType.PAS))
				{
					rsnoId = taxmapVo.getTaxonomyCode();
					break;
				}
			}
			
			CcoContextReader.setLoggedInRsno(rsnoId, ctx);
			
		}
		
	}
}
 
Example 47
Project: openMAXIMS   File: UserProvider.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public IAppUser getAppUser(String username, String password) throws Exception
{
	String hql = "from AppUser user where user.username=:username and user.password=:password and user.isActive is true";
	List list = getDomainFactory().find(hql, new String[] { "username", "password" }, new Object[] { username, Configuration.getHash(password) } );
	if (list.size() == 0)
		return null;
	
	return AppUserVoAssembler.create((AppUser)list.get(0));
}
 
Example 48
Project: openMAXIMS   File: ExternalAuthUserProvider.java   Source Code and License 5 votes vote down vote up
public IAppUser getAppUser(int id)
{
	if(id <= 0)
		return null;
	
	AppUser domUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, id);
	return AppUserVoAssembler.create(domUser); 
}
 
Example 49
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void replicateUserToDtoServer(AppUser user) throws DTODomainInterfaceException
{
	if (user.getUsername() == null || user.getUsername().length() == 0)
		throw new DomainRuntimeException("Username cannot be empty");
	
	App_users userRec = (App_users)getDTOInstance(App_users.class);
	userRec.Filter.clear();
	userRec.Filter.Uname = user.getUsername();
	userRec.Filter.User_id = user.getId() + "";
	
	Result res = userRec.get();
	if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
	{
		throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
	}

	if (res != null && res.getId() == DtoErrorCode.NO_DATA_FOUND)
	{
		userRec.DataCollection.add();
		copyUserToDto(userRec, user);
		res = userRec.insert();
		if (res != null && res.getId() < 0 )
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
	else
	{
		copyUserToDto(userRec, user);
		res = userRec.update();
		if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND)
		{
			throw new DTODomainInterfaceException(res.getId(), "Error occurred replicating user to DTO server." + res.getMessage());
		}
	}
}
 
Example 50
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToDto(App_users userRec, AppUser user)
{
	App_usersRecord rec = userRec.DataCollection.get(0);
	
	if (user.getId() != null)
		rec.User_id = user.getId() + "";
	rec.Uname = user.getUsername();		
	rec.Upass = user.getPassword();
	rec.Dbname = "imsuser";
	rec.Dbpass = "welcome";
	if (user.getSystemInformation().getCreationDateTime() != null)			
	{
		rec.Rdat = new Date(user.getSystemInformation().getCreationDateTime()).toString(DateFormat.ISO);
		rec.Rtim = new DateTime(user.getSystemInformation().getCreationDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Rusr = getUserId(user.getSystemInformation().getCreationUser());

	if (user.getSystemInformation().getLastUpdateDateTime() != null)
	{
		rec.Udat = new Date(user.getSystemInformation().getLastUpdateDateTime()).toString(DateFormat.ISO);
		rec.Utim = new DateTime(user.getSystemInformation().getLastUpdateDateTime()).getTime().toString(TimeFormat.FLAT6);
	}
	rec.Uusr = getUserId(user.getSystemInformation().getLastUpdateUser());
	rec.Comment = "Replicated from Maxims Web Application";
	
	if (user.getEffectiveFrom() != null)
		rec.Effr = new Date(user.getEffectiveFrom()).toString(DateFormat.ISO);	
	else
		rec.Effr = new Date().toString(DateFormat.ISO);
	if (user.getEffectiveTo() != null)
		rec.Efft = new Date(user.getEffectiveTo()).toString(DateFormat.ISO);			
	if (user.getPwdExpDate() != null)
		rec.Passwd_exp = new Date(user.getPwdExpDate()).toString(DateFormat.ISO);			
	if (user.isIsActive() != null && user.isIsActive().booleanValue() == false)
		rec.Active = "I";
	else
		rec.Active = "A";		
}
 
Example 51
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private void copyUserToHeartsDto(User userRec, AppUser user, IAppRoleLight role)
{
	UserRecord rec = userRec.DataCollection.get(0);

	rec.User = user.getUsername();	
	
	if(user.getEncodedPassword() != null)
		rec.Pass = Configuration.decryptPasswordWithCloak(user.getEncodedPassword());
	
	rec.Hpcd = "NA";
	rec.Maxims="Y";
	// If this user has been assigned the administrator role, set opt = SUPER - admin in Hearts
	if (role != null)
		rec.Opt="SUPER";
}
 
Example 52
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
private String getUserId(String userName)
{
	if (userName == null)
		return "";
	
	AppUser createUser = AppUser.getAppUserFromUsername(this.getDomainFactory(), userName);
	if (createUser == null)
		return "";
		
	return createUser.getId().toString();
}
 
Example 53
Project: openMAXIMS   File: ApplicationUsersImpl.java   Source Code and License 5 votes vote down vote up
public UserEmailAccountVo getEmailData(AppUserRefVo appUser) 
{
	IMSCriteria imsc=new IMSCriteria (AppUser.class,getDomainFactory());
	imsc.equal("id", appUser.getID_AppUser());
	List users = imsc.find();
	if (users.size()>0)
	{
		AppUser user= (AppUser) users.get(0);
		return UserEmailAccountVoAssembler.create(user.getEmailAccount());
	}
	else
		return null;
}
 
Example 54
Project: openMAXIMS   File: LDAPLoginImpl.java   Source Code and License 5 votes vote down vote up
public IAppUser saveLDAPCredentials(IAppUser user, String username, String password) throws StaleObjectException 
{
	DomainFactory factory = getDomainFactory();
	
	AppUser domUser = (AppUser)factory.getDomainObject(AppUser.class, user.getUserId());
	domUser.setLDAPUsername(username);
	domUser.setLDAPPassword(Configuration.encryptPasswordWithCloak(password));
	
	factory.save(domUser);
	AppUserVo fullUser = AppUserVoAssembler.create(domUser);
	user = fullUser;
	factory.getDomainSession().setUser(user);		
	
	return user;
}
 
Example 55
Project: openMAXIMS   File: SystemJobsImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUsersShort(AppUserShortVo voRef) 
{
	if (voRef == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	AppUser domAppUser = (AppUser)factory.getDomainObject(AppUser.class, voRef.getID_AppUser()); 
	
	return AppUserShortVoAssembler.create(domAppUser);
}
 
Example 56
Project: openMAXIMS   File: RulesEditorComponentImpl.java   Source Code and License 5 votes vote down vote up
public AppUserShortVo getAppUserShortVo(AppUserRefVo refVo)
{
	if (refVo == null)
		throw new RuntimeException("Cannot get AppUserShortVo for null AppUserShortRefVo");

	AppUser doAppUser = (AppUser) getDomainFactory().getDomainObject(AppUser.class, refVo.getID_AppUser());
	return AppUserShortVoAssembler.create(doAppUser);		
}
 
Example 57
Project: openMAXIMS   File: PathwayConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 58
Project: openMAXIMS   File: EventConfigurationImpl.java   Source Code and License 5 votes vote down vote up
private AppUser getUser()
{
	if(getMosUser() != null)
	{
		AppUserRefVo user = ((ims.core.vo.MemberOfStaffShortVo)getMosUser()).getAppUser();
		return (AppUser) getDomainFactory().getDomainObject(user);
	}
	return null;
}
 
Example 59
Project: openmaxims-linux   File: DailyPatientProgressDlgImpl.java   Source Code and License 5 votes vote down vote up
public AppUserVo getAppUser(AppUserRefVo appUserRefVo)
{
	if (appUserRefVo == null || appUserRefVo.getID_AppUserIsNotNull())
		throw new CodingRuntimeException("Cannot get AppUserVo for null AppUserRefVo");

	DomainFactory factory = getDomainFactory();
	AppUser doAppUser = (AppUser) factory.getDomainObject(AppUser.class, appUserRefVo.getID_AppUser().intValue());
	return AppUserVoAssembler.create(doAppUser);
}
 
Example 60
Project: openmaxims-linux   File: SMSSenderProvider.java   Source Code and License 5 votes vote down vote up
private String getUserDeliveryAddress(INotification notification)
{
	AppUser doUser = (AppUser)getDomainFactory().getDomainObject(AppUser.class, notification.getINotificationUserId());
	if(doUser == null || doUser.getNotificationDetails() == null)
		return null;
	return doUser.getNotificationDetails().getMobilePhone();
}