<repo_name>FatbardhKadriu/Modelet_e_te_dhenave<file_sep>/Pjesa e pare/Projekti_Modelet_e_te_dhenave_dhe_gjuhet_e_pyetesorve/Oracle/views.sql
CREATE VIEW CilesiaAjrit_View AS
SELECT C.Aid,
              C.Vendi,
              N.Ndotesi,
              N.Data_Koha,
              N.Koncentrimi,
              N.VleraMax_Lejueshme
FROM Cilesia_Ajrit c, TABLE(c.ndotja) n

CREATE VIEW Te_DhenatH_View AS
SELECT H.HId,
              s.Emri_Stacionit,
              H.Distanca_Nga_Gryka,
              H.Siperfaqja_Ujembledhese,
              M.Data_Koha,
              M.Niveli_Ujit,
              M.Prurja_Ujit
FROM Te_Dhenat_Hidrometrike H , TABLE(H.HMatjet) M, Stacionet_Hidrometrike s
WHERE H.hidroStacioniID = s.hidroStacioniID

CREATE VIEW TE_DHENATK_VIEW AS
SELECT   T.KId , 
                m.Emri_i_stacionit,
                C.Data_Koha ,
                C.Temperatura,
                C.Shtypja_Ajrit,
                C.Lageshtia_Ajrit,
                C.Reshje_Shiu,
                C.Reshje_Bore,
                T.Insolacioni,
                T.Vranesirat
FROM Te_Dhenat_Klimatologjike T,  TABLE(T.KMatje) C, Stacionet_Meteorologjike m
WHERE T.StacioniID = m.StacioniID

CREATE VIEW ZHURMA_VIEW AS
SELECT Zid, Data_Koha, Tipi_Pranuesit, Vlera_Zhurmes 
    FROM Zhurma

INSERT INTO Zhurma_View VALUES (20, '17-DEC-2019 03:00:00 PM', 'Fabrikat', 66);

UPDATE Zhurma_View 
    SET Vlera_Zhurmes = 65
    WHERE ZId = 19;
    
select * from Zhurma_View;

CREATE VIEW NdotesitNeVende AS
SELECT ndotesi, koncentrimi
FROM Cilesia_Ajrit c, TABLE(c.Ndotja) n 
WHERE vendi = 'Prishtinë' <file_sep>/Pjesa e pare/Projekti_Modelet_e_te_dhenave_dhe_gjuhet_e_pyetesorve/OracleConnection/src/com/nt/NdotesitClass.java
package com.nt;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class NdotesitClass{
public void createStage()
	{
		Stage primaryStage = new Stage();
		Pane pane = new Pane();
		pane.getChildren().add(createPieChart());
		Scene scene = new Scene(pane);
		primaryStage.setScene(scene);
		primaryStage.show();
	}
	public PieChart createPieChart() {

//		try {
//			Statement stmt = DBConnection.getConnection().createStatement();
//			ResultSet rs = stmt.executeQuery("Select * from NdotesitNeVende");
//			while(rs.next())
//			{
//				System.out.println(rs.getString(1) + " -> " + rs.getString(2));
//			}
//		}catch(Exception ex)
//		{
//			ex.printStackTrace();
//		}

		ObservableList<PieChart.Data> pieChartData =
                FXCollections.observableArrayList(
                new PieChart.Data("PM2.5", 7),
                new PieChart.Data("PM10", 13),
                new PieChart.Data("SO2", 39),
                new PieChart.Data("NO2", 11),
                new PieChart.Data("O3", 30));
        final PieChart chart = new PieChart(pieChartData);
        chart.setTitle("Ndotesite Ne Prishtine");
		return chart;
	}
}<file_sep>/Pjesa e pare/Projekti_Modelet_e_te_dhenave_dhe_gjuhet_e_pyetesorve/Oracle/indeksimet.sql
CREATE INDEX Te_Dhenat_Klimatologjike_Index ON KMatje_Nested(Data_Koha, Temperatura);

CREATE INDEX Temperatura_Tokes_Index ON Temp_Nested(Data_Koha, Temperatura_Tokes);

CREATE bitmap INDEX Stacionet_Hidrometrike_Index ON Stacionet_Hidrometrike(Pellgu_Lumor);

CREATE CLUSTER Te_Dhenat_H(HidroStacioniID INTEGER);
CREATE INDEX Te_Dhenat_H_Index ON CLUSTER Te_Dhenat_H;

CREATE INDEX Lista_Ndotesit_Index ON Ndotja_Nested(Koncentrimi - VleraMax_Lejueshme);

