@Override protected void onImbSearchClick() throws ims.framework.exceptions.PresentationLogicException { if(form.txtUser().getValue() == null || form.txtUser().getValue().equals("")) { engine.showErrors(new String[] {"Name is mandatory"}); return; } form.grdUsers().getRows().clear(); UserDTOVoCollection voCollUser = domain.listUserByName(form.txtUser().getValue()); if(voCollUser != null && voCollUser.size() > 0) { for (int i = 0; i < voCollUser.size(); i++) { UserDTOVo voUser = voCollUser.get(i); grdUsersRow row = form.grdUsers().getRows().newRow(); row.setColName(voUser.getUserName()); row.setValue(voUser); } } else engine.showMessage("No matching records found"); updateControlsState(); }
protected void onGrdAppUsersSelectionChanged() throws PresentationLogicException { form.btnUpdate().setEnabled(true); if (form.grdAppUsers().getValue() != null) { AppUserVo user = domain.getAppUser(form.grdAppUsers().getValue()); form.getGlobalContext().Admin.ApplicationUsers.setSelectedUser(user); // wdev-9034 - External Authentication, get date values from Hearts if(ConfigFlag.DOM.HEARTS_REPLICATE_PATIENTS.getValue() && ConfigFlag.DOM.EXTERNAL_AUTHENTICATION.getValue()) { try { UserDTOVo dtoUser = domain.getDtoAppUserByName(user.getUsername()); if (dtoUser != null) { user.setPwdExpDate(new DateTime(dtoUser.getPasswordExpiryDate())); user.setEffectiveFrom(dtoUser.getEffectiveFrom()); user.setEffectiveTo(dtoUser.getEffectiveTo()); } } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage()); } } form.getLocalContext().setAppUserVo(user); displayRecord(user); form.getContextMenus().getGenericGridUpdateItem().setVisible(true); } updateControlsState(); }
public UserDTOVo getDtoAppUserByName(String name) throws DomainInterfaceException { if (name == null) throw new CodingRuntimeException("name cannot be null in method getDtoAppUserByName"); User user = (User) getDTOInstance(User.class); user.Filter.clear(); user.Filter.User = name; Result res = user.get(); if (res != null && res.getId() != DtoErrorCode.NO_DATA_FOUND) throw new DomainInterfaceException(res.getMessage()); // wdev-9034 if (user.DataCollection == null || user.DataCollection.count() == 0) return null; UserRecord rec = user.DataCollection.get(0); UserDTOVo voUser = new UserDTOVo(); voUser.setUserName(name); try { voUser.setEffectiveFrom( new DateTime(rec.Dateauthfr)); voUser.setEffectiveTo(new DateTime(rec.Dateauthto)); } catch (ParseException e1) { LOG.warn("DateTime Parsing Exception"); } try{voUser.setPasswordExpiryDate(new Date().addDay(Integer.valueOf(rec.Daysleft)));} catch (NumberFormatException e){ LOG.warn("Password Expiry(days left) from PAS is invalid");} return voUser; }
protected void onGrdAppUsersSelectionChanged() throws PresentationLogicException { if (form.grdAppUsers().getValue() != null) { AppUserVo user = domain.getAppUser(form.grdAppUsers().getValue()); form.getGlobalContext().Admin.ApplicationUsers.setSelectedUser(user); // wdev-9034 - External Authentication, get date values from Hearts if(ConfigFlag.DOM.HEARTS_REPLICATE_PATIENTS.getValue() && ConfigFlag.DOM.EXTERNAL_AUTHENTICATION.getValue()) { try { UserDTOVo dtoUser = domain.getDtoAppUserByName(user.getUsername()); if (dtoUser != null) { user.setPwdExpDate(new DateTime(dtoUser.getPasswordExpiryDate())); user.setEffectiveFrom(dtoUser.getEffectiveFrom()); user.setEffectiveTo(dtoUser.getEffectiveTo()); } } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage()); } } form.getLocalContext().setAppUserVo(user); displayRecord(user); form.getContextMenus().getGenericGridUpdateItem().setVisible(true); form.getContextMenus().getGenericGridReplaceItem().setText("Unlock Account"); form.getContextMenus().getGenericGridReplaceItem().setVisible(user.isLocked() ? true: false); } updateControlsState(); }
/** * listUserByName */ public ims.admin.vo.UserDTOVoCollection listUserByName(String name) { if (name == null) throw new CodingRuntimeException("name cannot be null in method listUserByName"); UserDTOVoCollection voCollUsers = new UserDTOVoCollection(); name = name.replaceAll("[^a-zA-Z]", ""); name = name.toUpperCase(); name += "?"; User user = (User) getDTOInstance(User.class); user.Filter.clear(); user.Filter.User = name; user.list(); if(user.DataCollection.count() > 0) { for(int i=0;i<user.DataCollection.count(); i++) { UserRecord rec = user.DataCollection.get(i); UserDTOVo voUser = new UserDTOVo(); voUser.setUserName(rec.User); voCollUsers.add(voUser); } } return voCollUsers; }
private void populateScreenFromPasUser() { if(form.getGlobalContext().Admin.getHeartsUser() == null) throw new CodingRuntimeException("Hearts User is null in method populateScreenFromPasUser"); UserDTOVo voUser = form.getGlobalContext().Admin.getHeartsUser(); try { voUser = domain.getDtoAppUserByName(voUser.getUserName()); } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage()); return; } form.txtUsername().setValue(voUser.getUserName()); if(voUser.getEffectiveFromIsNotNull()) { form.dteEffectiveFrm().setValue(voUser.getEffectiveFrom().getDate()); form.timEffectiveFrm().setValue(voUser.getEffectiveFrom().getTime()); } if(voUser.getEffectiveToIsNotNull()) { form.dteEffectiveTo().setValue(voUser.getEffectiveTo().getDate()); form.timEffectiveTo().setValue(voUser.getEffectiveTo().getTime()); } form.dtePwdExp().setValue(voUser.getPasswordExpiryDate()); // wdev-8744 If password expiry is today, set time to 23:59 if (voUser.getPasswordExpiryDateIsNotNull() && !voUser.getPasswordExpiryDate().getDate().after(new java.util.Date())) { form.timPwdExp().setValue(new Time(23, 59)); } // wdev-8744 If the expiry is in the future, the password is not mandatory if (voUser.getPasswordExpiryDateIsNotNull() && voUser.getPasswordExpiryDate().getDate().after(new java.util.Date())) { form.txtPwd().setRequired(false); form.txtRepeatPwd().setRequired(false); } else { form.txtPwd().setRequired(true); form.txtRepeatPwd().setRequired(true); } form.txtUsername().setValue(voUser.getUserName()); }