PranilDahal / Eagle-Post

Eagle-Post: Social Media Software Project - ACM Cal State LA
11 stars 2 forks source link

OrganizationUserFactory (second half) #21

Open calstatelaacm opened 6 years ago

calstatelaacm commented 6 years ago

Create OrganizationUserFactory.java Look at SsuFactory for an example on how to do this, and what methods to add.

We need the following:

The class must extend IDatabaseFactory with OrganizationUser type and OrgUserPostData type. You will have to create OrgUserPostData.java. The purpose of creating this datahandler class(OrgUserPostData.java) is to have everything declared as string so its easier to send/receive through the controllers. For example, SSU has a java.sql.data field; so we create SsuPostData.java to declare all the fields as string so we can user that class to map the POST data we receive into a SsuPostData object using @RequestBody annotation. (Look at the AddSsu method inside SsuControllers.java).

Just like that, you must create a OrgUserPostData.java where all the fields from OrganizationUser.java is declared as Strings.

Implement all the methods declared by the Interface.

/**
     * @return List<T> of all the T objects in database
     */
    List<T> getAllFromDatabase();

    /**
     * @param id
     * @return one T object with unique id
     */
    T getById(String id);

    /**
     * @param postData
     * @return id of the new object created.
     */
    String insertToDatabase(S postData);