CREATE UNIQUE INDEX Zhurma_Index on Zhurma(Data_Koha, Tipi_Pranuesit);
<file_sep>/Pjesa e pare/Projekti_Modelet_e_te_dhenave_dhe_gjuhet_e_pyetesorve/OracleConnection/src/com/nt/NjesiteClass.java
package com.nt;

import java.sql.*;
import java.util.List;

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableRow;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class NjesiteClass{

	// Text fields
	private TextField madhesiaTxt = new TextField();
	private TextField njesiaTxt = new TextField();
	private Label lblMadhesia = new Label("Madhesia");
	private Label lblNjesia = new Label("Njesia");

	// Buttons
	private Button insertBtn = new Button("Insert");
	private Button updateBtn = new Button("Update");
	private Button deleteBtn = new Button("Delete");
	private Button clearBtn = new Button("Clear");

	// Table views
	private TableView madhesiteTable = new TableView();

	public void createStage() {
		Stage primaryStage = new Stage();

		lblMadhesia.setId("id1");
		lblMadhesia.setId("id2");
		// Form pane
		GridPane formPane = new GridPane();

		formPane.addRow(0, new Label("Madhesia: "), madhesiaTxt);
		formPane.addRow(1, new Label("Njesia: "), njesiaTxt);

		formPane.setHgap(10);
		formPane.setVgap(10);

		madhesiaTxt.setDisable(true);

		// Buttons pane
		HBox buttonsPane = new HBox(10);

		buttonsPane.getChildren().addAll(insertBtn, updateBtn, deleteBtn, clearBtn);

		insertBtn.setOnAction(e -> {
			insertMadhesi();
		});

		clearBtn.setOnAction(e -> {
			clearForm();
		});
		updateBtn.setOnAction(e -> {
			updateMadhesi();
		});
		deleteBtn.setOnAction(e -> {
			deleteMadhesi();
		});

		// Left Pane

		VBox leftPane = new VBox(15);

		leftPane.getChildren().addAll(formPane, buttonsPane);

		// Books table
		TableColumn<String, Njesite_Matese> column1 = new TableColumn<>("Madhesia");
		column1.setCellValueFactory(new PropertyValueFactory("madhesia"));
		column1.setPrefWidth(200);

		TableColumn<String, Njesite_Matese> column2 = new TableColumn<>("Njesia");
		column2.setCellValueFactory(new PropertyValueFactory("njesia"));
		column2.setPrefWidth(150);


		madhesiteTable.getColumns().add(column1);
		madhesiteTable.getColumns().add(column2);

		madhesiteTable.setRowFactory(tv -> {
			TableRow<Njesite_Matese> row = new TableRow<>();

			row.setOnMouseClicked(e -> {
				madhesiaTxt.setText(String.valueOf(row.getItem().getMadhesia()));
				njesiaTxt.setText(row.getItem().getNjesia());
				madhesiaTxt.setDisable(false);
			});

			return row;
		});
		madhesiteTable.setPrefWidth(360);
		madhesiteTable.setPrefHeight(200);

		// Main Pane
		HBox mainPane = new HBox(200);

		mainPane.getChildren().addAll(leftPane, madhesiteTable);

		mainPane.setPadding(new Insets(15, 15, 15, 15));
		
		mainPane.setStyle("-fx-background-image: url(images/bg2.jpg);-fx-background-size:cover;");

		Scene scene = new Scene(mainPane, 1000, 500);
	    scene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());

		primaryStage.setTitle("Tabela per informimin e njesive matese");
		primaryStage.setScene(scene);
		primaryStage.setResizable(false);
		showMadhesi();

		primaryStage.show();
	}

	public static void main(String[] args) {
		Application.launch(args);
	}

	public void showMadhesi() {
		List<Njesite_Matese> madhesite = Njesite_Matese.getMadhesite();

		ObservableList<Njesite_Matese> madhesiteList = FXCollections.observableArrayList();

		for (int i = 0; i < madhesite.size(); i++) {
			madhesiteList.add(madhesite.get(i));
		}

		madhesiteTable.setItems(madhesiteList);
	}

	public void insertMadhesi() {

		if (Njesite_Matese.addMadhesi(madhesiaTxt.getText(), njesiaTxt.getText())) {
			showMadhesi();
			clearForm();
		}
	}

	private void deleteMadhesi() {
		if (Njesite_Matese.deleteMadhesi(madhesiaTxt.getText())) {
			showMadhesi();
			clearForm();
		}
	};

	private void updateMadhesi() {
		if (Njesite_Matese.updateMadhesi(madhesiaTxt.getText(), njesiaTxt.getText())) {
			showMadhesi();
			clearForm();
		}
	};

	public void clearForm() {
		madhesiaTxt.setText("");
		njesiaTxt.setText("");
	}

}