controller.Utils.java Source code

Java tutorial

Introduction

Here is the source code for controller.Utils.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controller;

import docs.InternshipCompanyModel;
import java.util.List;
import org.springframework.ui.ModelMap;

/**
 *
 * @author metbill
 */
public class Utils {

    static void drawHomePage(String username, int nbreNotifs, String ColonGauche, String ColonDroite,
            ModelMap model) {

        model.addAttribute("message", "Welcome " + username);
        model.addAttribute("numberOfNot", nbreNotifs);
        model.addAttribute("colonneGauche", ColonGauche);
        model.addAttribute("colonneDroite", ColonDroite);

    }

    static void drawHomePageCompany(String username, int nbreNotifs, String ColonGauche, String ColonDroite,
            ModelMap model, List<InternshipCompanyModel> offers) {
        model.addAttribute("message", "Welcome " + username);
        model.addAttribute("numberOfNot", nbreNotifs);
        model.addAttribute("colonneGauche", ColonGauche);
        model.addAttribute("colonneDroite", ColonDroite);
        model.addAttribute("offers", offers);
    }

    static String getStatus(int state) {
        String status = null;
        switch (state) {
        case 3:
            status = "Application cancelled by the company.";
            break;
        case 4:
            status = "Application cancelled by the student.";
            break;
        case 5:
            status = "Application cancelled by the supervisor.";
            break;
        case 6:
            status = "Application accepted by the company";
            break;
        case 8:
            status = "Waiting for validation by the supervisor.";
            break;
        case 10:
            status = "Convention asked.";
            break;
        case 11:
            status = "Convention generated.";
            break;
        default:
            status = "In Process.";
            break;
        }

        return status;

    }

}