Skip to content

Commit

Permalink
Changes to front and database
Browse files Browse the repository at this point in the history
  • Loading branch information
demaj committed Jul 14, 2020
1 parent 9aef3e4 commit 4e2e234
Show file tree
Hide file tree
Showing 130 changed files with 1,668 additions and 730 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gentian</groupId>
<artifactId>e-Voting</artifactId>
<version>1.4</version>
<version>1.5</version>
<packaging>war</packaging>
<name>e-Voting</name>

Expand Down Expand Up @@ -32,6 +32,11 @@
<artifactId>javax.persistence</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.7.7</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
Expand All @@ -40,7 +45,7 @@
</dependency>
</dependencies>

<build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SubjectEditor implements Serializable {
@PostConstruct
private void init() {
_logger.log(Level.INFO, "init in SubjectEditor");
_subjects = _subjectService.findAll();
// _subjects = _subjectService.findAll();
}

}
13 changes: 4 additions & 9 deletions src/main/java/com/gentian/e/voting/admin/VotingResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import javax.inject.Inject;
import javax.inject.Named;

/**
*
Expand All @@ -23,24 +23,19 @@ public class VotingResults implements Serializable {
private static final Logger _logger = Logger.getLogger("VotingResults");

@Inject private ResultsService _resultsService;

@PostConstruct
private void init() {
_logger.log(Level.INFO, "init in VotingResults");
_resultsService.clearCache();
}

// <editor-fold defaultstate="collapsed" desc="Property Results List">
private List<Results> _results;

public List<Results> getResults() {
_results = _resultsService.findAll();
_results = _resultsService.findAll(Results.class);
return _results;
}

public void setResults(List<Results> results) {
_results = results;
}
// </editor-fold>

}
67 changes: 67 additions & 0 deletions src/main/java/com/gentian/e/voting/entities/Address.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.gentian.e.voting.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
*
* @author Gentian
*/
@Entity
@Table(name = "adresat")
public class Address implements Serializable {

private static final long serialVersionUID = 42L;

// <editor-fold defaultstate="collapsed" desc="Property Id">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "adresa_id")
private Long _id;

public Long getId() {
return _id;
}

public void setId(Long id) {
_id = id;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property Name">
@Column(name = "adresa_emri")
private String _name;

public String getName() {
return _name;
}

public void setName(String name) {
_name = name;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property City Id">
@Column(name = "adresa_qyteti_id")
private Long _cityId;

public Long getCityId() {
return _cityId;
}

public void setCityId(Long cityId) {
_cityId = cityId;
}
// </editor-fold>

@Override
public String toString() {
return "Adresat[ id=" + _id + ", Emri=" + _name + ", QytetiId=" + _cityId + " ]";
}

}
101 changes: 43 additions & 58 deletions src/main/java/com/gentian/e/voting/entities/Candidate.java
Original file line number Diff line number Diff line change
@@ -1,113 +1,98 @@
package com.gentian.e.voting.entities;

import java.io.Serializable;
import java.util.Objects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
*
* @author Gentian
*/
@Entity
@Table(name = "candidates")
@Table(name = "kandidatet")
public class Candidate implements Serializable {

private static final long serialVersionUID = 1L;

// <editor-fold defaultstate="collapsed" desc="Property Id">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "candidate_id")
private Long _id;
@Column(name = "kandidati_id")
private int _id;

public Long getId() {
public int getId() {
return _id;
}

public void setId(Long id) {
_id = id;
public void setId(int id) {
_id= id;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property First Name">
@Column(name = "kandidati_emri")
private String _firstName;

// <editor-fold defaultstate="collapsed" desc="Property Candidate Name">
@Column(name = "candidate_name")
private String _candidateName = "";

public String getCandidateName() {
return _candidateName;
public String getFirstName() {
return _firstName;
}

public void setCandidateName(String _candidateName) {
this._candidateName = _candidateName;
public void setFirstName(String firstName) {
_firstName = firstName;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property Candidate Number">
@Column(name = "candidate_number")
private int _candidateNumber = -1;
public int getCandidateNumber() {
return _candidateNumber;
// <editor-fold defaultstate="collapsed" desc="Property Last Name">
@Column(name = "kandidati_mbiemri")
private String _lastName;

public String getLastName() {
return _lastName;
}

public void setCandidateNumber(int candidateNumber) {
this._candidateNumber = candidateNumber;
public void setLastName(String lastName) {
_lastName = lastName;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property Candidate Subject Number">
@Column(name = "candidate_subject_number")
private int _candidateSubjectNumber = -1;
// <editor-fold defaultstate="collapsed" desc="Property Birthday">
@Column(name = "kandidati_datelindja")
@Temporal(javax.persistence.TemporalType.DATE)
private Date _birthday;

public int getCandidateSubjectNumber() {
return _candidateSubjectNumber;
public Date getBirthday() {
return _birthday;
}

public void setCandidateSubjectNumber(int candidateSubjectNumber) {
this._candidateSubjectNumber = candidateSubjectNumber;
public void setBirthday(Date birthday) {
_birthday = birthday;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property Candidate Number Of Votes">
@Column(name = "candidate_number_of_votes")
private long _candidateNumberOfVotes;
// <editor-fold defaultstate="collapsed" desc="Property Email">
@Column(name = "kandidati_emaili")
private String _email;

public long getCandidateNumberOfVotes() {
return _candidateNumberOfVotes;
public String getEmail() {
return _email;
}

public void setCandidateNumberOfVotes(long candidateNumberOfVotes) {
_candidateNumberOfVotes = candidateNumberOfVotes;
public void setEmail(String email) {
_email = email;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="hashcode / equals / toString">
@Override
public int hashCode() {
int hash = 0;
hash += _id;
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Candidate)) {
return false;
}
Candidate other = (Candidate) object;
return Objects.equals(_id, other.getId());
}

@Override
public String toString() {
return "com.gentian.e.voting.entities.Candidates[ id=" + _id + " ]";
return "Kandidati[ Id=" + _id + ", "
+ "Emri=" + _firstName + ", "
+ "Mbiemri=" + _lastName + " ]";
}
// </editor-fold>

}
54 changes: 54 additions & 0 deletions src/main/java/com/gentian/e/voting/entities/City.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.gentian.e.voting.entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
*
* @author Gentian
*/
@Entity
@Table(name = "qytetet")
public class City implements Serializable {

private static final long serialVersionUID = 1L;

// <editor-fold defaultstate="collapsed" desc="Property Id">
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "qyteti_id")
private Long _id;

public Long getId() {
return _id;
}

public void setId(Long id) {
_id = id;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Property Name">
@Column(name = "qyteti_emri")
private String _name;

public String getName() {
return _name;
}

public void setName(String name) {
_name = name;
}
// </editor-fold>

@Override
public String toString() {
return "Qyteti[ Id=" + _id + ", Emri=" + _name +" ]";
}

}
Loading

0 comments on commit 4e2e234

Please sign in to comment.