diff --git a/.idea/misc.xml b/.idea/misc.xml index cf5d4ff..9d99315 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -9,4 +9,11 @@ + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 3785e65..707f3a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,6 @@ plugins { id 'com.android.application' + id 'androidx.navigation.safeargs' } android { @@ -33,11 +34,17 @@ android { dependencies { + implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'com.google.android.material:material:1.10.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.navigation:navigation-fragment:2.7.5' - implementation 'androidx.navigation:navigation-ui:2.7.5' + implementation 'androidx.gridlayout:gridlayout:1.0.0' + // Navigation + def nav_version = "2.7.5" + implementation "androidx.navigation:navigation-fragment:$nav_version" + implementation "androidx.navigation:navigation-ui:$nav_version" + implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" + androidTestImplementation "androidx.navigation:navigation-testing:$nav_version" // Required by OkHTTP implementation 'org.conscrypt:conscrypt-android:2.5.2' implementation 'com.squareup.retrofit2:retrofit:2.9.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index db1a2d7..058e0fa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,24 +3,26 @@ xmlns:tools="http://schemas.android.com/tools"> - - + + @@ -28,9 +30,6 @@ - \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/API/API.java b/app/src/main/java/org/epic_guys/esse4/API/API.java index 08b1fbf..2b911e5 100644 --- a/app/src/main/java/org/epic_guys/esse4/API/API.java +++ b/app/src/main/java/org/epic_guys/esse4/API/API.java @@ -1,13 +1,11 @@ package org.epic_guys.esse4.API; -import android.accounts.AccountManager; -import android.credentials.Credential; -import android.credentials.CredentialDescription; -import android.credentials.CredentialManager; -import android.credentials.RegisterCredentialDescriptionRequest; -import android.graphics.Picture; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.util.Log; +import androidx.core.util.Pair; + import okhttp3.OkHttpClient; import okhttp3.Credentials; import okhttp3.Request; @@ -17,10 +15,12 @@ import org.epic_guys.esse4.API.services.ApiService; import org.epic_guys.esse4.API.services.JwtService; import org.epic_guys.esse4.exceptions.ApiException; +import org.epic_guys.esse4.models.Carriera; import org.epic_guys.esse4.models.Jwt; import org.epic_guys.esse4.models.Persona; import org.jetbrains.annotations.NotNull; +import java.io.IOException; import java.time.Instant; import java.util.Date; import java.util.List; @@ -34,17 +34,27 @@ public class API { private static API instance; - private OkHttpClient client; - private Retrofit retrofit; + private final OkHttpClient client; + private final Retrofit retrofit; private Jwt jwt; - public static /*temp*/ boolean isLogged = false; //TEMPORARY FIX FOR LOGIN (see MainActivity.java) - public static final String BASE_URL = "https://esse3.unive.it/e3rest/api/"; + private Persona loggedPersona; + private Carriera carrieraStudente; + // public static final String BASE_URL = "https://esse3.unive.it/e3rest/api/"; + public static final String BASE_URL = "https://unive.esse3.pp.cineca.it/e3rest/api/"; + private Jwt getJwt() { return jwt; } + public static Persona getLoggedPersona() { + return API.getInstance().loggedPersona; + } + public static Carriera getCarriera() { + return API.getInstance().carrieraStudente; + } + private API() { this.client = new OkHttpClient.Builder() .addInterceptor(chain -> { @@ -70,42 +80,6 @@ public static API getInstance(){ return instance == null ? instance = new API() : instance; } - - /* - @NotNull - public static CompletableFuture fetchJwk() { - Request request = new Request.Builder() - .url(BASE_URL + "jwt/jwk") - .build(); - - final CompletableFuture future = new CompletableFuture<>(); - API.getInstance().client.newCall(request).enqueue(new okhttp3.Callback() { - @Override - public void onFailure(@NotNull okhttp3.Call call, @NotNull IOException e) { - future.completeExceptionally(e); - } - - @Override - public void onResponse(@NotNull okhttp3.Call call, @NotNull okhttp3.Response response) throws IOException { - Parser> parser = Jwks.parser().build(); - try { - JSONObject json = new JSONObject(response.body().string()); - String jwk = json.getJSONArray("keys").getJSONObject(0).toString(); - API.getInstance().jwk = (Jwk) parser.parse(jwk); - API.getInstance().jwtParser = Jwts.parser() - .verifyWith(API.getInstance().jwk.toKey()) - .build(); - future.complete(null); - } catch (JSONException e) { - future.completeExceptionally(e); - } - } - }); - - return future; - } - */ - @NotNull public static CompletableFuture login (String username, String password) { final CompletableFuture future = new CompletableFuture<>(); @@ -130,7 +104,6 @@ public static CompletableFuture login (String username, String password .addConverterFactory(GsonConverterFactory.create()) .build(); - basicRetrofit.create(JwtService.class) .newJwt() .enqueue(new retrofit2.Callback() { @@ -142,76 +115,67 @@ public void onFailure(@NotNull Call call, @NotNull Throwable t) { @Override public void onResponse(@NotNull Call call, @NotNull Response response) { - if (response.code() == 200) { - // API.fetchJwk().join(); - - //log data to console - Log.i("API_TAG", BuildConfig.DEBUG ? response.toString() : "Login successful"); + boolean success = response.code() == 200; + if (success) { API.getInstance().jwt = response.body(); - API.isLogged = true; - Log.i("API_TAG", API.isLogged ? "Logged in" : "Not logged in"); - - + Log.d("Api", BuildConfig.DEBUG ? response.toString() : "Login successful"); } else { - API.getInstance().isLogged = false; + Log.d("Api", BuildConfig.DEBUG ? response.toString() : "Login failed"); } - future.complete(API.getInstance().isLogged); + future.complete(success); } }); + return future; } - public static CompletableFuture getBasicData(){ + public static CompletableFuture> getBasicData() { + Call> callPersone = API.getService(AnagraficheService.class).getPersone(); + Call> callCarriere = API.getService(AnagraficheService.class).getCarriere(); - final CompletableFuture future = new CompletableFuture<>(); + return API.enqueueResource(callPersone).thenCombine( + API.enqueueResource(callCarriere), + (persone, carriere) -> { + API.getInstance().loggedPersona = persone.get(0); + API.getInstance().carrieraStudente = carriere.get(0); + return new Pair<>(persone.get(0), carriere.get(0)); + }); + } - API.getService(AnagraficheService.class) - .getPersone() - .enqueue( new retrofit2.Callback>() { - @Override - public void onResponse(@NotNull Call> call, @NotNull Response> response) { - if (response.code() == 200) { - //log data to console - Log.i("API_TAG", BuildConfig.DEBUG ? response.toString() : "Anagrafiche Service Fetch successful"); - - //here I take the data I need, so: - // Matricola = { user{ userId } } - // FirstName = { user{ firstName } } - // LastName = { user{ lastName } } - // Type of degree - // Student's type - // Year of study = {user { trattiCarriera[ 0{ dettaglioTratto{ annoCorso } } ] } } - // Enrolment date - // Degree's Programme = "[" + {user { trattiCarriera[ 0{ dettaglioTratto{ cdsCod } } ] } } + "] - " + {user { trattiCarriera[ 0{ cdsDes } ] } } - // Study System - // Part-time = {user { trattiCarriera[ 0{ dettaglioTratto{ ptFlag } } ] } } - try { - Persona p = response.body().get(0); - future.complete(p); - } catch (NullPointerException e) { - future.completeExceptionally(e); - } - } - } + public static CompletableFuture getPhoto() { + final CompletableFuture future = new CompletableFuture<>(); + Persona persona = API.getInstance().loggedPersona; - @Override - public void onFailure(Call> call, Throwable t) { - // throw new RuntimeException("Could not fetch data: " + (BuildConfig.DEBUG ? t.getMessage() : "Server error")); - future.completeExceptionally(t); + Request request = new Request.Builder() + .url(API.BASE_URL + "anagrafica-service-v2/persone/" + /*persId*/ persona.getPersId() + "/foto").build(); + + API.getInstance().client.newCall(request).enqueue(new okhttp3.Callback() { + @Override + public void onFailure(@NotNull okhttp3.Call call, @NotNull IOException e) { + future.completeExceptionally(e); + } + @Override + public void onResponse(@NotNull okhttp3.Call call, @NotNull okhttp3.Response response) { + if (response.code() == 200) { + try { + assert response.body() != null; + byte[] imgBytes = response.body().bytes(); + Bitmap bitmap = BitmapFactory.decodeByteArray(imgBytes, 0, imgBytes.length); + future.complete(bitmap); + }catch (Exception e) { + future.completeExceptionally(e); } - }); - return future; - } - public static CompletableFuture getPhoto(){ - throw new UnsupportedOperationException(); + Log.d("Api", BuildConfig.DEBUG ? response.toString() : "Photo Fetch successful"); + } + } + }); + + return future; } - /** - * @return Whether the expiration date is before the current time. - */ public static boolean isValidJwt() { return API.getInstance() .jwt.getPayload().getExpirationTime() @@ -259,4 +223,34 @@ public static T getService(Class serviceClass) { return API.getInstance().retrofit.create(serviceClass); } + + /** + * Enqueues a Retrofit call and returns a CompletableFuture that will be completed when the call + * is completed. + * @param call Retrofit call to be enqueued. + * @return A CompletableFuture that will be completed when the call is completed. + * @param Type of the resource returned by the call. + */ + public static CompletableFuture enqueueResource(Call call) { + final CompletableFuture future = new CompletableFuture<>(); + + call.enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) { + if (response.isSuccessful()) { + future.complete(response.body()); + } else { + ApiException exception = new ApiException("Error on response: " + response.code()); + future.completeExceptionally(exception); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull Throwable t) { + future.completeExceptionally(t); + } + }); + + return future; + } } diff --git a/app/src/main/java/org/epic_guys/esse4/API/services/AnagraficheService.java b/app/src/main/java/org/epic_guys/esse4/API/services/AnagraficheService.java index 349d42b..f83d9fb 100644 --- a/app/src/main/java/org/epic_guys/esse4/API/services/AnagraficheService.java +++ b/app/src/main/java/org/epic_guys/esse4/API/services/AnagraficheService.java @@ -1,5 +1,6 @@ package org.epic_guys.esse4.API.services; +import org.epic_guys.esse4.models.Carriera; import org.epic_guys.esse4.models.Persona; import retrofit2.Call; import retrofit2.http.GET; @@ -11,4 +12,7 @@ public interface AnagraficheService extends ApiService { @GET(BASE_URL + "/persone") Call> getPersone(); + + @GET(BASE_URL + "/carriere") + Call> getCarriere(); } diff --git a/app/src/main/java/org/epic_guys/esse4/API/services/CalendarioEsamiService.java b/app/src/main/java/org/epic_guys/esse4/API/services/CalendarioEsamiService.java new file mode 100644 index 0000000..7a8e33c --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/API/services/CalendarioEsamiService.java @@ -0,0 +1,27 @@ +package org.epic_guys.esse4.API.services; + +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.ParametriIscrizioneAppello; + +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; + +import java.util.List; + +public interface CalendarioEsamiService extends ApiService { + String BASE_URL = "calesa-service-v1"; + + @GET(BASE_URL + "/appelli/{cdsId}/{adId}") + Call> getAppelli(@Path("cdsId") Long idCorsoDiStudio, @Path("adId") Long idAttivitaDidattica); + + @POST(BASE_URL + "/appelli/{cdsId}/{adId}/{appId}/iscritti") + Call postIscrizioneAppello( + @Path("cdsId") long idCorsoDiStudio, + @Path("adId") long idAttivitaDidattica, + @Path("appId") long idAppello, + @Body ParametriIscrizioneAppello parametriIscrizioneAppello + ); +} diff --git a/app/src/main/java/org/epic_guys/esse4/API/services/LibrettoService.java b/app/src/main/java/org/epic_guys/esse4/API/services/LibrettoService.java new file mode 100644 index 0000000..a25dea8 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/API/services/LibrettoService.java @@ -0,0 +1,48 @@ +package org.epic_guys.esse4.API.services; + +import org.epic_guys.esse4.models.ApiResource; +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.AppelloLibretto; +import org.epic_guys.esse4.models.RigaLibretto; +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Path; +import retrofit2.http.Query; + +import java.util.List; + +public interface LibrettoService extends ApiService { + + enum Condizioni { + APPELLI_PRENOTABILI, + APPELLI_PRENOTABILI_E_FUTURI + } + + String BASE_URL = "libretto-service-v2"; + + @GET(BASE_URL + "/libretti/{matId}/righe/") + Call> righeLibretto(@Path("matId") long idCarriera); + + + @GET(BASE_URL + "/libretti/{matId}/appelli") + Call> getAppelli(@Path("matId") long idCarriera); + + @GET(BASE_URL + "/libretti/{matId}/appelli") + Call> getAppelli( + @Path("matId") long idCarriera, + @Query("q") Condizioni condizioni + ); + + @GET(BASE_URL + "/libretti/{matId}/righe/{adsceId}/appelli") + Call> getAppelliPerRigaLibretto( + @Path("matId") long idCarriera, + @Path("adsceId") long idRigaLibretto, + @Query("q") Condizioni condizioni + ); + + @GET(BASE_URL + "/libretti/{matId}/righe/{adsceId}/appelli") + Call> getAppelliPerRigaLibretto( + @Path("matId") long idCarriera, + @Path("adsceId") long idRigaLibretto + ); +} diff --git a/app/src/main/java/org/epic_guys/esse4/API/services/PianiService.java b/app/src/main/java/org/epic_guys/esse4/API/services/PianiService.java new file mode 100644 index 0000000..d68c846 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/API/services/PianiService.java @@ -0,0 +1,23 @@ +package org.epic_guys.esse4.API.services; + +import org.epic_guys.esse4.models.ApiResource; +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.PianoDiStudio; +import org.epic_guys.esse4.models.RigaLibretto; +import org.epic_guys.esse4.models.TestataPianoDiStudio; + +import java.util.List; + +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Path; +public interface PianiService extends ApiService { + String BASE_URL = "piani-service-v1"; + + @GET(BASE_URL + "/piani/{stuId}") + Call> testataPianoDiStudio(@Path("stuId") long idStudente); + + @GET(BASE_URL + "/piani/{stuId}/{pianoId}") + Call righePianoDiStudio(@Path("stuId") long idStudente, @Path("pianoId") long idPianoDiStudio); + +} diff --git a/app/src/main/java/org/epic_guys/esse4/MainActivity.java b/app/src/main/java/org/epic_guys/esse4/MainActivity.java new file mode 100644 index 0000000..5245db0 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/MainActivity.java @@ -0,0 +1,8 @@ +package org.epic_guys.esse4; +import androidx.appcompat.app.AppCompatActivity; + +public class MainActivity extends AppCompatActivity { + public MainActivity() { + super(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/activities/LoginActivity.java b/app/src/main/java/org/epic_guys/esse4/activities/LoginActivity.java deleted file mode 100644 index 290cd7b..0000000 --- a/app/src/main/java/org/epic_guys/esse4/activities/LoginActivity.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.epic_guys.esse4.activities; - -import androidx.appcompat.app.AppCompatActivity; - -import android.accounts.Account; -import android.accounts.AccountManager; -import android.content.Intent; -import android.os.Bundle; -import android.widget.Button; -import android.widget.EditText; -import android.widget.TextView; -import android.widget.Toast; - -import org.epic_guys.esse4.R; - -import org.epic_guys.esse4.API.API; - -import android.util.Log; - -import de.adorsys.android.securestoragelibrary.SecurePreferences; - -public class LoginActivity extends AppCompatActivity { - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_login); - - Button loginButton = findViewById(R.id.login_button); - loginButton.setOnClickListener(view -> { - EditText matricolaInput = findViewById(R.id.textinput_matricola); - EditText passwordInput = findViewById(R.id.textinput_password); - - String matricola = matricolaInput.getText().toString(); - String password = passwordInput.getText().toString(); - - API.login(matricola, password).thenComposeAsync(isLogged -> { - if (isLogged) - return API.getBasicData(); - else { - runOnUiThread(() -> - Toast.makeText(getApplicationContext(), "Login fallito, proprio come te", Toast.LENGTH_SHORT).show() - ); - throw new RuntimeException("Failed to login"); - } - }).thenAccept(persona -> { - runOnUiThread(() -> { - Toast.makeText(getApplicationContext(), "Login effettuato", Toast.LENGTH_SHORT).show(); - Log.i("LoginActivity", "Login effettuato"); - }); - - try { - SecurePreferences.setValue("matricola", matricola, this); - SecurePreferences.setValue("password", password, this); - - Log.i("LoginActivity", "Account added"); - } - catch (Exception e) { - Log.e("LoginActivity", "Failed to save credentials"); - } - - - Intent mainActivity = new Intent(this, MainActivity.class); - startActivity(mainActivity); - Log.i("LoginActivity", "Starting MainActivity, finishing LoginActivity"); - finish(); - }); - - }); - } -} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/activities/MainActivity.java b/app/src/main/java/org/epic_guys/esse4/activities/MainActivity.java deleted file mode 100644 index 5b24db9..0000000 --- a/app/src/main/java/org/epic_guys/esse4/activities/MainActivity.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.epic_guys.esse4.activities; - -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.widget.Toast; - -import androidx.appcompat.app.AppCompatActivity; - -import org.epic_guys.esse4.API.API; - -import org.epic_guys.esse4.R; - -import de.adorsys.android.securestoragelibrary.SecurePreferences; - -public class MainActivity extends AppCompatActivity { - - private void launchLoginActivity() { - Intent loginActivity = new Intent(this, LoginActivity.class); - startActivity(loginActivity); - finish(); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - String matricola = ""; - String password = ""; - super.onCreate(savedInstanceState); - - /* - * 1. Check if the user is logged in - * 2. If not, launch the login activity - * 3. If yes, show the main activity - * 4. If the login fails, launch the login activity - * 5. If the login succeeds, continue with the main activity - * - * we know that on the first launch the user will login two times... but it's a feature! - */ - - // checks if secure preferences are set, if not launch login activity - try{ - matricola = SecurePreferences.getStringValue("matricola",this, ""); - password = SecurePreferences.getStringValue( "password", this, ""); - } - catch (Exception e) { - Log.i("MainActivity", "Secure preferences not set"); - launchLoginActivity(); - } - if (matricola.equals("") || password.equals("")) { - launchLoginActivity(); - }else{ - runOnUiThread(() -> { - Log.i("MainActivity", "Returned to main activity"); - }); - - // try to login with saved credentials - API.login(matricola, password).thenComposeAsync(isLogged -> { - if (isLogged) - return API.getBasicData(); - else { - throw new RuntimeException("Failed to login"); - } - }).thenAccept(persona -> { - runOnUiThread(() -> { - Log.i("MainActivity", "Login effettuato"); - Toast.makeText(this, "Benvenuto " + persona.getNome(), Toast.LENGTH_SHORT).show(); - }); - }).exceptionally(e -> { - runOnUiThread(() -> { - Log.i("MainActivity", "Login fallito"); - Toast.makeText(this, "Login fallito", Toast.LENGTH_SHORT).show(); - }); - - launchLoginActivity(); - return null; - }); - - setContentView(R.layout.activity_main); - - //logout button - findViewById(R.id.btn_logout).setOnClickListener(v -> { - SecurePreferences.setValue("matricola", "", this); - SecurePreferences.setValue("password", "", this); - launchLoginActivity(); - }); - } - } -} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/common/Common.java b/app/src/main/java/org/epic_guys/esse4/common/Common.java new file mode 100644 index 0000000..a06e3b7 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/common/Common.java @@ -0,0 +1,36 @@ +package org.epic_guys.esse4.common; + +import android.view.View; +import android.widget.LinearLayout; + +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.models.Esito; +import org.epic_guys.esse4.models.RigaLibretto; +import org.jetbrains.annotations.NotNull; + +public class Common { + // SOME EXAMS HAVE AN EMPTY GRADE (literally ""), LIKE "Tirocinio" and "B2 Inglese"... What should we do? + public static String stringifyGrade(RigaLibretto riga){ + Esito esito = riga.getEsito(); + if(esito.getModValCod() == Esito.ModValCodEnum.V){ + try{ + return riga.getEsito().getVoto().intValue() + (riga.getEsito().getLodeFlag() == 1 ? " L" : ""); + } catch (NullPointerException e){ + return null; + } + } + else{ + return riga.getEsito().getTipoGiudCod(); + } + } + + static public void startLoading(@NotNull View toHide,@NotNull View generalView, int loadingId){ + toHide.setVisibility(View.INVISIBLE); + generalView.findViewById(loadingId).setVisibility(View.VISIBLE); + } + + static public void stopLoading(@NotNull View toShow,View generalView, int loadingId){ + toShow.setVisibility(View.VISIBLE); + generalView.findViewById(loadingId).setVisibility(View.INVISIBLE); + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/common/EnumAdapter.java b/app/src/main/java/org/epic_guys/esse4/common/EnumAdapter.java new file mode 100644 index 0000000..60b8250 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/common/EnumAdapter.java @@ -0,0 +1,26 @@ +package org.epic_guys.esse4.common; + +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; + +public abstract class EnumAdapter> extends TypeAdapter { + + public abstract Class getTClass(); + + @Override + public void write(JsonWriter out, T value) throws IOException { + out.value(value.toString()); + } + + @Override + public T read(JsonReader in) throws IOException { + in.beginObject(); + in.nextName(); + String value = in.nextString(); + in.endObject(); + return T.valueOf(getTClass(), value); + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/AppelliFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/AppelliFragment.java new file mode 100644 index 0000000..8c90d1a --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/AppelliFragment.java @@ -0,0 +1,95 @@ +package org.epic_guys.esse4.fragments; + +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.navigation.NavController; +import androidx.navigation.NavOptions; +import androidx.navigation.fragment.NavHostFragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import android.widget.Toast; + +import org.epic_guys.esse4.API.API; +import org.epic_guys.esse4.API.services.LibrettoService; +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.common.Common; +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.AppelloLibretto; +import org.epic_guys.esse4.views.ExamCardAdapter; + +import java.util.List; + +import retrofit2.Call; + +public class AppelliFragment extends Fragment { + + private RecyclerView appelliRecyclerView; + private NavController navController; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + navController = NavHostFragment.findNavController(this); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_appelli, container, false); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + appelliRecyclerView = view.findViewById(R.id.recycler_view_appelli); + appelliRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + + AppelliFragmentArgs args = AppelliFragmentArgs.fromBundle(getArguments()); + + long idCarriera = args.getIdCarriera(); + long idRigaLibretto = args.getIdRigaLibretto(); + LibrettoService librettoService = API.getService(LibrettoService.class); + + Call> appelli; + + Common.startLoading(requireView().findViewById(R.id.recycler_view_appelli), requireView(), R.id.loading); + + if (idRigaLibretto == -1) { + appelli = librettoService.getAppelli( + idCarriera, + LibrettoService.Condizioni.APPELLI_PRENOTABILI_E_FUTURI + ); + } else { + appelli = librettoService.getAppelliPerRigaLibretto( + idCarriera, + idRigaLibretto, + LibrettoService.Condizioni.APPELLI_PRENOTABILI_E_FUTURI + ); + } + + API.enqueueResource(appelli) + .thenAccept(appelliList -> { + Log.d("AppelliFragment", "Ricevuti appelli: " + appelliList.size()); + appelliRecyclerView.setAdapter(new ExamCardAdapter(appelliList)); + Common.stopLoading(requireView().findViewById(R.id.recycler_view_appelli), requireView(), R.id.loading); + }) + .exceptionally(throwable -> { + Log.w("AppelliFragment", throwable.getMessage()); + return null; + }); + //when back button is pressed, go back to home fragment + view.findViewById(R.id.btn_back).setOnClickListener(v -> { + NavOptions navOptions = new NavOptions.Builder() + .setPopUpTo(R.id.homeFragment, true) + .build(); + navController.navigate(R.id.homeFragment, null, navOptions); + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/ExamSubscribeDialogFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/ExamSubscribeDialogFragment.java new file mode 100644 index 0000000..13d2140 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/ExamSubscribeDialogFragment.java @@ -0,0 +1,108 @@ +package org.epic_guys.esse4.fragments; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.EditText; +import android.widget.Spinner; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; + +import org.epic_guys.esse4.API.API; +import org.epic_guys.esse4.API.services.CalendarioEsamiService; +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.AppelloLibretto; +import org.epic_guys.esse4.models.ParametriIscrizioneAppello; + +import java.util.concurrent.CompletableFuture; + +import retrofit2.Call; + +public class ExamSubscribeDialogFragment extends DialogFragment { + + private final AppelloLibretto appello; + + public ExamSubscribeDialogFragment(AppelloLibretto appello) { + super(); + this.appello = appello; + + this.setCancelable(false); + } + + @NonNull + @Override + public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { + View view = requireActivity().getLayoutInflater().inflate( + R.layout.fragment_exam_subscribe_dialog, + null + ); + + Spinner examType = view.findViewById(R.id.spinner_exam_type); + EditText examNotes = view.findViewById(R.id.edit_text_notes_for_professor); + examType.setAdapter( + new ArrayAdapter<>( + requireContext(), + android.R.layout.simple_spinner_item, + Appello.TipoIscrCodEnum.values() + ) + ); + + return new AlertDialog.Builder(requireContext()) + .setTitle(appello.getDescrizioneAttivitaDidattica()) + .setMessage(appello.getDescrizioneAppello()) + .setView(view) + .setPositiveButton(R.string.subscribe, (dialog, which) -> { + Log.d(TAG, appello.getIdRigaLibretto().toString()); + ParametriIscrizioneAppello parametri = new ParametriIscrizioneAppello( + appello.getIdRigaLibretto() + ); + // Tipo esame DA IMPLEMENTARE + // parametri.setTipoIscrStu((Appello.TipoIscrCodEnum) examType.getSelectedItem()); + // Note per docente + // if (!examNotes.getText().toString().isEmpty()) { + // parametri.setNotaStu(examNotes.getText().toString()); + // } + + subscribe(parametri) + .thenAccept(aVoid -> { + Log.d(TAG, "Iscrizione effettuata"); + requireActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "Iscrizione effettuata", Toast.LENGTH_SHORT).show(); + }); + }) + .exceptionally(throwable -> { + Log.w(TAG, Log.getStackTraceString(throwable)); + requireActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "Errore durante l'iscrizione", Toast.LENGTH_SHORT).show(); + }); + return null; + }); + }) + .setNegativeButton(R.string.cancel, (dialog, which) -> {}) + .create(); + } + + + public CompletableFuture subscribe(ParametriIscrizioneAppello parametriIscrizioneAppello) { + CalendarioEsamiService service = API.getService(CalendarioEsamiService.class); + Call call = service.postIscrizioneAppello( + appello.getCdsId(), + appello.getAdId(), + appello.getAppelloId(), + parametriIscrizioneAppello + ); + + Log.d(TAG, "Iscrizione appello: " + appello.getCodiceAttivitaDidattica()); + return API.enqueueResource(call); + } + + + public static String TAG = "ExamSubscribeDialogFragment"; +} diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/HomeFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/HomeFragment.java new file mode 100644 index 0000000..bdc527a --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/HomeFragment.java @@ -0,0 +1,179 @@ +package org.epic_guys.esse4.fragments; + +import android.os.Bundle; +import android.util.Log; +import androidx.core.util.Pair; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.navigation.NavController; +import androidx.navigation.NavOptions; +import androidx.navigation.fragment.NavHostFragment; +import de.adorsys.android.securestoragelibrary.SecurePreferences; +import org.epic_guys.esse4.API.API; +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.common.Common; +import org.epic_guys.esse4.models.Carriera; +import org.epic_guys.esse4.models.Persona; +import java.util.concurrent.CompletableFuture; + +public class HomeFragment extends Fragment { + + private NavController navController; + private CompletableFuture> basicDataFuture; + + private void launchLoginFragment() { + NavOptions navOptions = new NavOptions.Builder() + .setPopUpTo(R.id.homeFragment, true) + .build(); + navController.navigate(R.id.loginFragment, null, navOptions); + } + + + + private void setProfilePicture() { + ImageView profilePicture = requireView().findViewById(R.id.profile_picture); + + API.getPhoto().thenCompose(photo -> { + requireActivity().runOnUiThread(() -> profilePicture.setImageBitmap(photo)); + return null; + }); + } + + private void setBasicInfo(Persona p, Carriera c){ + + setProfilePicture(); + + requireView().findViewById(R.id.data_matricola).setText(p.getUserId()); + requireView().findViewById(R.id.text_name).setText(p.getNome()); + requireView().findViewById(R.id.text_surname).setText(p.getCognome()); + + requireView().findViewById(R.id.text_degree).setText(c.getDescrizioneCorsoDiLaurea()); + requireView().findViewById(R.id.data_year).setText(String.valueOf(c.getAnnoCorso())); + + if(c.isPartTime()) { + requireView().findViewById(R.id.text_part_time).setVisibility(View.VISIBLE); + } + + + } + + private Pair getCredsFromSecurePreferences() throws Exception{ + String matricola; + String password; + + matricola = SecurePreferences.getStringValue("matricola", requireContext(), ""); + password = SecurePreferences.getStringValue( "password", requireContext(), ""); + + if (matricola.equals("") || password.equals("")) { + Log.d("HomeFragment", "Secure preferences not set"); + throw new Exception("Secure preferences not set"); + } + + return new Pair<>(matricola, password); + } + + private void clearPreferences(){ + SecurePreferences.removeValue("matricola", requireContext()); + SecurePreferences.removeValue("password", requireContext()); + } + + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + navController = NavHostFragment.findNavController(this); + + String matricola; + String password; + + // checks if secure preferences are set, if not launch login activity + try{ + Pair creds = getCredsFromSecurePreferences(); + matricola = creds.first; + password = creds.second; + } + catch (Exception e) { + Log.d("HomeFragment", "Secure preferences not accessible"); + launchLoginFragment(); + return; + } + + + if(API.getLoggedPersona() != null) { + basicDataFuture = new CompletableFuture<>(); + basicDataFuture.complete(new Pair<>(API.getLoggedPersona(), API.getCarriera())); + return; + } + + basicDataFuture = API.login(matricola, password) + .exceptionally(e -> { + Log.d("HomeFragment", e.toString()); + return false; + }) + .thenCompose(isLogged -> { + if (isLogged) { + return API.getBasicData(); + } else { + clearPreferences(); + throw new RuntimeException("Failed to login"); + } + } + ); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_home, container, false); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + Common.startLoading(requireView().findViewById(R.id.window), requireView(), R.id.loading); + + basicDataFuture.thenAccept(personaCarrieraPair -> requireActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "Bentornat[ao] studente(?:ssa|)" /* + API.getLoggedPersona().getNome() */, Toast.LENGTH_SHORT).show(); + setBasicInfo(personaCarrieraPair.first, personaCarrieraPair.second); + Common.stopLoading(requireView().findViewById(R.id.window), requireView(), R.id.loading); + })).exceptionally(e -> { + Log.e("HomeFragment", e.toString()); + requireActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "Login fallito", Toast.LENGTH_SHORT).show(); + Log.d("HomeFragment", "Login fallito"); + + }); + launchLoginFragment(); + return null; + }); + + //logout button + view.findViewById(R.id.btn_logout).setOnClickListener(v -> { + SecurePreferences.removeValue("matricola", requireContext()); + SecurePreferences.removeValue("password", requireContext()); + launchLoginFragment(); + }); + + //study plan button + view.findViewById(R.id.card).setOnClickListener(v -> navController.navigate(R.id.action_homeFragment_to_studyPlanFragment)); + + //study book button + view.findViewById(R.id.btn_student_book).setOnClickListener(v -> navController.navigate(R.id.action_homeFragment_to_studentBookFragment)); + + view.findViewById(R.id.btn_exams).setOnClickListener(v -> navController.navigate( + HomeFragmentDirections.actionHomeFragmentToAppelliFragment( + API.getCarriera().getIdCarriera(), + -1 + ) + )); + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/LoginFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/LoginFragment.java new file mode 100644 index 0000000..04e541e --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/LoginFragment.java @@ -0,0 +1,95 @@ +package org.epic_guys.esse4.fragments; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import android.os.Bundle; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.fragment.app.Fragment; +import androidx.navigation.NavController; +import androidx.navigation.NavOptions; +import androidx.navigation.fragment.NavHostFragment; +import org.epic_guys.esse4.R; + +import org.epic_guys.esse4.API.API; + +import android.util.Log; + +import de.adorsys.android.securestoragelibrary.SecurePreferences; + +public class LoginFragment extends Fragment { + + private NavController navController; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + navController = NavHostFragment.findNavController(this); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_login, container, false); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + Button loginButton = view.findViewById(R.id.login_button); + loginButton.setOnClickListener(v -> { + + Log.i("LoginActivity", "Login Requested from button"); + + EditText matricolaInput = view.findViewById(R.id.textinput_matricola); + EditText passwordInput = view.findViewById(R.id.textinput_password); + + String matricola = matricolaInput.getText().toString(); + String password = passwordInput.getText().toString(); + + API.login(matricola, password).thenCompose(isLogged -> { + if (isLogged) + return API.getBasicData(); + else { + getActivity().runOnUiThread(() -> + Toast.makeText(getContext(), "Login fallito, proprio come te", Toast.LENGTH_SHORT).show() + ); + throw new RuntimeException("Failed to login"); + } + }).thenAccept(persona -> { + getActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "Login effettuato", Toast.LENGTH_SHORT).show(); + Log.i("LoginActivity", "Login effettuato"); + }); + + try { + SecurePreferences.setValue("matricola", matricola, getContext()); + SecurePreferences.setValue("password", password, getContext()); + + Log.i("LoginActivity", "Account added"); + } + catch (Exception e) { + Log.e("LoginActivity", "Failed to save credentials"); + } + + + // Intent mainActivity = new Intent(this, MainActivity.class); + // startActivity(mainActivity); + + NavOptions navOptions = new NavOptions.Builder() + .setPopUpTo(R.id.loginFragment, true) + .build(); + navController.navigate(R.id.action_loginFragment_to_homeFragment, null, navOptions); + + Log.i("LoginActivity", "Starting MainActivity, finishing LoginActivity"); + }); + + }); + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/StudentBookFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/StudentBookFragment.java new file mode 100644 index 0000000..c38b432 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/StudentBookFragment.java @@ -0,0 +1,94 @@ +package org.epic_guys.esse4.fragments; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.navigation.NavController; +import androidx.navigation.NavOptions; +import androidx.navigation.fragment.NavHostFragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + + +import org.epic_guys.esse4.API.API; +import org.epic_guys.esse4.API.services.LibrettoService; +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.models.RigaLibretto; +import org.epic_guys.esse4.views.SubjectCardAdapter; +import org.epic_guys.esse4.views.SubjectCardView; +import org.epic_guys.esse4.common.Common; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; + +public class StudentBookFragment extends Fragment { + private NavController navController; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + navController = NavHostFragment.findNavController(this); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_student_book, container, false); + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + List exams = new ArrayList<>(); + Common.startLoading(requireView().findViewById(R.id.exams),requireView(),R.id.loading); + + long idCarriera = API.getCarriera().getIdCarriera(); + LibrettoService librettoService = API.getService(LibrettoService.class); + Call> righeLibretto = librettoService.righeLibretto(idCarriera); + API.enqueueResource(righeLibretto) + .thenAccept(righe -> { + + for (RigaLibretto riga : righe) { + try { + View.OnClickListener onClickListener = v -> { + Log.d("StudentBookFragment", "onClick: " + riga.getDescrizioneAttivitaDidattica()); + + StudentBookFragmentDirections.ActionStudentBookFragmentToAppelloFragment action = + StudentBookFragmentDirections.actionStudentBookFragmentToAppelloFragment( + riga.getIdCarriera(), + riga.getIdRigaLibretto() + ); + + navController.navigate(action); + }; + exams.add(new SubjectCardView(getContext(), riga, onClickListener)); + } + catch(Exception e) { + e.printStackTrace(); + } + } + RecyclerView recyclerView = requireView().findViewById(R.id.exams); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + SubjectCardAdapter adapter = new SubjectCardAdapter(getContext(), exams); + recyclerView.setAdapter(adapter); + Common.stopLoading(requireView().findViewById(R.id.exams),requireView(),R.id.loading); + }); + + //when back button is pressed, go back to home fragment + view.findViewById(R.id.btn_back).setOnClickListener(v -> { + NavOptions navOptions = new NavOptions.Builder() + .setPopUpTo(R.id.homeFragment, true) + .build(); + navController.navigate(R.id.homeFragment, null, navOptions); + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/fragments/StudyPlanFragment.java b/app/src/main/java/org/epic_guys/esse4/fragments/StudyPlanFragment.java new file mode 100644 index 0000000..d0bd1e7 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/fragments/StudyPlanFragment.java @@ -0,0 +1,98 @@ +package org.epic_guys.esse4.fragments; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.navigation.NavController; +import androidx.navigation.NavOptions; +import androidx.navigation.fragment.NavHostFragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.epic_guys.esse4.API.API; +import org.epic_guys.esse4.API.services.PianiService; +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.common.Common; +import org.epic_guys.esse4.models.ADPianoDiStudio; +import org.epic_guys.esse4.models.PianoDiStudio; +import org.epic_guys.esse4.models.TestataPianoDiStudio; +import org.epic_guys.esse4.views.SubjectCardAdapter; +import org.epic_guys.esse4.views.SubjectCardView; + +import java.util.ArrayList; +import java.util.List; + +import retrofit2.Call; + +public class StudyPlanFragment extends Fragment { + private NavController navController; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + navController = NavHostFragment.findNavController(this); + + + + } + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_study_plan, container, false); + } + + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + List exams = new ArrayList<>(); + + long idStudente = API.getCarriera().getIdStudente(); + + Common.startLoading(requireView().findViewById(R.id.exams),requireView(),R.id.loading); + + PianiService pianiService = API.getService(PianiService.class); + Call> testataPianoDiStudio = pianiService.testataPianoDiStudio(idStudente); + API.enqueueResource(testataPianoDiStudio).thenCompose(testate -> { + TestataPianoDiStudio testata = testate.get(0); + Call righePianoDiStudio = pianiService.righePianoDiStudio(idStudente, testata.getPianoId()); + return API.enqueueResource(righePianoDiStudio); + }).thenAccept(righe -> { + for (ADPianoDiStudio riga : righe.getAttivita()) { + try { + Integer scePianoId = riga.getScePianoId(); + if(scePianoId == 6 || scePianoId == 7 || scePianoId == 8) { + exams.add(new SubjectCardView(this.getContext(), 0L, riga.getAdLibCod() + " - " + riga.getAdLibDes(), Integer.toString(riga.getAnnoCorso()), String.valueOf(riga.getPeso().intValue()), null, null)); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + RecyclerView recyclerView = requireView().findViewById(R.id.exams); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + SubjectCardAdapter adapter = new SubjectCardAdapter(getContext(), exams); + recyclerView.setAdapter(adapter); + Common.stopLoading(requireView().findViewById(R.id.exams),requireView(),R.id.loading); + }).exceptionally(throwable -> { + throwable.printStackTrace(); + return null; + }); + + //when back button is pressed, go back to home fragment + view.findViewById(R.id.btn_back).setOnClickListener(v -> { + NavOptions navOptions = new NavOptions.Builder() + .setPopUpTo(R.id.homeFragment, true) + .build(); + navController.navigate(R.id.homeFragment, null, navOptions); + }); + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/ADPianoDiStudio.java b/app/src/main/java/org/epic_guys/esse4/models/ADPianoDiStudio.java new file mode 100644 index 0000000..e5187f6 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/ADPianoDiStudio.java @@ -0,0 +1,308 @@ +package org.epic_guys.esse4.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ADPianoDiStudio { + @SerializedName("stuId") + private Long stuId = null; + + @SerializedName("pianoId") + private Integer pianoId = null; + + @SerializedName("scePianoId") + private Integer scePianoId = null; + + @SerializedName("itmId") + private Integer itmId = null; + + @SerializedName("matId") + private Long matId = null; + + @SerializedName("schemaId") + private Long schemaId = null; + + @SerializedName("sceltaId") + private Long sceltaId = null; + + @SerializedName("sceltaAdId") + private Integer sceltaAdId = null; + + @SerializedName("chiaveADContestualizzata") + private AttivitaDidatticaContestualizzata chiaveADContestualizzata = null; + + @SerializedName("adsceId") + private Long adsceId = null; + + @SerializedName("adsceAttId") + private Long adsceAttId = null; + + @SerializedName("sceltaFlg") + private Integer sceltaFlg = null; + + @SerializedName("tesorettoFlg") + private Integer tesorettoFlg = null; + + @SerializedName("ragId") + private Integer ragId = null; + + @SerializedName("adragoffId") + private Long adragoffId = null; + + @SerializedName("tipoRagCod") + private String tipoRagCod = null; + + @SerializedName("adLibCod") + private String adLibCod = null; + + @SerializedName("adLibDes") + private String adLibDes = null; + + @SerializedName("peso") + private Float peso = null; + + @SerializedName("pesoAdVis") + private Float pesoAdVis = null; + + @SerializedName("linguaSceCod") + private String linguaSceCod = null; + + @SerializedName("linguaSceNum") + private Long linguaSceNum = null; + + @SerializedName("udSelezionate") + private List udSelezionate = null; + + @SerializedName("conteggiabileFlg") + private Integer conteggiabileFlg = null; + + @SerializedName("deliberaFlg") + private Integer deliberaFlg = null; + + @SerializedName("statoAttuazione") + private Integer statoAttuazione = null; + + @SerializedName("partEffCod") + private String partEffCod = null; + + @SerializedName("linguaDidId") + private String linguaDidId = null; + + @SerializedName("linguaDidCod") + private String linguaDidCod = null; + + @SerializedName("linguaDidDes") + private String linguaDidDes = null; + + @SerializedName("tipoDidCod") + private String tipoDidCod = null; + + @SerializedName("tipoDidDes") + private String tipoDidDes = null; + + @SerializedName("grpAdlogCod") + private String grpAdlogCod = null; + + @SerializedName("grpAdlogDes") + private String grpAdlogDes = null; + + @SerializedName("annoCorso") + private Integer annoCorso = null; + + @SerializedName("annoCorsoAnticipo") + private Integer annoCorsoAnticipo = null; + + public Long getStuId() { + return stuId; + } + + public Integer getPianoId() { + return pianoId; + } + + public Integer getScePianoId() { + return scePianoId; + } + + public Integer getItmId() { + return itmId; + } + + public Long getMatId() { + return matId; + } + + public Long getSchemaId() { + return schemaId; + } + + public Long getSceltaId() { + return sceltaId; + } + + public Integer getSceltaAdId() { + return sceltaAdId; + } + + public AttivitaDidatticaContestualizzata getChiaveADContestualizzata() { + return chiaveADContestualizzata; + } + + public Long getAdsceId() { + return adsceId; + } + + public Long getAdsceAttId() { + return adsceAttId; + } + + public Integer getSceltaFlg() { + return sceltaFlg; + } + + public Integer getTesorettoFlg() { + return tesorettoFlg; + } + + public Integer getRagId() { + return ragId; + } + + public Long getAdragoffId() { + return adragoffId; + } + + public String getTipoRagCod() { + return tipoRagCod; + } + + public String getAdLibCod() { + return adLibCod; + } + + public String getAdLibDes() { + return adLibDes; + } + + public Float getPeso() { + return peso; + } + + public Float getPesoAdVis() { + return pesoAdVis; + } + + public String getLinguaSceCod() { + return linguaSceCod; + } + + public Long getLinguaSceNum() { + return linguaSceNum; + } + + public List getUdSelezionate() { + return udSelezionate; + } + + public Integer getConteggiabileFlg() { + return conteggiabileFlg; + } + + public Integer getDeliberaFlg() { + return deliberaFlg; + } + + public Integer getStatoAttuazione() { + return statoAttuazione; + } + + public String getPartEffCod() { + return partEffCod; + } + + public String getLinguaDidId() { + return linguaDidId; + } + + public String getLinguaDidCod() { + return linguaDidCod; + } + + public String getLinguaDidDes() { + return linguaDidDes; + } + + public String getTipoDidCod() { + return tipoDidCod; + } + + public String getTipoDidDes() { + return tipoDidDes; + } + + public String getGrpAdlogCod() { + return grpAdlogCod; + } + + public String getGrpAdlogDes() { + return grpAdlogDes; + } + + public Integer getAnnoCorso() { + return annoCorso; + } + + public Integer getAnnoCorsoAnticipo() { + return annoCorsoAnticipo; + } + + @Override + public String toString() { + return "ADPianoDiStudio{" + + "stuId=" + stuId + + ", pianoId=" + pianoId + + ", scePianoId=" + scePianoId + + ", itmId=" + itmId + + ", matId=" + matId + + ", schemaId=" + schemaId + + ", sceltaId=" + sceltaId + + ", sceltaAdId=" + sceltaAdId + + ", chiaveADContestualizzata=" + chiaveADContestualizzata + + ", adsceId=" + adsceId + + ", adsceAttId=" + adsceAttId + + ", sceltaFlg=" + sceltaFlg + + ", tesorettoFlg=" + tesorettoFlg + + ", ragId=" + ragId + + ", adragoffId=" + adragoffId + + ", tipoRagCod='" + tipoRagCod + '\'' + + ", adLibCod='" + adLibCod + '\'' + + ", adLibDes='" + adLibDes + '\'' + + ", peso=" + peso + + ", pesoAdVis=" + pesoAdVis + + ", linguaSceCod='" + linguaSceCod + '\'' + + ", linguaSceNum=" + linguaSceNum + + ", udSelezionate=" + udSelezionate + + ", conteggiabileFlg=" + conteggiabileFlg + + ", deliberaFlg=" + deliberaFlg + + ", statoAttuazione=" + statoAttuazione + + ", partEffCod='" + partEffCod + '\'' + + ", linguaDidId='" + linguaDidId + '\'' + + ", linguaDidCod='" + linguaDidCod + '\'' + + ", linguaDidDes='" + linguaDidDes + '\'' + + ", tipoDidCod='" + tipoDidCod + '\'' + + ", tipoDidDes='" + tipoDidDes + '\'' + + ", grpAdlogCod='" + grpAdlogCod + '\'' + + ", grpAdlogDes='" + grpAdlogDes + '\'' + + ", annoCorso=" + annoCorso + + ", annoCorsoAnticipo=" + annoCorsoAnticipo + + '}'; + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/Appello.java b/app/src/main/java/org/epic_guys/esse4/models/Appello.java new file mode 100644 index 0000000..81922a7 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/Appello.java @@ -0,0 +1,524 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; + +import org.epic_guys.esse4.common.EnumAdapter; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; + +/** + * Appello + */ + +public class Appello { + + + @SerializedName("datacalId") + private Long datacalId = null; + + @SerializedName("capostipiteId") + private Long capostipiteId = null; + + @SerializedName("commPianId") + private Long commPianId = null; + + @SerializedName("indexId") + private Long indexId = null; + + @SerializedName("periodoId") + private Long periodoId = null; + + @SerializedName("numVerbaliGen") + private Integer numVerbaliGen = null; + + @SerializedName("numVerbaliCar") + private Integer numVerbaliCar = null; + + @SerializedName("numPubblicazioni") + private Integer numPubblicazioni = null; + + @SerializedName("numIscritti") + private Integer numIscritti = null; + + @SerializedName("statoLog") + private String statoLog = null; + + @SerializedName("statoAperturaApp") + private String statoAperturaApp = null; + + @JsonAdapter(StatoEnum.Adapter.class) + public enum StatoEnum { + /** + * Da iniziare + */ + C("C", "Da iniziare"), + + /** + * In fase di svolgimento + */ + A("A", "In fase di svolgimento"), + + /** + * Concluso + */ + F("F", "Concluso"); + + private final String value; + private final String description; + + StatoEnum(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static class Adapter extends EnumAdapter { + + @Override + public Class getTClass() { + return StatoEnum.class; + } + } + } + + /** + * stato del processo di verbalizzazione degli esiti. I relaviti Valori sono (C=da iniziare, A=in fase di svolgimento, F= concluso) + */ + @SerializedName("statoVerb") + private StatoEnum statoVerb = null; + + /** + * stato del processo di pubblicazione esiti. I relaviti Valori sono (C=da iniziare, A=in fase di svolgimento, F= concluso) + */ + @SerializedName("statoPubblEsiti") + private StatoEnum statoPubblEsiti = null; + + /** + * stato del processo di inserimento esiti. I relaviti Valori sono (C=da iniziare, A=in fase di svolgimento, F= concluso) + */ + @SerializedName("statoInsEsiti") + private StatoEnum statoInsEsiti = null; + + @SerializedName("statoDes") + private String statoDes = null; + + @SerializedName("stato") + private String stato = null; + + @SerializedName("presidenteNome") + private String presidenteNome = null; + + @SerializedName("presidenteCognome") + private String presidenteCognome = null; + + @SerializedName("presidenteId") + private Long presidenteId = null; + + @SerializedName("tipoGestPrenDes") + private String tipoGestPrenDes = null; + + @SerializedName("tipoGestAppDes") + private String tipoGestAppDes = null; + + @SerializedName("tipoDefAppDes") + private String tipoDefAppDes = null; + + @SerializedName("adDes") + private String adDes = null; + + @SerializedName("adCod") + private String adCod = null; + + @SerializedName("cdsDes") + private String cdsDes = null; + + @SerializedName("cdsCod") + private String cdsCod = null; + + @SerializedName("tipoAppCod") + private String tipoAppCod = null; + + @SerializedName("appId") + private Integer appId = null; + + @SerializedName("appelloId") + private Long appelloId = null; + + @SerializedName("aaCalId") + private Integer aaCalId = null; + + @SerializedName("noteSistLog") + private String noteSistLog = null; + + @SerializedName("note") + private String note = null; + + @SerializedName("tagTemplId") + private Long tagTemplId = null; + + @SerializedName("sedeId") + private Long sedeId = null; + + @SerializedName("gruppoVotoId") + private Long gruppoVotoId = null; + + @SerializedName("condId") + private Long condId = null; + + @SerializedName("tipoSceltaTurno") + private Integer tipoSceltaTurno = null; + + @SerializedName("riservatoFlg") + private Integer riservatoFlg = null; + + @SerializedName("oraEsa") + private String oraEsa = null; + + @SerializedName("dataInizioApp") + private String dataInizioApp = null; + + @SerializedName("dataFineIscr") + private String dataFineIscr = null; + + @SerializedName("dataInizioIscr") + private String dataInizioIscr = null; + + /** + * modalità dell'esame definita nell'appello (valorizzata se il par_conf=CONTR_TIPO_ESA_APP=0), i possibili valori sono ( Scritto=S, Orale=O, Scritto e Orale Congiunto=SOC, Scritto e Orale Separato=SOS). + */ + @JsonAdapter(TipoEsaCodEnum.Adapter.class) + public enum TipoEsaCodEnum { + S("S", "Scritto"), + + O("O", "Orale"), + + SOC("SOC", "Scritto e Orale Congiunto"), + + SOS("SOS", "Scritto e Orale Separato"); + + private String value; + private String description; + + TipoEsaCodEnum(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return TipoEsaCodEnum.class; + } + } + } + + @SerializedName("tipoEsaCod") + private TipoEsaCodEnum tipoEsaCod = null; + + /** + * modalità di iscrizione definita nell'appello, i possibili valori sono ( Scritto=S, Orale=O, Scritto e Orale=SO). + */ + @JsonAdapter(TipoIscrCodEnum.Adapter.class) + public enum TipoIscrCodEnum { + S("S", "Scritto"), + + O("O", "Orale"), + + SO("SO", "Scritto e Orale"); + + private String value; + private String description; + + TipoIscrCodEnum(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return TipoIscrCodEnum.class; + } + } + } + + @SerializedName("tipoIscrCod") + private TipoIscrCodEnum tipoIscrCod = null; + + @SerializedName("tipoGestPrenCod") + private String tipoGestPrenCod = null; + + @SerializedName("tipoGestAppCod") + private String tipoGestAppCod = null; + + @SerializedName("tipoDefAppCod") + private String tipoDefAppCod = null; + + @SerializedName("desApp") + private String desApp = null; + + @SerializedName("adId") + private Long adId = null; + + @SerializedName("cdsId") + private Long cdsId = null; + + + + + public static DateTimeFormatter getDateTimeFormatter() { + return DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss"); + } + + + public String getDescrizioneAppello() { + return desApp; + } + + public Long getDatacalId() { + return datacalId; + } + + public Long getCapostipiteId() { + return capostipiteId; + } + + public Long getCommPianId() { + return commPianId; + } + + public Long getIndexId() { + return indexId; + } + + public Long getPeriodoId() { + return periodoId; + } + + public Integer getNumVerbaliGen() { + return numVerbaliGen; + } + + public Integer getNumVerbaliCar() { + return numVerbaliCar; + } + + public Integer getNumPubblicazioni() { + return numPubblicazioni; + } + + public Integer getNumIscritti() { + return numIscritti; + } + + public String getStatoLog() { + return statoLog; + } + + public String getStatoAperturaApp() { + return statoAperturaApp; + } + + public StatoEnum getStatoVerb() { + return statoVerb; + } + + public StatoEnum getStatoPubblEsiti() { + return statoPubblEsiti; + } + + public StatoEnum getStatoInsEsiti() { + return statoInsEsiti; + } + + public String getStatoDes() { + return statoDes; + } + + public String getStato() { + return stato; + } + + public String getPresidenteNome() { + return presidenteNome; + } + + public String getPresidenteCognome() { + return presidenteCognome; + } + + public String getPresidenteNomeCognome() { + return presidenteNome + ' ' + presidenteCognome; + } + + public Long getPresidenteId() { + return presidenteId; + } + + public String getTipoGestPrenDes() { + return tipoGestPrenDes; + } + + public String getTipoGestAppDes() { + return tipoGestAppDes; + } + + public String getTipoDefAppDes() { + return tipoDefAppDes; + } + + public String getDescrizioneAttivitaDidattica() { + return adDes; + } + + public String getCodiceAttivitaDidattica() { + return adCod; + } + + public String getCdsDes() { + return cdsDes; + } + + public String getCdsCod() { + return cdsCod; + } + + public String getTipoAppCod() { + return tipoAppCod; + } + + public Integer getAppId() { + return appId; + } + + public Long getAppelloId() { + return appelloId; + } + + public Integer getAaCalId() { + return aaCalId; + } + + public String getNoteSistLog() { + return noteSistLog; + } + + public String getNote() { + return note; + } + + public Long getTagTemplId() { + return tagTemplId; + } + + public Long getSedeId() { + return sedeId; + } + + public Long getGruppoVotoId() { + return gruppoVotoId; + } + + public Long getCondId() { + return condId; + } + + public Integer getTipoSceltaTurno() { + return tipoSceltaTurno; + } + + public Integer getRiservatoFlg() { + return riservatoFlg; + } + + public String getOraEsa() { + return oraEsa; + } + + /** + * La data è sempre 01/01/1990 quindi viene scartata. + * Restituire solo l'ora dell'esame. + * @return l'ora dell'esame. + */ + public LocalTime getOraEsame() { + return Appello.getDateTimeFormatter().parse(oraEsa, LocalTime::from); + } + + public String getDataInizioApp() { + return dataInizioApp; + } + + public LocalDate getDataInizioAppello() { + return Appello.getDateTimeFormatter().parse(dataInizioApp, LocalDate::from); + } + + public LocalDateTime getDataOraEsame() { + return getDataInizioAppello().atTime(getOraEsame()); + } + + + + public String getDataFineIscr() { + return dataFineIscr.substring(0, dataFineIscr.length() - 9); + } + + public String getDataInizioIscr() { + return dataInizioIscr.substring(0, dataFineIscr.length() - 9); + } + + public TipoEsaCodEnum getTipoEsame() { + return tipoEsaCod; + } + + public TipoIscrCodEnum getTipoIscrizione() { + return tipoIscrCod; + } + + public String getTipoGestPrenCod() { + return tipoGestPrenCod; + } + + public String getTipoGestAppCod() { + return tipoGestAppCod; + } + + public String getTipoDefAppCod() { + return tipoDefAppCod; + } + + public String getDesApp() { + return desApp; + } + + public Long getAdId() { + return adId; + } + + public Long getCdsId() { + return cdsId; + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/models/AppelloLibretto.java b/app/src/main/java/org/epic_guys/esse4/models/AppelloLibretto.java new file mode 100644 index 0000000..8b6c42f --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/AppelloLibretto.java @@ -0,0 +1,65 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.annotations.SerializedName; + +/** + * AppelloLibretto + */ +public class AppelloLibretto extends Appello { + @SerializedName("matId") + private Long matId = null; + + @SerializedName("adsceId") + private Long adsceId = null; + + @SerializedName("adStuCod") + private String adStuCod = null; + + @SerializedName("adStuDes") + private String adStuDes = null; + + @SerializedName("staSceCod") + private String staSceCod = null; + + /** + * Id della testata del libretto + * @return matId + **/ + public Long getIdCarriera() { + return matId; + } + + /** + * Id della riga del libretto + * @return adsceId + **/ + public Long getIdRigaLibretto() { + return adsceId; + } + + /** + * codice dell'attività didattica del libretto + * @return adStuCod + **/ + public String getAdStuCod() { + return adStuCod; + } + + /** + * descrizione dell'attività didattica del libretto + * @return adStuDes + **/ + public String getAdStuDes() { + return adStuDes; + } + + /** + * Stato dell\\'attività didattica (codice) + * @return staSceCod + **/ + public String getStaSceCod() { + return staSceCod; + } + +} + diff --git a/app/src/main/java/org/epic_guys/esse4/models/AttivitaDidatticaContestualizzata.java b/app/src/main/java/org/epic_guys/esse4/models/AttivitaDidatticaContestualizzata.java new file mode 100644 index 0000000..ae5d9e3 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/AttivitaDidatticaContestualizzata.java @@ -0,0 +1,182 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.annotations.SerializedName; + +/** + * Attività Didattica Contestualizzata + */ +public class AttivitaDidatticaContestualizzata { + @SerializedName("cdsId") + private Long cdsId = null; + + @SerializedName("cdsCod") + private String cdsCod = null; + + @SerializedName("cdsDes") + private String cdsDes = null; + + @SerializedName("aaOrdId") + private Integer aaOrdId = null; + + @SerializedName("aaOrdCod") + private String aaOrdCod = null; + + @SerializedName("aaOrdDes") + private String aaOrdDes = null; + + @SerializedName("pdsId") + private Long pdsId = null; + + @SerializedName("pdsCod") + private String pdsCod = null; + + @SerializedName("pdsDes") + private String pdsDes = null; + + @SerializedName("aaOffId") + private Long aaOffId = null; + + @SerializedName("adId") + private Long adId = null; + + @SerializedName("adCod") + private String adCod = null; + + @SerializedName("adDes") + private String adDes = null; + + @SerializedName("afId") + private Long afId = null; + + /** + * chiave del corso di studio di erogazione dell'attività didattica + * + * @return cdsId + **/ + public Long getIdCorsoDiStudio() { + return cdsId; + } + + /** + * codice del corso di studio di erogazione dell'attività didattica + * + * @return cdsCod + **/ + public String getCodiceCorsoDiStudio() { + return cdsCod; + } + + /** + * descrizione del corso di erogazione dell'attività didattica + * + * @return cdsDes + **/ + public String getDescrizioneCorsoDiStudio() { + return cdsDes; + } + + /** + * anno di ordinamento del corso di studio di erogazione dell'attività didattica + * + * @return aaOrdId + **/ + public Integer getAaOrdId() { + return aaOrdId; + } + + /** + * codice dell''ordinamento di erogazione dell'attività didattica + * + * @return aaOrdCod + **/ + public String getAaOrdCod() { + return aaOrdCod; + } + + /** + * descrizione dell''ordinamento di erogazione dell'attività didattica + * + * @return aaOrdDes + **/ + public String getAaOrdDes() { + return aaOrdDes; + } + + + /** + * chiave del percorso di studio di erogazione dell'attività didattica + * + * @return pdsId + **/ + public Long getPdsId() { + return pdsId; + } + + /** + * codice del percorso di erogazione dell'attività didattica + * + * @return pdsCod + **/ + public String getPdsCod() { + return pdsCod; + } + + /** + * descrizione del percorso di erogazione dell'attività didattica + * + * @return pdsDes + **/ + public String getPdsDes() { + return pdsDes; + } + + + /** + * anno di offerta di erogazione dell'attività didattica + * + * @return aaOffId + **/ + public Long getAaOffId() { + return aaOffId; + } + + + /** + * chiave dell'attività didattica + * + * @return adId + **/ + public Long getIdAttivitaDidattica() { + return adId; + } + + + /** + * codice dell''attività didattica + * + * @return adCod + **/ + public String getCodiceAttivitaDidattica() { + return adCod; + } + + /** + * descrizione dell''attività didattica + * + * @return adDes + **/ + public String getDescrizioneAttivitaDidattica() { + return adDes; + } + + + /** + * id della afId proveniente da U-Gov Didattica + * + * @return afId + **/ + public Long getAfId() { + return afId; + } + +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/Carriera.java b/app/src/main/java/org/epic_guys/esse4/models/Carriera.java new file mode 100644 index 0000000..9c43d5f --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/Carriera.java @@ -0,0 +1,311 @@ +package org.epic_guys.esse4.models; + +public class Carriera implements ApiResource { + public static final int FULL_TIME = 0; + public static final int PART_TIME = 1; + + private long persId; + private String cognome; + private String nome; + private String dataNascita; + private String sesso; + private String userId; + private String codFis; + private String email; + private String emailAte; + private String staStuCod; + private String motStastuCod; + private int aaId; + private String dataImm; + private String statiStuDes; + private String motStastuDes; + private String numProtocollo; + private String dataIns; + private String dataMod; + private String domCtStato; + private String statiDomCtDes; + private String aaDes; + private int aaIscrId; + private String matricola; + private int sedeId; + private String sediDes; + private int annoCorso; + private String lingue; + private String dataIscr; + private String settCod; + private String settDes; + private String areaCod; + private String areaDes; + private String areaCodStatMiur; + private String sdrCod; + private String sdrDes; + private int sdrCsaCod; + private String facCod; + private String facDes; + private String facCsaCod; + private int idAb; + private String extStuCod; + private int attlauFlg; + private String dataAttlau; + private int tipoCatAmmId; + private String tipoCatAmmDes; + private String profstuCod; + private String profstuDes; + private String staMatCod; + private String motStamatCod; + private String tipoIscrCod; + private int ptFlg; + private int sospFlg; + private String p06CdsCod; + private String p06CdsDes; + private long matId; + private long aaOrdId; + private long pdsId; + private long iscrId; + private long cdsId; + private long stuId; + + public long getPersId() { + return persId; + } + + public String getCognome() { + return cognome; + } + + public String getNome() { + return nome; + } + + public String getDataNascita() { + return dataNascita; + } + + public String getSesso() { + return sesso; + } + + public String getUserId() { + return userId; + } + + public String getCodFis() { + return codFis; + } + + public String getEmail() { + return email; + } + + public String getEmailAte() { + return emailAte; + } + + public String getStaStuCod() { + return staStuCod; + } + + public String getMotStastuCod() { + return motStastuCod; + } + + public int getAaId() { + return aaId; + } + + public String getDataImm() { + return dataImm; + } + + public String getStatiStuDes() { + return statiStuDes; + } + + public String getMotStastuDes() { + return motStastuDes; + } + + public String getNumProtocollo() { + return numProtocollo; + } + + public String getDataIns() { + return dataIns; + } + + public String getDataMod() { + return dataMod; + } + + public String getDomCtStato() { + return domCtStato; + } + + public String getStatiDomCtDes() { + return statiDomCtDes; + } + + public String getAaDes() { + return aaDes; + } + + public int getAaIscrId() { + return aaIscrId; + } + + public String getMatricola() { + return matricola; + } + + public int getSedeId() { + return sedeId; + } + + public String getSediDes() { + return sediDes; + } + + public int getAnnoCorso() { + return annoCorso; + } + + public String getLingue() { + return lingue; + } + + public String getDataIscr() { + return dataIscr; + } + + public String getSettCod() { + return settCod; + } + + public String getSettDes() { + return settDes; + } + + public String getAreaCod() { + return areaCod; + } + + public String getAreaDes() { + return areaDes; + } + + public String getAreaCodStatMiur() { + return areaCodStatMiur; + } + + public String getSdrCod() { + return sdrCod; + } + + public String getSdrDes() { + return sdrDes; + } + + public int getSdrCsaCod() { + return sdrCsaCod; + } + + public String getFacCod() { + return facCod; + } + + public String getFacDes() { + return facDes; + } + + public String getFacCsaCod() { + return facCsaCod; + } + + public int getIdAb() { + return idAb; + } + + public String getExtStuCod() { + return extStuCod; + } + + public int getAttlauFlg() { + return attlauFlg; + } + + public String getDataAttlau() { + return dataAttlau; + } + + public int getTipoCatAmmId() { + return tipoCatAmmId; + } + + public String getTipoCatAmmDes() { + return tipoCatAmmDes; + } + + public String getProfstuCod() { + return profstuCod; + } + + public String getProfstuDes() { + return profstuDes; + } + + public String getStaMatCod() { + return staMatCod; + } + + public String getMotStamatCod() { + return motStamatCod; + } + + public String getTipoIscrCod() { + return tipoIscrCod; + } + + public int getPartTimeFlag() { + return ptFlg; + } + + public boolean isPartTime() { + return ptFlg == PART_TIME; + } + + public int getSospFlg() { + return sospFlg; + } + + public String getCodiceCorsoDiLaurea() { + return p06CdsCod; + } + + public String getDescrizioneCorsoDiLaurea() { + return p06CdsDes; + } + + public long getIdCarriera() { + return matId; + } + + public long getAaOrdId() { + return aaOrdId; + } + + public long getPdsId() { + return pdsId; + } + + public long getIscrId() { + return iscrId; + } + + public long getCdsId() { + return cdsId; + } + + public long getIdStudente() { + return stuId; + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/Esito.java b/app/src/main/java/org/epic_guys/esse4/models/Esito.java new file mode 100644 index 0000000..aeb4904 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/Esito.java @@ -0,0 +1,175 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; + +/** + * Esito + */ +public class Esito { + /** + * Tipo di modalità con cui viene valutato l'esame. Può assumere i valori V oppure G, se il valore è V allora al momento del superamento viene valorizzato il campo voto, altrimenti se il valore è G viene valorizzato il campo tipo_giud_cod + */ + + @JsonAdapter(ModValCodEnum.Adapter.class) + public enum ModValCodEnum { + V("V", "Voto"), + + G("G", "Giudizio"); + + private String value; + private String descrizione; + + ModValCodEnum(String value, String descrizione) { + this.value = value; + this.descrizione = descrizione; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModValCodEnum fromValue(String text) { + for (ModValCodEnum b : ModValCodEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ModValCodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModValCodEnum read(final JsonReader jsonReader) throws IOException { + jsonReader.beginObject(); + jsonReader.nextName(); + String value = jsonReader.nextString(); + jsonReader.endObject(); + return ModValCodEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("modValCod") + private ModValCodEnum modValCod = null; + + @SerializedName("supEsaFlg") + private Integer supEsaFlg = null; + + @SerializedName("voto") + private Float voto = null; + + @SerializedName("lodeFlg") + private Integer lodeFlg = null; + + @SerializedName("tipoGiudCod") + private String tipoGiudCod = null; + + @SerializedName("tipoGiudDes") + private String tipoGiudDes = null; + + @SerializedName("dataEsa") + private String dataEsa = null; + + @SerializedName("aaSupId") + private Integer aaSupId = null; + + + /** + * Tipo di modalità con cui viene valutato l'esame. Può assumere i valori V oppure G, se il valore è V allora al momento del superamento viene valorizzato il campo voto, altrimenti se il valore è G viene valorizzato il campo tipo_giud_cod + * + * @return modValCod + **/ + public ModValCodEnum getModValCod() { + return modValCod; + } + + + /** + * flag che indica se l''esito è positivo + * minimum: 0 + * maximum: 1 + * + * @return supEsaFlg + **/ + public Integer getEsameSuperatoFlag() { + return supEsaFlg; + } + + public boolean isSuperato() { + return getEsameSuperatoFlag() == 1; + } + + /** + * voto, valorizzato se modValCod è V. Gli esiti delle prove finali (cioè quelle che prevedono il caricamento nella riga di libretto) sono INTERI, gli esti di prove parziali invece possono avere 2 cifre decimali + * + * @return voto + **/ + public Float getVoto() { + return voto; + } + + /** + * flag che indica la lode, impostato a 1 solo per modValCod è V e la lode deve essere impostata + * minimum: 0 + * maximum: 1 + * + * @return lodeFlg + **/ + public Integer getLodeFlag() { + return lodeFlg; + } + + /** + * codice che indica il tipo di giudizio utilizzato, valorizzato solo se modValCod è G + * + * @return tipoGiudCod + **/ + public String getTipoGiudCod() { + return tipoGiudCod; + } + + /** + * descrizione che indica il tipo di giudizio utilizzato, valorizzato solo se modValCod è G + * + * @return tipoGiudDes + **/ + public String getTipoGiudDes() { + return tipoGiudDes; + } + + + /** + * data della prova, il formato con cui deve essere definita la data è DD/MM/YYYY + * + * @return dataEsa + **/ + public String getDataEsa() { + return dataEsa; + } + + + /** + * anno di superamento della prova + * + * @return aaSupId + **/ + public Integer getAaSupId() { + return aaSupId; + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/ParametriIscrizioneAppello.java b/app/src/main/java/org/epic_guys/esse4/models/ParametriIscrizioneAppello.java new file mode 100644 index 0000000..bd39397 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/ParametriIscrizioneAppello.java @@ -0,0 +1,160 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.annotations.SerializedName; + +/** + * ParametriIscrizioneAppello + */ +public class ParametriIscrizioneAppello { + @SerializedName("adsceId") + private long adsceId; + + @SerializedName("tipoIscrStu") + private Appello.TipoIscrCodEnum tipoIscrStu = null; + + @SerializedName("notaStu") + private String notaStu = null; + + @SerializedName("appLogId") + private Integer appLogId = null; + + @SerializedName("tagCod") + private String tagCod = null; + + @SerializedName("attoreCod") + private String attoreCod = null; + + @SerializedName("tipoSvolgimentoEsame") + private String tipoSvolgimentoEsame = null; + + public ParametriIscrizioneAppello(long idRigaLibretto) { + this.adsceId = idRigaLibretto; + } + + + public ParametriIscrizioneAppello adsceId(Long adsceId) { + this.adsceId = adsceId; + return this; + } + + /** + * id della riga di libretto da prenotare + * minimum: 1 + * @return adsceId + **/ + + public long getAdsceId() { + return adsceId; + } + + public void setAdsceId(Long adsceId) { + this.adsceId = adsceId; + } + + public ParametriIscrizioneAppello tipoIscrStu(Appello.TipoIscrCodEnum tipoIscrStu) { + this.tipoIscrStu = tipoIscrStu; + return this; + } + + /** + * tipo di iscrizione dello studente + * @return tipoIscrStu + **/ + public Appello.TipoIscrCodEnum getTipoIscrStu() { + return tipoIscrStu; + } + + public void setTipoIscrStu(Appello.TipoIscrCodEnum tipoIscrStu) { + this.tipoIscrStu = tipoIscrStu; + } + + public ParametriIscrizioneAppello notaStu(String notaStu) { + this.notaStu = notaStu; + return this; + } + + /** + * nota dello studente inserita in fase di prenotazione + * @return notaStu + **/ + public String getNotaStu() { + return notaStu; + } + + public void setNotaStu(String notaStu) { + this.notaStu = notaStu; + } + + public ParametriIscrizioneAppello appLogId(Integer appLogId) { + this.appLogId = appLogId; + return this; + } + + /** + * eventuale turno a cui prenotare lo studente, se vuoto viene assegnato dal sistema + * minimum: 1 + * @return appLogId + **/ + public Integer getAppLogId() { + return appLogId; + } + + public void setAppLogId(Integer appLogId) { + this.appLogId = appLogId; + } + + public ParametriIscrizioneAppello tagCod(String tagCod) { + this.tagCod = tagCod; + return this; + } + + /** + * tag selezionato dallo studente in fase di prenotazione + * @return tagCod + **/ + + public String getTagCod() { + return tagCod; + } + + public void setTagCod(String tagCod) { + this.tagCod = tagCod; + } + + public ParametriIscrizioneAppello attoreCod(String attoreCod) { + this.attoreCod = attoreCod; + return this; + } + + /** + * eventuale tipo di attore con cui si vuole effettuare la preotazione, valido solo se l'utente che effettua la chiamata è un utente tecnico + * @return attoreCod + **/ + + public String getAttoreCod() { + return attoreCod; + } + + public void setAttoreCod(String attoreCod) { + this.attoreCod = attoreCod; + } + + public ParametriIscrizioneAppello tipoSvolgimentoEsame(String tipoSvolgimentoEsame) { + this.tipoSvolgimentoEsame = tipoSvolgimentoEsame; + return this; + } + + /** + * tipo di svolgimento esame, se null viene imposato il default previsto nella tipi_gest_app, altrimenti viene inserito il valore richiesto. Lo studente può selezionare solo il default oppure un valore con richiesta_flg = 1 + * @return tipoSvolgimentoEsame + **/ + + public String getTipoSvolgimentoEsame() { + return tipoSvolgimentoEsame; + } + + public void setTipoSvolgimentoEsame(String tipoSvolgimentoEsame) { + this.tipoSvolgimentoEsame = tipoSvolgimentoEsame; + } +} + diff --git a/app/src/main/java/org/epic_guys/esse4/models/PianoDiStudio.java b/app/src/main/java/org/epic_guys/esse4/models/PianoDiStudio.java new file mode 100644 index 0000000..7dba601 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/PianoDiStudio.java @@ -0,0 +1,107 @@ +package org.epic_guys.esse4.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import org.epic_guys.esse4.models.TestataPianoDiStudio; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class PianoDiStudio extends TestataPianoDiStudio { + @SerializedName("regole") + private List regole = null; + + @SerializedName("attivita") + private List attivita = null; + + public PianoDiStudio regole(List regole) { + this.regole = regole; + return this; + } + + public PianoDiStudio addRegoleItem(ScePianoDiStudio regoleItem) { + if (this.regole == null) { + this.regole = new ArrayList(); + } + this.regole.add(regoleItem); + return this; + } + + public List getRegole() { + return regole; + } + + public void setRegole(List regole) { + this.regole = regole; + } + + public PianoDiStudio attivita(List attivita) { + this.attivita = attivita; + return this; + } + + public PianoDiStudio addAttivitaItem(ADPianoDiStudio attivitaItem) { + if (this.attivita == null) { + this.attivita = new ArrayList(); + } + this.attivita.add(attivitaItem); + return this; + } + + public List getAttivita() { + return attivita; + } + + public void setAttivita(List attivita) { + this.attivita = attivita; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PianoDiStudio pianoDiStudio = (PianoDiStudio) o; + return Objects.equals(this.regole, pianoDiStudio.regole) && + Objects.equals(this.attivita, pianoDiStudio.attivita) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(regole, attivita, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PianoDiStudio {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" regole: ").append(toIndentedString(regole)).append("\n"); + sb.append(" attivita: ").append(toIndentedString(attivita)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/RigaLibretto.java b/app/src/main/java/org/epic_guys/esse4/models/RigaLibretto.java new file mode 100644 index 0000000..a7c1894 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/RigaLibretto.java @@ -0,0 +1,476 @@ +package org.epic_guys.esse4.models; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; + + +/** + * RigaLibretto + */ + +public class RigaLibretto { + @SerializedName("matId") + private Long matId = null; + + @SerializedName("ord") + private Integer ord = null; + + @SerializedName("adsceId") + private Long adsceId = null; + + @SerializedName("stuId") + private Long stuId = null; + + @SerializedName("pianoId") + private Long pianoId = null; + + @SerializedName("itmId") + private Long itmId = null; + + @SerializedName("ragId") + private Long ragId = null; + + /** + * contiene la tipologia del tipo di raggruppamento, valorizzato solo sul padre del raggruppamento (cioà quando ragId=adsceId) + */ + @JsonAdapter(RaggEsaTipoEnum.Adapter.class) + public enum RaggEsaTipoEnum { + ESA("ESA"), + + FREQ("FREQ"); + + private String value; + + RaggEsaTipoEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RaggEsaTipoEnum fromValue(String text) { + for (RaggEsaTipoEnum b : RaggEsaTipoEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RaggEsaTipoEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RaggEsaTipoEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RaggEsaTipoEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("raggEsaTipo") + private RaggEsaTipoEnum raggEsaTipo = null; + + @SerializedName("adCod") + private String adCod = null; + + @SerializedName("adDes") + private String adDes = null; + + @SerializedName("annoCorso") + private Integer annoCorso = null; + + /** + * Stato dell'attività didattica (codice) + */ + @JsonAdapter(StatoEnum.Adapter.class) + public enum StatoEnum { + P("P"), + + F("F"), + + S("S"); + + private String value; + + StatoEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatoEnum fromValue(String text) { + for (StatoEnum b : StatoEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StatoEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatoEnum read(final JsonReader jsonReader) throws IOException { + jsonReader.beginObject(); + jsonReader.nextName(); + String value = jsonReader.nextString(); + jsonReader.endObject(); + return StatoEnum.fromValue(String.valueOf(value)); + } + } + } + + @SerializedName("stato") + private StatoEnum stato = null; + + @SerializedName("statoDes") + private String statoDes = null; + + @SerializedName("chiaveADContestualizzata") + private AttivitaDidatticaContestualizzata chiaveADContestualizzata = null; + + @SerializedName("tipoEsaCod") + private String tipoEsaCod = null; + + @SerializedName("tipoEsaDes") + private String tipoEsaDes = null; + + @SerializedName("tipoInsCod") + private String tipoInsCod = null; + + @SerializedName("tipoInsDes") + private String tipoInsDes = null; + + @SerializedName("ricId") + private Integer ricId = null; + + @SerializedName("peso") + private Float peso = null; + + @SerializedName("aaFreqId") + private Integer aaFreqId = null; + + @SerializedName("dataFreq") + private String dataFreq = null; + + @SerializedName("freqUffFlg") + private Integer freqUffFlg = null; + + @SerializedName("freqObbligFlg") + private Integer freqObbligFlg = null; + + @SerializedName("dataScadIscr") + private String dataScadIscr = null; + + @SerializedName("gruppoVotoId") + private Integer gruppoVotoId = null; + + @SerializedName("gruppoVotoMinVoto") + private Integer gruppoVotoMinVoto = null; + + @SerializedName("gruppoVotoMaxVoto") + private Integer gruppoVotoMaxVoto = null; + + @SerializedName("gruppoVotoLodeFlg") + private Integer gruppoVotoLodeFlg = null; + + @SerializedName("gruppoGiudCod") + private String gruppoGiudCod = null; + + @SerializedName("gruppoGiudDes") + private String gruppoGiudDes = null; + + @SerializedName("esito") + private Esito esito = null; + + @SerializedName("sovranFlg") + private Integer sovranFlg = null; + + @SerializedName("note") + private String note = null; + + @SerializedName("debitoFlg") + private Integer debitoFlg = null; + + @SerializedName("ofaFlg") + private Integer ofaFlg = null; + + @SerializedName("annoCorsoAnticipo") + private Integer annoCorsoAnticipo = null; + + @SerializedName("genAutoFlg") + private Integer genAutoFlg = null; + + @SerializedName("genRicSpecFlg") + private Integer genRicSpecFlg = null; + + @SerializedName("tipoOrigEvecar") + private Integer tipoOrigEvecar = null; + + @SerializedName("urlSitoWeb") + private String urlSitoWeb = null; + + @SerializedName("statoMissione") + private String statoMissione = null; + + @SerializedName("statoMissioneDes") + private String statoMissioneDes = null; + + @SerializedName("numAppelliPrenotabili") + private Integer numAppelliPrenotabili = null; + + @SerializedName("superataFlg") + private Integer superataFlg = null; + + @SerializedName("numPrenotazioni") + private Integer numPrenotazioni = null; + + + public RigaLibretto matId(Long matId) { + this.matId = matId; + return this; + } + + + public Long getIdCarriera() { + return matId; + } + + /** + * Retrieves the sorting index of the RigaLibretto. + * + * @return Integer representing the sorting index. + */ + public Integer getOrdinamento() { + return ord; + } + + /** + * Retrieves the ID of the RigaLibretto. + * + * @return Long representing the ID of the RigaLibretto. + */ + public Long getIdRigaLibretto() { + return adsceId; + } + + public Long getIdStudente() { + return stuId; + } + + public Long getIdPiano() { + return pianoId; + } + + /** + * Retrieves the ID of the AttivitaDidattica associated with the RigaLibretto in a student's Libretto. + * + * @return Long representing the ID of the AttivitaDidattica. + */ + public Long getIdAttivitaDidatticaPiano() { + return itmId; + } + + /** + * Non ne ho proprio idea onestamente, citando la documentazione: + *

se l''attività appartiene ad un raggruppamento contiene l''adsceID del padre del raggruppamento

+ */ + public Long getRagId() { + return ragId; + } + + public RaggEsaTipoEnum getRaggEsaTipo() { + return raggEsaTipo; + } + + public String getCodiceAttivitaDidattica() { + return adCod; + } + + public String getDescrizioneAttivitaDidattica() { + return adDes; + } + + public Integer getAnnoCorso() { + return annoCorso; + } + + public StatoEnum getStato() { + return stato; + } + + public String getDescrizioneStato() { + return statoDes; + } + + public AttivitaDidatticaContestualizzata getAttivitaDidattica() { + return chiaveADContestualizzata; + } + + public String getTipoEsaCod() { + return tipoEsaCod; + } + + public String getTipoEsaDes() { + return tipoEsaDes; + } + + public String getTipoInsCod() { + return tipoInsCod; + } + + public String getTipoInsDes() { + return tipoInsDes; + } + + public Integer getRicId() { + return ricId; + } + + /** + * Retrieves the CFU of the RigaLibretto. + * + * @return Float representing the CFU of the RigaLibretto. + */ + public Float getPeso() { + return peso; + } + + public Integer getAaFreqId() { + return aaFreqId; + } + + public String getDataFreq() { + return dataFreq; + } + + public Integer getFreqUffFlg() { + return freqUffFlg; + } + + public Integer getFreqObbligFlg() { + return freqObbligFlg; + } + + public boolean isFrequenzaObbligatoria() { + return freqObbligFlg == 1; + } + + public boolean isFrequenzaUfficiale() { + return freqUffFlg == 1; + } + + public String getDataScadIscr() { + return dataScadIscr; + } + + public Integer getGruppoVotoId() { + return gruppoVotoId; + } + + public Integer getGruppoVotoMinVoto() { + return gruppoVotoMinVoto; + } + + public Integer getGruppoVotoMaxVoto() { + return gruppoVotoMaxVoto; + } + + public Integer getGruppoVotoLodeFlg() { + return gruppoVotoLodeFlg; + } + + public String getGruppoGiudCod() { + return gruppoGiudCod; + } + + public String getGruppoGiudDes() { + return gruppoGiudDes; + } + + public Esito getEsito() { + return esito; + } + + public Integer getSovranFlg() { + return sovranFlg; + } + + public String getNote() { + return note; + } + + public Integer getDebitoFlg() { + return debitoFlg; + } + + public Integer getOfaFlg() { + return ofaFlg; + } + + public Integer getAnnoCorsoAnticipo() { + return annoCorsoAnticipo; + } + + public Integer getGenAutoFlg() { + return genAutoFlg; + } + + public Integer getGenRicSpecFlg() { + return genRicSpecFlg; + } + + public Integer getTipoOrigEvecar() { + return tipoOrigEvecar; + } + + public String getUrlSitoWeb() { + return urlSitoWeb; + } + + public String getStatoMissione() { + return statoMissione; + } + + public String getStatoMissioneDes() { + return statoMissioneDes; + } + + public Integer getNumAppelliPrenotabili() { + return numAppelliPrenotabili; + } + + public Integer getSuperataFlg() { + return superataFlg; + } + + public Integer getNumPrenotazioni() { + return numPrenotazioni; + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/ScePianoDiStudio.java b/app/src/main/java/org/epic_guys/esse4/models/ScePianoDiStudio.java new file mode 100644 index 0000000..c7a1941 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/ScePianoDiStudio.java @@ -0,0 +1,242 @@ +package org.epic_guys.esse4.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import org.epic_guys.esse4.common.EnumAdapter; + +import java.io.IOException; + +public class ScePianoDiStudio { + @SerializedName("stuId") + private Long stuId = null; + + @SerializedName("pianoId") + private Integer pianoId = null; + + @SerializedName("matId") + private Long matId = null; + + @SerializedName("schemaId") + private Long schemaId = null; + + @SerializedName("scePianoId") + private Integer scePianoId = null; + + @SerializedName("sceltaId") + private Long sceltaId = null; + + @SerializedName("ordNum") + private Integer ordNum = null; + + @SerializedName("des") + private String des = null; + + @SerializedName("ptSlotId") + private Long ptSlotId = null; + + @SerializedName("ptSlotCod") + private String ptSlotCod = null; + + @SerializedName("ptSlotDes") + private String ptSlotDes = null; + + @SerializedName("annoCorso") + private Integer annoCorso = null; + + @SerializedName("annoCorsoAnticipo") + private Integer annoCorsoAnticipo = null; + + /** + * tipo di regola di scelta ( O => Obbligatoria; F => Da Elenco; T => Da Elenco Libero da OD; G => Gruppo; W => Gruppo Libero da OD; S => Libera da OD; V => Vincolo; D => Regola per Dottorati) + */ + @JsonAdapter(TipSceEnum.Adapter.class) + public enum TipSceEnum { + O("O"), + + F("F"), + + T("T"), + + G("G"), + + W("W"), + + S("S"), + + V("V"), + + D("D"); + + private String value; + + TipSceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TipSceEnum fromValue(String text) { + for (TipSceEnum b : TipSceEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return TipSceEnum.class; + } + } + } + + @SerializedName("tipSce") + private TipSceEnum tipSce = null; + + @SerializedName("tipSceDes") + private String tipSceDes = null; + + /** + * tipo di unità di misura + */ + @JsonAdapter(TipUntEnum.Adapter.class) + public enum TipUntEnum { + BLK("BLK"), + + CFU("CFU"), + + ANN("ANN"); + + private String value; + + TipUntEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TipUntEnum fromValue(String text) { + for (TipUntEnum b : TipUntEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return TipUntEnum.class; + } + } + } + + @SerializedName("tipUnt") + private TipUntEnum tipUnt = null; + + @SerializedName("minUnt") + private Float minUnt = null; + + @SerializedName("maxUnt") + private Float maxUnt = null; + + /** + * modificatore del TAF della regola di scelta + */ + @JsonAdapter(ModTAFEnum.Adapter.class) + public enum ModTAFEnum { + A("A"), + + B("B"), + + C("C"), + + D("D"), + + E("E"), + + F("F"), + + G("G"), + + S("S"); + + private String value; + + ModTAFEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModTAFEnum fromValue(String text) { + for (ModTAFEnum b : ModTAFEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return ModTAFEnum.class; + } + } + } + + @SerializedName("modTAF") + private ModTAFEnum modTAF = null; + + @SerializedName("opzFlg") + private Integer opzFlg = null; + + @SerializedName("tesorettoFlg") + private Integer tesorettoFlg = null; + + @SerializedName("sovranFlg") + private Integer sovranFlg = null; + + @SerializedName("azzeraCfuFlg") + private Integer azzeraCfuFlg = null; + + @SerializedName("abilFlg") + private Integer abilFlg = null; + + @SerializedName("regolaSistemaFlg") + private Integer regolaSistemaFlg = null; + + @SerializedName("extCod") + private String extCod = null; +} diff --git a/app/src/main/java/org/epic_guys/esse4/models/TestataPianoDiStudio.java b/app/src/main/java/org/epic_guys/esse4/models/TestataPianoDiStudio.java new file mode 100644 index 0000000..3dd4d6b --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/TestataPianoDiStudio.java @@ -0,0 +1,385 @@ +package org.epic_guys.esse4.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import org.epic_guys.esse4.common.EnumAdapter; + +import java.io.IOException; + +public class TestataPianoDiStudio { + @SerializedName("stuId") + private Long stuId = null; + + @SerializedName("pianoId") + private Integer pianoId = null; + + @SerializedName("staStuCod") + private String staStuCod = null; + + @SerializedName("motStastuCod") + private String motStastuCod = null; + + @SerializedName("staMatCod") + private String staMatCod = null; + + @SerializedName("motStamatCod") + private String motStamatCod = null; + + @SerializedName("matId") + private Long matId = null; + + @SerializedName("regsceId") + private Long regsceId = null; + + @SerializedName("schemaId") + private Long schemaId = null; + + @SerializedName("finregsceId") + private Long finregsceId = null; + + /** + * stato del piano (B => Bozza, P => Proposto, V => in Valutuazione, A => Approvato, R => Respinto, X => Annullato) + */ + @JsonAdapter(StatoEnum.Adapter.class) + public enum StatoEnum { + B("B"), + + P("P"), + + V("V"), + + A("A"), + + R("R"), + + X("X"); + + private String value; + + StatoEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatoEnum fromValue(String text) { + for (StatoEnum b : StatoEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return StatoEnum.class; + } + } + } + + @SerializedName("stato") + private StatoEnum stato = null; + + @SerializedName("statoDes") + private String statoDes = null; + + @SerializedName("dataUltimaVarStato") + private String dataUltimaVarStato = null; + + /** + * tipo di piano (S => Standard, I => Individuale) + */ + @JsonAdapter(TipoPianoEnum.Adapter.class) + public enum TipoPianoEnum { + S("S"), + + I("I"); + + private String value; + + TipoPianoEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TipoPianoEnum fromValue(String text) { + for (TipoPianoEnum b : TipoPianoEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + + public static class Adapter extends EnumAdapter { + @Override + public Class getTClass() { + return TipoPianoEnum.class; + } + } + } + + @SerializedName("tipoPiano") + private TipoPianoEnum tipoPiano = null; + + @SerializedName("statutarioFlg") + private Integer statutarioFlg = null; + + @SerializedName("coorte") + private Integer coorte = null; + + @SerializedName("aaRevisioneId") + private Integer aaRevisioneId = null; + + @SerializedName("cdsStuId") + private Long cdsStuId = null; + + @SerializedName("cdsStuCod") + private String cdsStuCod = null; + + @SerializedName("cdsStuDes") + private String cdsStuDes = null; + + @SerializedName("aaOrdStuId") + private Long aaOrdStuId = null; + + @SerializedName("pdsStuId") + private Long pdsStuId = null; + + @SerializedName("pdsStuCod") + private String pdsStuCod = null; + + @SerializedName("pdsDes") + private String pdsDes = null; + + @SerializedName("pdsSceId") + private Long pdsSceId = null; + + @SerializedName("pdsSceCod") + private String pdsSceCod = null; + + @SerializedName("pdsSceDes") + private String pdsSceDes = null; + + @SerializedName("aaDefId") + private Integer aaDefId = null; + + @SerializedName("aaIscrId") + private Integer aaIscrId = null; + + @SerializedName("aptId") + private Long aptId = null; + + @SerializedName("aptCod") + private String aptCod = null; + + @SerializedName("aptDes") + private String aptDes = null; + + @SerializedName("aaUltimaAttuazioneId") + private Integer aaUltimaAttuazioneId = null; + + @SerializedName("dataUltimaAttuazione") + private String dataUltimaAttuazione = null; + + @SerializedName("userUltimaAttuazione") + private String userUltimaAttuazione = null; + + @SerializedName("userControllo") + private String userControllo = null; + + @SerializedName("notaControllo") + private String notaControllo = null; + + @SerializedName("noteSistema") + private String noteSistema = null; + + @SerializedName("noteUtente") + private String noteUtente = null; + + @SerializedName("extCod") + private String extCod = null; + + public Long getStuId() { + return stuId; + } + + public Integer getPianoId() { + return pianoId; + } + + public String getStaStuCod() { + return staStuCod; + } + + public String getMotStastuCod() { + return motStastuCod; + } + + public String getStaMatCod() { + return staMatCod; + } + + public String getMotStamatCod() { + return motStamatCod; + } + + public Long getMatId() { + return matId; + } + + public Long getRegsceId() { + return regsceId; + } + + public Long getSchemaId() { + return schemaId; + } + + public Long getFinregsceId() { + return finregsceId; + } + + public StatoEnum getStato() { + return stato; + } + + public String getStatoDes() { + return statoDes; + } + + public String getDataUltimaVarStato() { + return dataUltimaVarStato; + } + + public TipoPianoEnum getTipoPiano() { + return tipoPiano; + } + + public Integer getStatutarioFlg() { + return statutarioFlg; + } + + public Integer getCoorte() { + return coorte; + } + + public Integer getAaRevisioneId() { + return aaRevisioneId; + } + + public Long getCdsStuId() { + return cdsStuId; + } + + public String getCdsStuCod() { + return cdsStuCod; + } + + public String getCdsStuDes() { + return cdsStuDes; + } + + public Long getAaOrdStuId() { + return aaOrdStuId; + } + + public Long getPdsStuId() { + return pdsStuId; + } + + public String getPdsStuCod() { + return pdsStuCod; + } + + public String getPdsDes() { + return pdsDes; + } + + public Long getPdsSceId() { + return pdsSceId; + } + + public String getPdsSceCod() { + return pdsSceCod; + } + + public String getPdsSceDes() { + return pdsSceDes; + } + + public Integer getAaDefId() { + return aaDefId; + } + + public Integer getAaIscrId() { + return aaIscrId; + } + + public Long getAptId() { + return aptId; + } + + public String getAptCod() { + return aptCod; + } + + public String getAptDes() { + return aptDes; + } + + public Integer getAaUltimaAttuazioneId() { + return aaUltimaAttuazioneId; + } + + public String getDataUltimaAttuazione() { + return dataUltimaAttuazione; + } + + public String getUserUltimaAttuazione() { + return userUltimaAttuazione; + } + + public String getUserControllo() { + return userControllo; + } + + public String getNotaControllo() { + return notaControllo; + } + + public String getNoteSistema() { + return noteSistema; + } + + public String getNoteUtente() { + return noteUtente; + } + + public String getExtCod() { + return extCod; + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/models/UDPianoDiStudio.java b/app/src/main/java/org/epic_guys/esse4/models/UDPianoDiStudio.java new file mode 100644 index 0000000..7568486 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/models/UDPianoDiStudio.java @@ -0,0 +1,49 @@ +package org.epic_guys.esse4.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +public class UDPianoDiStudio { + @SerializedName("stuId") + private Long stuId = null; + + @SerializedName("pianoId") + private Integer pianoId = null; + + @SerializedName("itmId") + private Integer itmId = null; + + @SerializedName("matId") + private Long matId = null; + + @SerializedName("schemaId") + private Long schemaId = null; + + @SerializedName("scePianoId") + private Integer scePianoId = null; + + @SerializedName("sceltaId") + private Long sceltaId = null; + + @SerializedName("sceltaAdId") + private Integer sceltaAdId = null; + + @SerializedName("udId") + private Integer udId = null; + + @SerializedName("udCod") + private String udCod = null; + + @SerializedName("udDes") + private String udDes = null; + + @SerializedName("peso") + private Float peso = null; + +} diff --git a/app/src/main/java/org/epic_guys/esse4/views/ExamCardAdapter.java b/app/src/main/java/org/epic_guys/esse4/views/ExamCardAdapter.java new file mode 100644 index 0000000..92e6fdb --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/views/ExamCardAdapter.java @@ -0,0 +1,93 @@ +package org.epic_guys.esse4.views; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.fragments.ExamSubscribeDialogFragment; +import org.epic_guys.esse4.models.Appello; +import org.epic_guys.esse4.models.AppelloLibretto; + +import java.util.List; + +public class ExamCardAdapter extends RecyclerView.Adapter { + + @NonNull + private List appelli; + + public ExamCardAdapter(@NonNull List appelli) { + this.appelli = appelli; + } + + @NonNull + @Override + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflater = LayoutInflater.from(parent.getContext()); + View view = inflater.inflate(R.layout.exam_card_view, parent, false); + return new ExamCardAdapter.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + AppelloLibretto appello = appelli.get(position); + holder.setContentView(appello); + } + + @Override + public int getItemCount() { + return appelli.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + + private TextView exam_name; + private TextView date_data; + private TextView host_data; + private TextView type_data; + private TextView sub_period_data; + private Button subscribe_button; + + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + exam_name = itemView.findViewById(R.id.exam_name); + date_data = itemView.findViewById(R.id.date_data); + host_data = itemView.findViewById(R.id.host_data); + type_data = itemView.findViewById(R.id.type_data); + sub_period_data = itemView.findViewById(R.id.sub_period_data); + subscribe_button = itemView.findViewById(R.id.btn_subscribe); + } + + public void setContentView(AppelloLibretto appello) { + exam_name.setText(appello.getDescrizioneAttivitaDidattica()); + try{ + date_data.setText(appello.getDataOraEsame().format(Appello.getDateTimeFormatter())); + } + catch (Exception e){ + Log.e("ExamCardAdapter", "setContentView: ", e); + } + + // FIXME - appello.getTipoEsame() può essere null + // type_data.setText(appello.getTipoEsame().getDescription()); + + host_data.setText(appello.getPresidenteNomeCognome()); + sub_period_data.setText(appello.getDataInizioIscr() + " - " + appello.getDataFineIscr()); + + + subscribe_button.setOnClickListener(v -> new ExamSubscribeDialogFragment(appello).show( + // findFragment restituisce AppelliFragment, creiamo il dialog in questo fragment + FragmentManager.findFragment(itemView).getChildFragmentManager(), + ExamSubscribeDialogFragment.TAG + )); + } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/epic_guys/esse4/views/ExamCardView.java b/app/src/main/java/org/epic_guys/esse4/views/ExamCardView.java new file mode 100644 index 0000000..fca7b2b --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/views/ExamCardView.java @@ -0,0 +1,90 @@ +package org.epic_guys.esse4.views; + +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.cardview.widget.CardView; + +public class ExamCardView extends CardView { + + @NonNull + private String name; + + @NonNull + private String date; + + @NonNull + private String start_sub; + + @NonNull + private String end_sub; + + @NonNull + private String CFU; + + @NonNull + private String host; + + @Nullable + private OnClickListener appelliClickListener; + + /** + * Constructor for the ExamCardView class. + * + * @param context The context in which the ExamCardView is being used. + * @param name The name of the exam. + * @param date The date of the exam. + * @param start_sub The start time of the exam. + * @param end_sub The end time of the exam. + * @param CFU The CFU of the exam. + * @param host The host of the exam. + * @param appelliClickListener The OnClickListener for the appelli button in this ExamCardView. + */ + public ExamCardView(Context context, @NonNull String name, @NonNull String date, @NonNull String start_sub, @NonNull String end_sub, @NonNull String CFU,@NonNull String host, @Nullable OnClickListener appelliClickListener) { + super(context); // Call the superclass constructor with the provided context + this.name = name; + this.date = date; + this.start_sub = start_sub; + this.end_sub = end_sub; + this.CFU = CFU; + this.host = host; + this.appelliClickListener = appelliClickListener; + } + + @Override + public String toString() { + return "ExamCardView{" + + "name='" + name + '\'' + + ", date='" + date + '\'' + + ", CFU='" + CFU + '\'' + + ", host='" + host + '\'' + + '}'; + } + + @NonNull + public String getName() { + return name; + } + + @NonNull + public String getDate() { + return date; + } + + @NonNull + public String getCFU() { + return CFU; + } + + @NonNull + public String getHost() { + return host; + } + + @Nullable + public OnClickListener getAppelliClickListener() { + return appelliClickListener; + } + +} diff --git a/app/src/main/java/org/epic_guys/esse4/views/SubjectCardAdapter.java b/app/src/main/java/org/epic_guys/esse4/views/SubjectCardAdapter.java new file mode 100644 index 0000000..d0b80a4 --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/views/SubjectCardAdapter.java @@ -0,0 +1,92 @@ +package org.epic_guys.esse4.views; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import org.epic_guys.esse4.R; + +import java.util.List; + +public class SubjectCardAdapter extends RecyclerView.Adapter { + + Context context; + List exams; + public SubjectCardAdapter(Context context, List exams) { + this.context = context; + this.exams = exams; + } + + @NonNull + @Override + public SubjectCardAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + LayoutInflater inflater = LayoutInflater.from(context); + View view; + view = inflater.inflate(R.layout.subject_card_view, parent, false); + return new SubjectCardAdapter.MyViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { + holder.examNameView.setText(exams.get(position).getName()); + holder.yearView.setText(exams.get(position).getYear()); + holder.CFUView.setText(exams.get(position).getCFU()); + + if(exams.get(position).getGrade() != null) { + holder.passedLayout.setVisibility(View.VISIBLE); + holder.notPassedLayout.setVisibility(View.GONE); + + holder.examNameView_passed.setText(exams.get(position).getName()); + holder.yearView_passed.setText(exams.get(position).getYear()); + holder.CFUView_passed.setText(exams.get(position).getCFU()); + holder.gradeView_passed.setText(exams.get(position).getGrade()); + } else { + holder.passedLayout.setVisibility(View.GONE); + holder.notPassedLayout.setVisibility(View.VISIBLE); + + holder.examNameView.setText(exams.get(position).getName()); + holder.yearView.setText(exams.get(position).getYear()); + holder.CFUView.setText(exams.get(position).getCFU()); + + holder.appelliButton.setOnClickListener(exams.get(position).getAppelliClickListener()); + } + + } + + @Override + public int getItemCount() { + return exams.size(); + } + + public static class MyViewHolder extends RecyclerView.ViewHolder { + LinearLayout passedLayout, notPassedLayout; + TextView examNameView, yearView, CFUView; + TextView examNameView_passed, yearView_passed, CFUView_passed, gradeView_passed; + Button appelliButton; + + public MyViewHolder(@NonNull View itemView) { + super(itemView); + + passedLayout = itemView.findViewById(R.id.passed); + notPassedLayout = itemView.findViewById(R.id.not_passed); + + examNameView = itemView.findViewById(R.id.exam_name); + yearView = itemView.findViewById(R.id.year_data) ; + CFUView = itemView.findViewById(R.id.CFU_data); + + examNameView_passed = itemView.findViewById(R.id.exam_name_passed); + yearView_passed = itemView.findViewById(R.id.year_data_passed) ; + CFUView_passed = itemView.findViewById(R.id.CFU_data_passed); + gradeView_passed = itemView.findViewById(R.id.grade_data_passed); + + appelliButton = itemView.findViewById(R.id.button_appelli_round); + } + } +} diff --git a/app/src/main/java/org/epic_guys/esse4/views/SubjectCardView.java b/app/src/main/java/org/epic_guys/esse4/views/SubjectCardView.java new file mode 100644 index 0000000..2d6c36f --- /dev/null +++ b/app/src/main/java/org/epic_guys/esse4/views/SubjectCardView.java @@ -0,0 +1,97 @@ +package org.epic_guys.esse4.views; + +import android.content.Context; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import org.epic_guys.esse4.R; +import org.epic_guys.esse4.common.Common; +import org.epic_guys.esse4.models.RigaLibretto; + +public class SubjectCardView extends View { + + private long id; + @NonNull + private String name; + @NonNull + private String year; + @NonNull + private String CFU; + @Nullable + private String grade; + + @Nullable + private OnClickListener appelliClickListener; + + /** + * Constructor + * @param context The context of the application + * @param id The id of the subject + * @param name The name of the subject + * @param year The year of the subject + * @param CFU The CFU of the subject + * @param grade The grade of the subject (if null, the subject is not passed) + */ + public SubjectCardView(Context context, long id ,String name, String year, String CFU, String grade, @Nullable OnClickListener appelliClickListener){ + super(context); + this.id = id; + this.name = name; + this.year = year; + this.CFU = CFU; + this.grade = grade; + this.appelliClickListener = appelliClickListener; + } + + public SubjectCardView(Context context, @NonNull RigaLibretto rigaLibretto, @Nullable OnClickListener appelliClickListener) { + super(context); // Call the superclass constructor with the provided context + + this.id = rigaLibretto.getIdRigaLibretto(); + this.name = rigaLibretto.getCodiceAttivitaDidattica() + " - " + rigaLibretto.getDescrizioneAttivitaDidattica(); + this.year = rigaLibretto.getAnnoCorso().toString(); + this.CFU = String.valueOf(rigaLibretto.getPeso().intValue()); + this.grade = Common.stringifyGrade(rigaLibretto); + this.appelliClickListener = appelliClickListener; // Set the OnClickListener for the appelli button in this SubjectCardView + } + + @Override + public String toString() { + return "SubjectCardView{" + + "id=" + id + + ", name='" + name + '\'' + + ", year='" + year + '\'' + + ", CFU='" + CFU + '\'' + + ", grade='" + grade + '\'' + + '}'; + } + + public long getCardId() { + return id; + } + + @NonNull + public String getName() { + return name; + } + + @NonNull + public String getYear() { + return year; + } + + @NonNull + public String getCFU() { + return CFU; + } + + @Nullable + public String getGrade() { + return grade; + } + + @Nullable + public OnClickListener getAppelliClickListener() { + return appelliClickListener; + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/baseline_arrow_back_24.xml b/app/src/main/res/drawable/baseline_arrow_back_24.xml new file mode 100644 index 0000000..8452791 --- /dev/null +++ b/app/src/main/res/drawable/baseline_arrow_back_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_book_24.xml b/app/src/main/res/drawable/baseline_book_24.xml new file mode 100644 index 0000000..a6f4003 --- /dev/null +++ b/app/src/main/res/drawable/baseline_book_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_calendar_month_24.xml b/app/src/main/res/drawable/baseline_calendar_month_24.xml new file mode 100644 index 0000000..ecef674 --- /dev/null +++ b/app/src/main/res/drawable/baseline_calendar_month_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_edit_note_24.xml b/app/src/main/res/drawable/baseline_edit_note_24.xml new file mode 100644 index 0000000..c041ef4 --- /dev/null +++ b/app/src/main/res/drawable/baseline_edit_note_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_logout_24.xml b/app/src/main/res/drawable/baseline_logout_24.xml new file mode 100644 index 0000000..bceb2ec --- /dev/null +++ b/app/src/main/res/drawable/baseline_logout_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/baseline_person_24.xml b/app/src/main/res/drawable/baseline_person_24.xml new file mode 100644 index 0000000..73eb310 --- /dev/null +++ b/app/src/main/res/drawable/baseline_person_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/outline_settings_24.xml b/app/src/main/res/drawable/outline_settings_24.xml new file mode 100644 index 0000000..c624d19 --- /dev/null +++ b/app/src/main/res/drawable/outline_settings_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/round_app_registration_24.xml b/app/src/main/res/drawable/round_app_registration_24.xml new file mode 100644 index 0000000..7287952 --- /dev/null +++ b/app/src/main/res/drawable/round_app_registration_24.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a25c8d6..76653c7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,33 +1,27 @@ + + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context=".MainActivity" + > - - -