merged from feature/user-service

This commit is contained in:
Marcin Jedyński 2018-08-26 17:01:38 +02:00
commit 5b2dfff4dd
8 changed files with 414 additions and 10 deletions

73
.gitignore vendored
View File

@ -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

View File

@ -25,7 +25,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -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;
}
}

View File

@ -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<Result> 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<Result> getResults() {
return results;
}
public void setResults(List<Result> 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;
}
}

View File

@ -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<String> blacklist = null;
@SerializedName("whitelist")
@Expose
private List<String> 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<String> getBlacklist() {
return blacklist;
}
public void setBlacklist(List<String> blacklist) {
this.blacklist = blacklist;
}
public List<String> getWhitelist() {
return whitelist;
}
public void setWhitelist(List<String> 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;
}
}

View File

@ -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<List<User>> getAllUsers();
@POST("api/users")
Call<ResponseBody> createUser(@Body User user);
@GET("api/users/page/{pageNum}")
Call<PagedResult> getPagedUsers(@Path("pageNum") String pageNum );
@GET("/api/users/tutors/page/{pageNum}")
Call<PagedResult> getPagedTutors(@Path("pageNum") String pageNum);
@GET("/api/users/students/page/{pageNum}")
Call<PagedResult> getPagedStudents(@Path("pageNum") String pageNum);
@GET("api/users/{id}")
Call<User> getUserByID(@Path("id") String userID);
@PUT("api/users/{id}")
Call<User> updateUserByID(@Path("id") String userID, @Body User user);
@DELETE("api/users/{id}")
Call<User> deleteUserByID(@Path("id") String userID);
@GET("api/users/userLogin/{ldapLogin}")
Call<String> getUserLdapLogin(@Path("ldapLogin") String ldapLogin);
@PUT("api/users/setActive/{userID}")
Call<User> setUserActive(@Path("userID") String userID);
@PUT("api/users/setInActive/{userID}")
Call<User> setUserInActive(@Path("userID") String userID);
@GET("api/users/blacklist/{tutorID}")
Call<List<User>> getTutorBlacklistedByID(@Path("tutorID") String tutorID);
@PUT("api/users/blacklist/{tutorID}")
Call<User> setTutorBlacklist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing);
@POST("api/users/blacklist/{tutorID}")
Call<ResponseBody> addStudentToBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
@DELETE("api/users/blacklist/{tutorID}")
Call<List<User>> removeStudentFromBlacklist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
@GET("api/users/whitelist/{tutorID}")
Call<List<User>> getTutorwhitelistedByID(@Path("tutorID") String tutorID);
@PUT("api/users/whitelist/{tutorID}")
Call<User> setTutorWhitelist(@Path("tutorID") String tutorID, @Body IsUsingListBool isUsing);
@POST("api/users/whitelist/{tutorID}")
Call<ResponseBody> addStudentTowhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
@DELETE("api/users/whitelist/{tutorID}")
Call<List<User>> removeStudentFromWhitelist(@Path("tutorID") String tutorID, @Body StudentIdModel student);
}

View File

@ -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