public static ims.core.configuration.domain.objects.AppUser extractAppUser( ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.AppUserVo valueObject, HashMap domMap) { if (null == valueObject) { return null; } Integer id = valueObject.getID_AppUser(); ims.core.configuration.domain.objects.AppUser domainObject = null; if (null == id) { if (domMap.get(valueObject) != null) { return (ims.core.configuration.domain.objects.AppUser) domMap.get(valueObject); } // ims.admin.vo.AppUserVo ID_AppUser field is unknown domainObject = new ims.core.configuration.domain.objects.AppUser(); domMap.put(valueObject, domainObject); } else { String key = (valueObject.getClass().getName() + "__" + valueObject.getID_AppUser()); if (domMap.get(key) != null) { return (ims.core.configuration.domain.objects.AppUser) domMap.get(key); } domainObject = (ims.core.configuration.domain.objects.AppUser) domainFactory.getDomainObject( ims.core.configuration.domain.objects.AppUser.class, id); // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception, // but maybe should be handled as that further up. if (domainObject == null) return null; domMap.put(key, domainObject); } domainObject.setVersion(valueObject.getVersion_AppUser()); domainObject.setRoles( ims.admin.vo.domain.AppRoleShortVoAssembler.extractAppRoleSet( domainFactory, valueObject.getRoles(), domainObject.getRoles(), domMap)); domainObject.setMos( ims.core.vo.domain.MemberOfStaffShortVoAssembler.extractMemberOfStaff( domainFactory, valueObject.getMos(), domMap)); domainObject.setPreviousPasswords( ims.admin.vo.domain.AppUserPasswordVoAssembler.extractAppUserPasswordList( domainFactory, valueObject.getPreviousPasswords(), domainObject.getPreviousPasswords(), domMap)); domainObject.setEmailAccount( ims.admin.vo.domain.UserEmailAccountVoAssembler.extractUserEmailAccount( domainFactory, valueObject.getEmailAccount(), domMap)); domainObject.setUseExternalAuthentication(valueObject.getUseExternalAuthentication()); domainObject.setNotificationDetails( ims.admin.vo.domain.UserNotificationDetailsVoAssembler.extractUserNotificationDetails( domainFactory, valueObject.getNotificationDetails(), domMap)); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getSecretKey() != null && valueObject.getSecretKey().equals("")) { valueObject.setSecretKey(null); } domainObject.setSecretKey(valueObject.getSecretKey()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getSdsUserId() != null && valueObject.getSdsUserId().equals("")) { valueObject.setSdsUserId(null); } domainObject.setSdsUserId(valueObject.getSdsUserId()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getUsername() != null && valueObject.getUsername().equals("")) { valueObject.setUsername(null); } domainObject.setUsername(valueObject.getUsername()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getPassword() != null && valueObject.getPassword().equals("")) { valueObject.setPassword(null); } domainObject.setPassword(valueObject.getPassword()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getEncodedPassword() != null && valueObject.getEncodedPassword().equals("")) { valueObject.setEncodedPassword(null); } domainObject.setEncodedPassword(valueObject.getEncodedPassword()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getTheme() != null && valueObject.getTheme().equals("")) { valueObject.setTheme(null); } domainObject.setTheme(valueObject.getTheme()); ims.framework.utils.DateTime dateTime13 = valueObject.getPwdExpDate(); java.util.Date value13 = null; if (dateTime13 != null) { value13 = dateTime13.getJavaDate(); } domainObject.setPwdExpDate(value13); ims.framework.utils.DateTime dateTime14 = valueObject.getEffectiveFrom(); java.util.Date value14 = null; if (dateTime14 != null) { value14 = dateTime14.getJavaDate(); } domainObject.setEffectiveFrom(value14); ims.framework.utils.DateTime dateTime15 = valueObject.getEffectiveTo(); java.util.Date value15 = null; if (dateTime15 != null) { value15 = dateTime15.getJavaDate(); } domainObject.setEffectiveTo(value15); domainObject.setIsActive(valueObject.getIsActive()); domainObject.setDebugMode(valueObject.getDebugMode()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getLDAPUsername() != null && valueObject.getLDAPUsername().equals("")) { valueObject.setLDAPUsername(null); } domainObject.setLDAPUsername(valueObject.getLDAPUsername()); // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty // string correctly // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them // consistent at least. if (valueObject.getLDAPPassword() != null && valueObject.getLDAPPassword().equals("")) { valueObject.setLDAPPassword(null); } domainObject.setLDAPPassword(valueObject.getLDAPPassword()); domainObject.setLocked(valueObject.getLocked()); return domainObject; }
/** * Update the ValueObject with the Domain Object. * * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.core.configuration.domain.objects.AppUser */ public static ims.admin.vo.AppUserVo insert( DomainObjectMap map, ims.admin.vo.AppUserVo valueObject, ims.core.configuration.domain.objects.AppUser domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_AppUser(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); // If this is a recordedInError record, and the domainObject // value isIncludeRecord has not been set, then we return null and // not the value object if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; // If this is not a recordedInError record, and the domainObject // value isIncludeRecord has been set, then we return null and // not the value object if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; // Roles valueObject.setRoles( ims.admin.vo.domain.AppRoleShortVoAssembler.createAppRoleShortVoCollectionFromAppRole( map, domainObject.getRoles())); // mos valueObject.setMos( ims.core.vo.domain.MemberOfStaffShortVoAssembler.create(map, domainObject.getMos())); // PreviousPasswords valueObject.setPreviousPasswords( ims.admin.vo.domain.AppUserPasswordVoAssembler .createAppUserPasswordVoCollectionFromAppUserPassword( map, domainObject.getPreviousPasswords())); // EmailAccount valueObject.setEmailAccount( ims.admin.vo.domain.UserEmailAccountVoAssembler.create( map, domainObject.getEmailAccount())); // UseExternalAuthentication valueObject.setUseExternalAuthentication(domainObject.isUseExternalAuthentication()); // NotificationDetails valueObject.setNotificationDetails( ims.admin.vo.domain.UserNotificationDetailsVoAssembler.create( map, domainObject.getNotificationDetails())); // SecretKey valueObject.setSecretKey(domainObject.getSecretKey()); // sdsUserId valueObject.setSdsUserId(domainObject.getSdsUserId()); // Username valueObject.setUsername(domainObject.getUsername()); // Password valueObject.setPassword(domainObject.getPassword()); // EncodedPassword valueObject.setEncodedPassword(domainObject.getEncodedPassword()); // Theme valueObject.setTheme(domainObject.getTheme()); // PwdExpDate java.util.Date PwdExpDate = domainObject.getPwdExpDate(); if (null != PwdExpDate) { valueObject.setPwdExpDate(new ims.framework.utils.DateTime(PwdExpDate)); } // EffectiveFrom java.util.Date EffectiveFrom = domainObject.getEffectiveFrom(); if (null != EffectiveFrom) { valueObject.setEffectiveFrom(new ims.framework.utils.DateTime(EffectiveFrom)); } // EffectiveTo java.util.Date EffectiveTo = domainObject.getEffectiveTo(); if (null != EffectiveTo) { valueObject.setEffectiveTo(new ims.framework.utils.DateTime(EffectiveTo)); } // IsActive valueObject.setIsActive(domainObject.isIsActive()); // DebugMode valueObject.setDebugMode(domainObject.isDebugMode()); // LDAPUsername valueObject.setLDAPUsername(domainObject.getLDAPUsername()); // LDAPPassword valueObject.setLDAPPassword(domainObject.getLDAPPassword()); // Locked valueObject.setLocked(domainObject.isLocked()); return valueObject; }