Commit 5ee9eb0b authored by Willard's avatar Willard

Apply formatting to all files, minor refactoring

parent 96d4c693
......@@ -24,6 +24,20 @@ public class AppUtils {
private static Context c;
private static String username = "";
private static String password = "";
private static final Interceptor TOKEN_AUTH_INTERCEPTOR = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
String credentials = username + ":" + password;
final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
Request original = chain.request();
Request.Builder requestBuilder = original.newBuilder()
.header("Authorization", basic)
.header("Accept", "application/json")
.method(original.method(), original.body());
Request request = requestBuilder.build();
return chain.proceed(request);
}
};
private static int userId = -1;
public static void login(String _username, String _password, int _userId) {
......@@ -55,7 +69,7 @@ public class AppUtils {
}
public static boolean isNetworkAvailable(Context c) {
ConnectivityManager connectivity =(ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
ConnectivityManager connectivity = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
return false;
......@@ -72,6 +86,26 @@ public class AppUtils {
return false;
}
/*
private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() {
@Override
public okhttp3.Response intercept(Chain chain) throws IOException {
okhttp3.Response origResponse = chain.proceed(chain.request());
if (AppUtils.isNetworkAvailable(c)) {
int maxAge = 60; // read from cache for 1 minute
return origResponse.newBuilder()
.header("Cache-Control", "public, max-age=" + maxAge)
.build();
} else {
int maxStale = 60 * 60 * 24 * 28; // tolerate 4-weeks stale
return origResponse.newBuilder()
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
.build();
}
}
};
*/
public static void initREST(String serverIP, Context c) {
AppUtils.c = c;
File httpCacheDirectory = new File(c.getCacheDir(), "responses");
......@@ -95,43 +129,7 @@ public class AppUtils {
.build();
service = retrofit.create(CanteeneoApiInterface.class);
}
/*
private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() {
@Override
public okhttp3.Response intercept(Chain chain) throws IOException {
okhttp3.Response origResponse = chain.proceed(chain.request());
if (AppUtils.isNetworkAvailable(c)) {
int maxAge = 60; // read from cache for 1 minute
return origResponse.newBuilder()
.header("Cache-Control", "public, max-age=" + maxAge)
.build();
} else {
int maxStale = 60 * 60 * 24 * 28; // tolerate 4-weeks stale
return origResponse.newBuilder()
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
.build();
}
}
};
*/
private static final Interceptor TOKEN_AUTH_INTERCEPTOR = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
String credentials = username + ":" + password;
final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
Request original = chain.request();
Request.Builder requestBuilder = original.newBuilder()
.header("Authorization", basic)
.header("Accept", "application/json")
.method(original.method(), original.body());
Request request = requestBuilder.build();
return chain.proceed(request);
}
};
}
......@@ -4,10 +4,10 @@ import com.canteeneo.entities.Cuisine;
import com.canteeneo.entities.Dish;
import com.canteeneo.entities.DishReview;
import com.canteeneo.entities.DishType;
import com.canteeneo.entities.FavoriteInfo;
import com.canteeneo.entities.Location;
import com.canteeneo.entities.NewUserResult;
import com.canteeneo.entities.Stall;
import com.canteeneo.entities.FavoriteInfo;
import com.canteeneo.entities.StallReview;
import com.canteeneo.entities.Token;
......@@ -15,7 +15,6 @@ import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
......
......@@ -2,7 +2,7 @@ package com.canteeneo;
import android.app.Application;
public class CustomApplication extends Application{
public class CustomApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
......
......@@ -7,15 +7,15 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.canteeneo.entities.Dish;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class DishAdapter extends BaseAdapter {
private Activity context;
ArrayList<Dish> dishes;
ArrayList<Dish> filteredDishes;
private Activity context;
public DishAdapter(Activity context, ArrayList<Dish> dishes) {
this.context = context;
......@@ -41,43 +41,43 @@ public class DishAdapter extends BaseAdapter {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
DishViewHolder holder;
if(convertView == null) {
if (convertView == null) {
convertView = context.getLayoutInflater().inflate(R.layout.dish_row, null);
holder = new DishViewHolder();
holder.name = (TextView)convertView.findViewById(R.id.tvName);
holder.price = (TextView)convertView.findViewById(R.id.tvPrice);
holder.image = (ImageView)convertView.findViewById(R.id.iv);
holder.name = (TextView) convertView.findViewById(R.id.tvName);
holder.price = (TextView) convertView.findViewById(R.id.tvPrice);
holder.image = (ImageView) convertView.findViewById(R.id.iv);
convertView.setTag(holder);
} else {
holder = (DishViewHolder)convertView.getTag();
holder = (DishViewHolder) convertView.getTag();
}
Dish d = filteredDishes.get(position);
holder.name.setText(d.getName());
holder.price.setText(d.getPrice()+"");
Picasso.with(context).load("http://" + parent.getResources().getString(R.string.server_ip) + ":5000/static/uploads/"+ d.getImagePath()).fit().centerCrop().tag(context).into(holder.image);
holder.price.setText(d.getPrice() + "");
Picasso.with(context).load("http://" + parent.getResources().getString(R.string.server_ip) + ":5000/static/uploads/" + d.getImagePath()).fit().centerCrop().tag(context).into(holder.image);
return convertView;
}
public void filter(String nameFilter, ArrayList<Integer> typeFilter, ArrayList<Integer> cuisineFilter, ArrayList<Integer> locationFilter, double minPrice, double maxPrice) {
filteredDishes.clear();
for(Dish dish: dishes) {
for (Dish dish : dishes) {
boolean skip = false;
String[] keywords = nameFilter.toLowerCase().split(" ");
for(String keyword: keywords) {
if(dish.getName().toLowerCase().indexOf(keyword) == -1) {
for (String keyword : keywords) {
if (dish.getName().toLowerCase().indexOf(keyword) == -1) {
skip = true;
break;
}
}
if(skip) continue;
if(typeFilter.indexOf(dish.getTypeId()) == -1) continue;
if(cuisineFilter.indexOf(dish.getCuisineId()) == -1) continue;
if(locationFilter.indexOf(dish.getLocationId()) == -1) continue;
if(dish.getPrice() < minPrice || dish.getPrice() > maxPrice) continue;
if (skip) continue;
if (typeFilter.indexOf(dish.getTypeId()) == -1) continue;
if (cuisineFilter.indexOf(dish.getCuisineId()) == -1) continue;
if (locationFilter.indexOf(dish.getLocationId()) == -1) continue;
if (dish.getPrice() < minPrice || dish.getPrice() > maxPrice) continue;
filteredDishes.add(dish);
}
......
......@@ -39,7 +39,7 @@ public class DishReviewActivity extends AppCompatActivity {
body = (EditText) findViewById(R.id.rv_body);
rating = (RatingBar) findViewById(R.id.rv_rating);
if(editing) {
if (editing) {
setTitle("Edit Dish Review");
reviewId = getIntent().getIntExtra("REVIEW_ID", 0);
title.setText(getIntent().getStringExtra("EDIT_TITLE"));
......@@ -61,7 +61,7 @@ public class DishReviewActivity extends AppCompatActivity {
rv.setDishId(id);
rv.setUserId(AppUtils.getUserId());
if(editing) {
if (editing) {
editReview(reviewId, rv);
} else {
newReview(rv);
......
......@@ -22,8 +22,8 @@ import retrofit2.Callback;
import retrofit2.Response;
public class DishReviewAdapter extends BaseAdapter {
private Activity context;
ArrayList<DishReview> dishReviews;
private Activity context;
public DishReviewAdapter(Activity context, ArrayList<DishReview> dishReviews) {
this.context = context;
......@@ -59,9 +59,9 @@ public class DishReviewAdapter extends BaseAdapter {
body.setText(dr.getBody());
username.setText(dr.getUser());
Button editButton = (Button)v.findViewById(R.id.edit_button);
Button deleteButton = (Button)v.findViewById(R.id.delete_button);
if(dr.getUserId() == AppUtils.getUserId()) {
Button editButton = (Button) v.findViewById(R.id.edit_button);
Button deleteButton = (Button) v.findViewById(R.id.delete_button);
if (dr.getUserId() == AppUtils.getUserId()) {
editButton.setVisibility(View.VISIBLE);
editButton.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -81,7 +81,7 @@ public class DishReviewAdapter extends BaseAdapter {
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DishViewActivity context = (DishViewActivity)DishReviewAdapter.this.context;
final DishViewActivity context = (DishViewActivity) DishReviewAdapter.this.context;
new AlertDialog.Builder(context)
.setTitle("Confirm Delete")
.setMessage("Are you sure you want to delete your review? This cannot be undone.")
......
......@@ -13,9 +13,9 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import com.canteeneo.entities.DishReview;
import com.canteeneo.entities.FavoriteInfo;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
......@@ -54,7 +54,7 @@ public class DishViewActivity extends AppCompatActivity {
TextView dishDesc = (TextView) findViewById(R.id.dish_desc);
dishDesc.setText(i.getStringExtra("DESCRIPTION"));
ImageView image = (ImageView) findViewById(R.id.dish_pic);
Picasso.with(this).load("http://" + getResources().getString(R.string.server_ip) + ":5000/static/uploads/"+ i.getStringExtra("IMAGE")).fit().centerCrop().into(image);
Picasso.with(this).load("http://" + getResources().getString(R.string.server_ip) + ":5000/static/uploads/" + i.getStringExtra("IMAGE")).fit().centerCrop().into(image);
dishStall = (TextView) findViewById(R.id.dish_stall);
dishStall.setText(i.getStringExtra("STALLNAME"));
......@@ -67,7 +67,7 @@ public class DishViewActivity extends AppCompatActivity {
});
}
favoriteCheckbox = (CheckBox)findViewById(R.id.favorite_checkbox);
favoriteCheckbox = (CheckBox) findViewById(R.id.favorite_checkbox);
favoriteCheckbox.setEnabled(AppUtils.isLoggedIn());
favoriteCheckbox.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -141,18 +141,18 @@ public class DishViewActivity extends AppCompatActivity {
public void onResponse(Call<List<DishReview>> call, Response<List<DishReview>> response) {
List<DishReview> newReviews = response.body();
DishReview ownedReview = null;
for(DishReview review: newReviews) {
if(review.getUserId() == AppUtils.getUserId()) {
for (DishReview review : newReviews) {
if (review.getUserId() == AppUtils.getUserId()) {
ownedReview = review;
break;
}
}
reviews.clear();
if(ownedReview != null) {
if (ownedReview != null) {
newReviews.remove(ownedReview);
reviews.add(ownedReview);
}
findViewById(R.id.add_review_button).setVisibility(ownedReview != null || !AppUtils.isLoggedIn()? View.INVISIBLE: View.VISIBLE);
findViewById(R.id.add_review_button).setVisibility(ownedReview != null || !AppUtils.isLoggedIn() ? View.INVISIBLE : View.VISIBLE);
reviews.addAll(newReviews);
adapter.notifyDataSetChanged();
......
......@@ -6,9 +6,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
......@@ -44,10 +42,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
private DishAdapter adapter;
private ArrayList<Dish> dishes = new ArrayList<>();
public static String EXTRA_MESSAGE = "com.testapp.MESSAGE";
String query = "";
private String query = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -58,8 +53,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
......@@ -89,19 +83,19 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
}
});
Button applyFilterButton = (Button)findViewById(R.id.apply_filter_button);
Button applyFilterButton = (Button) findViewById(R.id.apply_filter_button);
applyFilterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
refreshDishes();
((DrawerLayout)NavDrawerActivity.this.findViewById(R.id.drawer_layout)).closeDrawer(Gravity.LEFT);
((DrawerLayout) NavDrawerActivity.this.findViewById(R.id.drawer_layout)).closeDrawer(Gravity.LEFT);
}
});
RelativeLayout loggedInHeader = (RelativeLayout)findViewById(R.id.logged_in_header);
if(AppUtils.isLoggedIn()) {
RelativeLayout loggedInHeader = (RelativeLayout) findViewById(R.id.logged_in_header);
if (AppUtils.isLoggedIn()) {
loggedInHeader.setVisibility(View.VISIBLE);
((TextView)findViewById(R.id.greeting)).setText("Hello, " + AppUtils.getUsername());
((TextView) findViewById(R.id.greeting)).setText("Hello, " + AppUtils.getUsername());
findViewById(R.id.logout_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -144,16 +138,16 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
}
public <T extends Filter> void populateFilter(Call<List<T>> call, int layout_id) {
final LinearLayout checkboxes = (LinearLayout)findViewById(layout_id);
final LinearLayout checkboxes = (LinearLayout) findViewById(layout_id);
checkboxes.removeAllViewsInLayout();
call.enqueue(new Callback<List<T>>() {
@Override
public void onResponse(Call<List<T>> call, Response<List<T>> response) {
List<T> filters = response.body();
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for(T filter: filters) {
CheckBox checkbox = (CheckBox)inflater.inflate(R.layout.search_checkbox, null);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
for (T filter : filters) {
CheckBox checkbox = (CheckBox) inflater.inflate(R.layout.search_checkbox, null);
checkbox.setId(filter.getId());
checkbox.setText(filter.getName());
checkbox.setChecked(true);
......@@ -175,7 +169,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
if(AppUtils.isLoggedIn()) {
if (AppUtils.isLoggedIn()) {
new AlertDialog.Builder(this)
.setTitle("Logout")
.setMessage("Are you sure you want to log out?")
......@@ -234,13 +228,13 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
}
private ArrayList<Integer> getChecked(int layoutId) {
LinearLayout checkboxes = (LinearLayout)findViewById(layoutId);
LinearLayout checkboxes = (LinearLayout) findViewById(layoutId);
ArrayList<Integer> checked = new ArrayList<>();
for(int i = 0; i < checkboxes.getChildCount(); i++) {
for (int i = 0; i < checkboxes.getChildCount(); i++) {
View v = checkboxes.getChildAt(i);
if(v instanceof CheckBox) {
CheckBox c = (CheckBox)v;
if(c.isChecked()) {
if (v instanceof CheckBox) {
CheckBox c = (CheckBox) v;
if (c.isChecked()) {
checked.add(c.getId());
}
}
......@@ -249,7 +243,7 @@ public class NavDrawerActivity extends AppCompatActivity implements NavigationVi
}
public void refreshDishes() {
RangeSeekBar priceRangeBar = (RangeSeekBar)findViewById(R.id.price_range_bar);
RangeSeekBar priceRangeBar = (RangeSeekBar) findViewById(R.id.price_range_bar);
adapter.filter(query, getChecked(R.id.type_checkboxes), getChecked(R.id.cuisine_checkboxes), getChecked(R.id.location_checkboxes), priceRangeBar.getSelectedMinValue().doubleValue(), priceRangeBar.getSelectedMaxValue().doubleValue());
adapter.notifyDataSetChanged();
System.out.println(adapter.filteredDishes.size());
......
......@@ -34,10 +34,10 @@ public class RegisterActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
mEmailView = (EditText)findViewById(R.id.email);
mEmailView = (EditText) findViewById(R.id.email);
mUsernameView = (EditText) findViewById(R.id.username);
mPasswordView = (EditText) findViewById(R.id.password);
mConfirmPasswordView = (EditText)findViewById(R.id.confirm_password);
mConfirmPasswordView = (EditText) findViewById(R.id.confirm_password);
Button mRegisterButton = (Button) findViewById(R.id.register_button);
mRegisterButton.setOnClickListener(new OnClickListener() {
......@@ -64,19 +64,19 @@ public class RegisterActivity extends AppCompatActivity {
boolean cancel = false;
View focusView = null;
if(TextUtils.isEmpty(email)) {
if (TextUtils.isEmpty(email)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
}
if(TextUtils.isEmpty(password)) {
if (TextUtils.isEmpty(password)) {
mPasswordView.setError(getString(R.string.error_field_required));
focusView = mPasswordView;
cancel = true;
}
if(!password.equals(confirm_password)) {
if (!password.equals(confirm_password)) {
mPasswordView.setError(getString(R.string.error_password_match));
mConfirmPasswordView.setError(getString(R.string.error_password_match));
focusView = mPasswordView;
......@@ -101,7 +101,7 @@ public class RegisterActivity extends AppCompatActivity {
showProgress(false);
NewUserResult result = response.body();
if(result.isSuccess()) {
if (result.isSuccess()) {
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
} else {
......@@ -119,11 +119,11 @@ public class RegisterActivity extends AppCompatActivity {
}
public void registerError(String field) {
if(field.equals("username")) {
if (field.equals("username")) {
mUsernameView.setError(getString(R.string.error_username_taken));
mUsernameView.requestFocus();
}
if(field.equals("email")) {
if (field.equals("email")) {
mEmailView.setError(getString(R.string.error_email_taken));
mEmailView.requestFocus();
}
......
......@@ -39,7 +39,7 @@ public class StallReviewActivity extends AppCompatActivity {
body = (EditText) findViewById(R.id.rv_body);
rating = (RatingBar) findViewById(R.id.rv_rating);
if(editing) {
if (editing) {
setTitle("Edit Stall Review");
reviewId = getIntent().getIntExtra("REVIEW_ID", 0);
title.setText(getIntent().getStringExtra("EDIT_TITLE"));
......@@ -61,7 +61,7 @@ public class StallReviewActivity extends AppCompatActivity {
rv.setStallId(id);
rv.setUserId(AppUtils.getUserId());
if(editing) {
if (editing) {
editReview(reviewId, rv);
} else {
newReview(rv);
......
......@@ -22,8 +22,8 @@ import retrofit2.Callback;
import retrofit2.Response;
public class StallReviewAdapter extends BaseAdapter {
private Activity context;
ArrayList<StallReview> stallReviews;
private Activity context;
public StallReviewAdapter(Activity context, ArrayList<StallReview> stallReviews) {
this.context = context;
......@@ -59,9 +59,9 @@ public class StallReviewAdapter extends BaseAdapter {
body.setText(sr.getBody());
username.setText(sr.getUser());
Button editButton = (Button)v.findViewById(R.id.edit_button);
Button deleteButton = (Button)v.findViewById(R.id.delete_button);
if(sr.getUserId() == AppUtils.getUserId()) {
Button editButton = (Button) v.findViewById(R.id.edit_button);
Button deleteButton = (Button) v.findViewById(R.id.delete_button);
if (sr.getUserId() == AppUtils.getUserId()) {
editButton.setVisibility(View.VISIBLE);
editButton.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -81,7 +81,7 @@ public class StallReviewAdapter extends BaseAdapter {
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final StallViewActivity context = (StallViewActivity)StallReviewAdapter.this.context;
final StallViewActivity context = (StallViewActivity) StallReviewAdapter.this.context;
new AlertDialog.Builder(context)
.setTitle("Confirm Delete")
.setMessage("Are you sure you want to delete your review? This cannot be undone.")
......
......@@ -75,7 +75,7 @@ public class StallViewActivity extends AppCompatActivity {
description.setText(s.getDescription());
//ImageView image = (ImageView) findViewById(R.id.stall_logo);
//Picasso.with(getApplicationContext()).load("http://" + getResources().getString(R.string.server_ip) + ":5000/static/uploads/"+ s.getImagePath()).fit().centerCrop().into(image);
favoriteCheckbox = (CheckBox)findViewById(R.id.favorite_checkbox);
favoriteCheckbox = (CheckBox) findViewById(R.id.favorite_checkbox);
favoriteCheckbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -175,18 +175,18 @@ public class StallViewActivity extends AppCompatActivity {
public void onResponse(Call<List<StallReview>> call, Response<List<StallReview>> response) {
List<StallReview> newReviews = response.body();
StallReview ownedReview = null;
for(StallReview review: newReviews) {
if(review.getUserId() == AppUtils.getUserId()) {
for (StallReview review : newReviews) {
if (review.getUserId() == AppUtils.getUserId()) {
ownedReview = review;
break;
}
}
reviews.clear();
if(ownedReview != null) {
if (ownedReview != null) {
newReviews.remove(ownedReview);
reviews.add(ownedReview);
}
findViewById(R.id.add_review_button).setVisibility(ownedReview != null || !AppUtils.isLoggedIn()? View.INVISIBLE: View.VISIBLE);
findViewById(R.id.add_review_button).setVisibility(ownedReview != null || !AppUtils.isLoggedIn() ? View.INVISIBLE : View.VISIBLE);
reviews.addAll(newReviews);
srAdapter.notifyDataSetChanged();
......
......@@ -23,21 +23,37 @@ public class DishReview {
this.dish_id = dish_id;
}
public int getId() { return id; }
public int getId() {
return id;
}
public void setId(int id) { this.id = id; }
public void setId(int id) {
this.id = id;
}
public String getTitle() { return title; }
public String getTitle() {
return title;
}
public void setTitle(String title) { this.title = title; }
public void setTitle(String title) {
this.title = title;
}
public String getBody() { return body; }
public String getBody() {
return body;
}
public void setBody(String body) { this.body = body; }
public void setBody(String body) {
this.body = body;
}
public float getRating() { return rating; }
public float getRating() {
return rating;
}
public void setRating(float rating) { this.rating = rating; }
public void setRating(float rating) {
this.rating = rating;
}
public String getUser() {
return user;
......@@ -47,12 +63,20 @@ public class DishReview {
this.user = user;
}
public int getUserId() { return user_id; }
public int getUserId() {
return user_id;
}
public void setUserId(int user_id) { this.user_id = user_id; }
public void setUserId(int user_id) {
this.user_id = user_id;
}
public int getDishId() { return dish_id; }
public int getDishId() {
return dish_id;
}
public void setDishId(int dish_id) { this.dish_id = dish_id; }
public void setDishId(int dish_id) {
this.dish_id = dish_id;
}
}
......@@ -2,7 +2,10 @@ package com.canteeneo.entities;
public interface Filter {
int getId();
void setId(int id);
String getName();
void setName(String name);
}
......@@ -24,21 +24,37 @@ public class StallReview {
this.stall_id = stall_id;
}
public int getId() { return id; }
public int getId() {
return id;
}
public void setId(int id) { this.id = id; }
public void setId(int id) {
this.id = id;
}
public String getTitle() { return title; }
public String getTitle() {
return title;
}
public void setTitle(String title) { this.title = title; }
public void setTitle(String title) {
this.title = title;
}
public String getBody() { return body; }
public String getBody() {
return body;
}
public void setBody(String body) { this.body = body; }
public void setBody(String body) {
this.body = body;
}
public float getRating() { return rating; }
public float getRating() {
return rating;
}
public void setRating(float rating) { this.rating = rating; }
public void setRating(float rating) {
this.rating = rating;
}
public String getUser() {
return user;
......@@ -48,12 +64,20 @@ public class StallReview {
this.user = user;
}
public int getUserId() { return user_id; }
public int getUserId() {
return user_id;
}
public void setUserId(int user_id) { this.user_id = user_id; }
public void setUserId(int user_id) {
this.user_id = user_id;
}
public int getStallId() { return stall_id; }
public int getStallId() {
return stall_id;
}
public void setStallId(int stall_id) { this.stall_id = stall_id; }
public void setStallId(int stall_id) {
this.stall_id = stall_id;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment