Deuce1058 / yardi

backup of exlipse projects
0 stars 0 forks source link

com.yardi.QSECOFR.EditUserProfileService needs another User_Profile entity #126

Closed Deuce1058 closed 1 year ago

Deuce1058 commented 1 year ago

When the changes for the Login* classes were promoted EditUserProfileServices broke because the entity it used, com.yardi.ejb.User_Profile, had access to all the columns but it was changed to only use columns necessary for login. User_Profile entity is also in a relationship with three other entities. The original User_Profile is backed up.

ENTITIES

com.yardi.ejb.model.Full_User_Profile

  1. new entity containing all columns of user profile
  2. Restore the original User_Profile and rename
  3. Correct path/class name in logging statements
  4. Add a constructor that accepts all fields

com.yardi.ejb.model.User_Groups2

  1. New entity used to persist a new USER_GROUPS database table
  2. Copy com.yardi.ejb.model.User_Groups
  3. This entity should not be in a relationship. Strip out @ManyToOne @JoinColumn annotations
  4. Add a constructor that accepts user ID and group ID

com.yardi.ejb.model.Full_Sessions_Table

  1. New entity that is not in a relationship like com.yardi.ejb.model.Sessions_Table
  2. Add a constructor that accepts user ID, session ID, session token and most recent request.
  3. Strip out @OneToMany annotation

POJO

com.yardi.shared.rentSurvey.YardiConstants

  1. New constant public static final int DEFAULT_USER_GROUP = 11

com.yardi.QSECOFR.EditUserProfileRequest

  1. POJO representation of web request with methods for manipulating data for presentation purposes
  2. move to com.yardi.shared.QSECOFR
  3. add logging to all setters
  4. add method inzBirthDate() to initialize birthDate to the value of dob in the web request converted to the correct type
  5. add method inzEditRequest() to initialize shorts, dates, and timestamps to the values from the web request converted to the correct type
  6. add method inzPasswordAttempts() to initialize passwordAttempts to the value of pwdAttempts in the web request converted to the correct type
  7. add method inzPasswordExpirationDate() to initialize passwordExpirationDate to the value of pwdExpDate in the web request converted to the correct type
  8. add method inzProfileDisabledDate() to initialize profileDisabledDate to the value of disabledDate in the web request converted to the correct type
  9. add method inztLastLoginDate() to initialize lastLoginDate to the value of lastLogin in the web request converted to the correct type
  10. add method inzUpHomeMarket() to initialize upHomeMarket to the value of homeMarket converted to the correct type

com.yardi.QSECOFR.MonthNameAbbr.java

  1. move to com.yardi.shared.QSECOFR.MonthNameAbbr.java
  2. change path name in audit statements

SERVLET

com.yardi.QSECOFR.EditUserProfileService

doGet()

  1. store a UserGroupsBean reference in the session
  2. Replace lookup on UserProfileBean with EditUserProfileCTRLBean
  3. Delete method commit. The transaction has been pushed to a new controller bean
  4. Push special initialization logic to com.yardi.shared.QSECOFR.EditUserProfileRequest. This class is a java representation of the web request and should be responsible for initializing itself
  5. Push logic to initialize shorts, dates and timestamps in the web request to com.yardi.shared.QSECOFR.EditUserProfileRequest. This class is a java representation of the web request and should be responsible for initializing itself
  6. Push find logic to a controller bean. The servlet should not handle this detail
  7. Push add logic to a controller bean. The servlet should not handle this detail
  8. Push delete logic to a controller bean. The servlet should not handle this detail

remove() get the bean from the session, set the session attribute to null and call removeBean()

readBuffer() New method to read the request from the input stream.

mapRequest() New method to map the web request in JSON to a java representation for ease of use

INTERFACES

com.yardi.ejb.EditUserProfileCTRL

New interface that exposes methods clients can use to edit the user profile

com.yardi.ejb.UserProfile

  1. Expose Full_User_Profile findFullUserProfile(string userName)
  2. Expose Full_User_Profile merge(Full_User_Profile userProfile)
  3. Expose persist(Full_User_Profile userProfile)
  4. Expose remove(Full_User_Profile userProfile)

com.yardi.ejb.UserGroups

  1. Expose Vector find2(String userName)
  2. Expose void persist(User_Groups2 group)
  3. Expose void remove(User_Groups2 group

com.yardi.ejb.SessionTable

  1. Expose Vector findFull_Sessions_Table(String userID)
  2. Expose void remove(Full_Sessions_Table sessionsTable)

EJB

EditUserProfileCTRLBean

New controller bean for editing user profiles. Much of the logic that was previously handled by the servlet EditUserProfieService has ben pushed to methods in this bean.

com.yardi.ejb.UserProfileBean

  1. import com.yardi.ejb.model.Full_User_Profile
  2. New method public Full_User_Profile findFullUserProfile(string userName)
  3. New method private boolen isEntity(Class<?>) determine if given instance is an entity
  4. New method private boolean isManaged(Full_User_Profile userProfile)
  5. isManaged() methods need to test for a null entity and whether the instance is an entity
  6. New method public Full_User_Profile merge(Full_User_Profile userProfile)
  7. New method public void persist(Full_User_Profile)
  8. Use persistence in persist() method
  9. New method public void remove(String userName) Also remove from USER_GROUPS and UNIQUE_TOKENS
  10. Copy the code from project backupYardiEJB com.yardi.ejb.UserProfileBean.find()
  11. Copy the code from project backupYardiEJB com.yardi.ejb.UserProfileBean.persist()

com.yardi.ejb.UserGroupsBean

  1. New method public Vector find2(String userName)
  2. New method private boolean isEntity(Class<?>) determine if given instance is an entity
  3. New method private boolean isManaged(User_Groups2)
  4. isManaged() methods need to test for a null entity and whether the instance is an entity
  5. New method public void persist(User_Groups2 group)
  6. New method public void remove(User_Groups2 group)

com.yardi.ejb.SessionsTableBean

  1. New method public Full_Sessions_Table findFull_Sessions_Table(String userID)
  2. New method private boolean isEntity(Class<?>) determine if given instance is an entity
  3. New method private boolean isManaged(Full_Sessions_Table sessionsTable)
  4. isManaged() methods need to test for a null entity and whether the instance is an entity
  5. New method public void remove(Full_Sessions_Table sessionsTable)

com.yardi.ejb.UniqueTokensBean

  1. New method private boolean isEntity(Class<?>) determine if given instance is an entity
  2. New method isJoined()
  3. New method isManaged()
  4. isManaged() methods need to test for a null entity and whether the instance is an entity

HTML

default_group.html

Display this page when the user is in the default group. Users in the default group have not been assigned to a group yet