diff --git a/.gitignore b/.gitignore index 5edb4ee..0c1fdca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,67 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ *.iml -.gradle -/local.properties -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -.DS_Store -/build -/captures +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/caches +.idea/vcs.xml +.idea/workspace.xml +.idea/modules.xml +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later .externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 0349eb7..065fdfe 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/misc.xml b/.idea/misc.xml index c0f68ed..99202cc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java new file mode 100644 index 0000000..e11d6ac --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/IsUsingListBool.java @@ -0,0 +1,20 @@ +package com.uam.wmi.findmytutor.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class IsUsingListBool { + + @SerializedName("isUsing") + @Expose + private Boolean isUsing; + + public Boolean getIsUsing() { + return isUsing; + } + + public void setIsUsing(Boolean isUsing) { + this.isUsing = isUsing; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java new file mode 100644 index 0000000..9e7ad33 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/PagedResult.java @@ -0,0 +1,87 @@ +package com.uam.wmi.findmytutor.model; + +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class PagedResult { + + @SerializedName("results") + @Expose + private List results = null; + @SerializedName("currentPage") + @Expose + private Integer currentPage; + @SerializedName("pageCount") + @Expose + private Integer pageCount; + @SerializedName("pageSize") + @Expose + private Integer pageSize; + @SerializedName("rowCount") + @Expose + private Integer rowCount; + @SerializedName("firstRowOnPage") + @Expose + private Integer firstRowOnPage; + @SerializedName("lastRowOnPage") + @Expose + private Integer lastRowOnPage; + + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + public Integer getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(Integer currentPage) { + this.currentPage = currentPage; + } + + public Integer getPageCount() { + return pageCount; + } + + public void setPageCount(Integer pageCount) { + this.pageCount = pageCount; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Integer getRowCount() { + return rowCount; + } + + public void setRowCount(Integer rowCount) { + this.rowCount = rowCount; + } + + public Integer getFirstRowOnPage() { + return firstRowOnPage; + } + + public void setFirstRowOnPage(Integer firstRowOnPage) { + this.firstRowOnPage = firstRowOnPage; + } + + public Integer getLastRowOnPage() { + return lastRowOnPage; + } + + public void setLastRowOnPage(Integer lastRowOnPage) { + this.lastRowOnPage = lastRowOnPage; + } + +} diff --git a/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java b/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java new file mode 100644 index 0000000..6fc4336 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/model/Result.java @@ -0,0 +1,163 @@ +package com.uam.wmi.findmytutor.model; +import java.util.List; +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Result { + + @SerializedName("id") + @Expose + private String id; + @SerializedName("isOnline") + @Expose + private Boolean isOnline; + @SerializedName("isUsingBlacklist") + @Expose + private Boolean isUsingBlacklist; + @SerializedName("isUsingWhitelist") + @Expose + private Boolean isUsingWhitelist; + @SerializedName("blacklist") + @Expose + private List blacklist = null; + @SerializedName("whitelist") + @Expose + private List whitelist = null; + @SerializedName("ldapLogin") + @Expose + private String ldapLogin; + @SerializedName("title") + @Expose + private String title; + @SerializedName("firstName") + @Expose + private String firstName; + @SerializedName("lastName") + @Expose + private String lastName; + @SerializedName("department") + @Expose + private String department; + @SerializedName("userName") + @Expose + private String userName; + @SerializedName("email") + @Expose + private String email; + @SerializedName("isActive") + @Expose + private Boolean isActive; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Boolean getIsOnline() { + return isOnline; + } + + public void setIsOnline(Boolean isOnline) { + this.isOnline = isOnline; + } + + public Boolean getIsUsingBlacklist() { + return isUsingBlacklist; + } + + public void setIsUsingBlacklist(Boolean isUsingBlacklist) { + this.isUsingBlacklist = isUsingBlacklist; + } + + public Boolean getIsUsingWhitelist() { + return isUsingWhitelist; + } + + public void setIsUsingWhitelist(Boolean isUsingWhitelist) { + this.isUsingWhitelist = isUsingWhitelist; + } + + public List getBlacklist() { + return blacklist; + } + + public void setBlacklist(List blacklist) { + this.blacklist = blacklist; + } + + public List getWhitelist() { + return whitelist; + } + + public void setWhitelist(List whitelist) { + this.whitelist = whitelist; + } + + public String getLdapLogin() { + return ldapLogin; + } + + public void setLdapLogin(String ldapLogin) { + this.ldapLogin = ldapLogin; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Boolean getIsActive() { + return isActive; + } + + public void setIsActive(Boolean isActive) { + this.isActive = isActive; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java b/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java new file mode 100644 index 0000000..0df22c1 --- /dev/null +++ b/app/src/main/java/com/uam/wmi/findmytutor/service/UserService.java @@ -0,0 +1,77 @@ +package com.uam.wmi.findmytutor.service; +import com.uam.wmi.findmytutor.model.JwtToken; +import com.uam.wmi.findmytutor.model.PagedResult; +import com.uam.wmi.findmytutor.model.User; +import com.uam.wmi.findmytutor.model.IsUsingListBool; +import com.uam.wmi.findmytutor.model.StudentIdModel; +import java.util.List; + +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.PUT; +import retrofit2.http.POST; +import retrofit2.http.Path; +import retrofit2.http.Header; + + +public interface UserService { + @GET("api/users") + Call> getAllUsers(); + + @POST("api/users") + Call createUser(@Body User user); + + @GET("api/users/page/{pageNum}") + Call getPagedUsers(@Path("pageNum") String pageNum ); + + @GET("/api/users/tutors/page/{pageNum}") + Call getPagedTutors(@Path("pageNum") String pageNum); + + @GET("/api/users/students/page/{pageNum}") + Call getPagedStudents(@Path("pageNum") String pageNum); + + @GET("api/users/{id}") + Call getUserByID(@Path("id") String userID); + + @PUT("api/users/{id}") + Call updateUserByID(@Path("id") String userID, @Body User user); + + @DELETE("api/users/{id}") + Call deleteUserByID(@Path("id") String userID); + + @GET("api/users/userLogin/{ldapLogin}") + Call getUserLdapLogin(@Path("ldapLogin") String ldapLogin); + + @PUT("api/users/setActive/{userID}") + Call setUserActive(@Path("userID") String userID); + + @PUT("api/users/setInActive/{userID}") + Call setUserInActive(@Path("userID") String userID); + + @GET("api/users/blacklist/{tutorID}") + Call> getTutorBlacklistedByID(@Path("tutorID") String tutorID); + + @PUT("api/users/blacklist/{tutorID}") + Call setTutorBlacklist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing); + + @POST("api/users/blacklist/{tutorID}") + Call addStudentToBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @DELETE("api/users/blacklist/{tutorID}") + Call> removeStudentFromBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @GET("api/users/whitelist/{tutorID}") + Call> getTutorwhitelistedByID(@Path("tutorID") String tutorID); + + @PUT("api/users/whitelist/{tutorID}") + Call setTutorWhitelist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing); + + @POST("api/users/whitelist/{tutorID}") + Call addStudentTowhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student); + + @DELETE("api/users/whitelist/{tutorID}") + Call> removeStudentFromWhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student); +} diff --git a/build.gradle b/build.gradle index 1a3d812..077cb2f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.2' + classpath 'com.android.tools.build:gradle:3.1.4' // NOTE: Do not place your application dependencies here; they belong