Разработка JavaEE web-приложения

Изучение основ сетевого взаимодействия и сервис-ориентированной архитектуры. Причины роста популярности веб-сервисов. Цели и задачи разрабатываемого программного продукта (веб-приложения). Обоснование проектных решений по техническому обеспечению.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 19.11.2018
Размер файла 810,1 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

return "issue_del";

}

public String del_yes_Issue() {

this.issuesFacade.remove(this.issue);

return "issuesPage";

}

}

КлассSkillsController.java

@SessionScoped

@Named("skillsController")

public class SkillsController implements Serializable {

@EJB

private SkillsFacadeskillsFacade;

private ArrayListskillsSelector = new ArrayList<>();

public ArrayListgetSkillsSelector() {

skillsSelector = new ArrayList();

List<Skills>allSkills = this.skillsFacade.findAll();

for (int i = 0; i< (allSkills.size()); i++) {

Skills skills = allSkills.get(i);

skillsSelector.add(new SelectItem(skills.getIdSkill(), skills.getTitle() + ": " + String.valueOf(skills.getRate())));

}

return skillsSelector;

}

private Skills skill;

/**

* Creates a new instance of SkillsController

*/

public SkillsController() {

this.skill = new Skills(null, "", 0);

}

public Skills getSkill() {

return this.skill;

}

public int getNumberOfSkills() {

return skillsFacade.findAll().size();

}

public List<Skills>getAllOfSkills() {

return skillsFacade.findAll();

}

public String saveSkill() {

this.skillsFacade.create(skill);

return "skillsPage";

}

public String modSkill(Skills skill) {

this.skill = skill;

return "skill_mod";

}

public String mod_yes_Skill() {

this.skillsFacade.edit(this.skill);

return "skillsPage";

}

public String delSkill(Skills skill) {

this.skill = skill;

return "skill_del";

}

public String del_yes_Skill() {

this.skillsFacade.remove(this.skill);

return "skillsPage";

}

}

КлассAuthor.java

@Entity

@Table(name = "authors")

@XmlRootElement

@NamedQueries({

@NamedQuery(name = "Authors.findAll", query = "SELECT a FROM Authors a")

, @NamedQuery(name = "Authors.findByIdAuthor", query = "SELECT a FROM Authors a WHERE a.idAuthor = :idAuthor")

, @NamedQuery(name = "Authors.findByAuthorName", query = "SELECT a FROM Authors a WHERE a.authorName = :authorName")

, @NamedQuery(name = "Authors.findByBDay", query = "SELECT a FROM Authors a WHERE a.bDay = :bDay")})

public class Authors implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

@Basic(optional = false)

@Column(name = "id_author")

private Integer idAuthor;

@Basic(optional = false)

@Column(name = "author_name", length = 20)

private String authorName;

@Basic(optional = false)

@Column(name = "b_day")

@Temporal(TemporalType.DATE)

private Date bDay;

@OneToMany(cascade = CascadeType.ALL, mappedBy = "authorId")

private Collection<Issues>issuesCollection;

@JoinColumn(name = "id_skill", referencedColumnName = "id_skill")

@ManyToOne

private Skills idSkill;

public Authors() {

}

public Authors(Integer idAuthor) {

this.idAuthor = idAuthor;

}

public Authors(Integer idAuthor, String authorName, Date bDay) {

this.idAuthor = idAuthor;

this.authorName = authorName;

this.bDay = bDay;

}

public Integer getIdAuthor() {

return idAuthor;

}

public void setIdAuthor(Integer idAuthor) {

this.idAuthor = idAuthor;

}

public String getAuthorName() {

return authorName;

}

public void setAuthorName(String authorName) {

this.authorName = authorName;

}

public Date getBDay() {

return bDay;

}

public void setBDay(Date bDay) {

this.bDay = bDay;

}

@XmlTransient

public Collection<Issues>getIssuesCollection() {

return issuesCollection;

}

public void setIssuesCollection(Collection<Issues>issuesCollection) {

this.issuesCollection = issuesCollection;

}

public Skills getIdSkill() {

return idSkill;

}

public void setIdSkill(Skills idSkill) {

this.idSkill = idSkill;

}

@Override

public int hashCode() {

int hash = 0;

hash += (idAuthor != null ? idAuthor.hashCode() : 0);

return hash;

}

@Override

public booleanequals(Object object) {

// TODO: Warning - this method won't work in the case the id fields are not set

if (!(object instanceof Authors)) {

return false;

}

Authors other = (Authors) object;

if ((this.idAuthor == null &&other.idAuthor != null) || (this.idAuthor != null && !this.idAuthor.equals(other.idAuthor))) {

return false;

}

return true;

}

@Override

public String toString() {

return "Entities.Authors[ idAuthor=" + idAuthor + " ]";

}

}

Класс Issues.java

@Entity

@Table(name = "issues")

@XmlRootElement

@NamedQueries({

@NamedQuery(name = "Issues.findAll", query = "SELECT i FROM Issues i")

, @NamedQuery(name = "Issues.findByCode", query = "SELECT i FROM Issues i WHERE i.code = :code")

, @NamedQuery(name = "Issues.findByDescription", query = "SELECT i FROM Issues i WHERE i.description = :description")

, @NamedQuery(name = "Issues.findByDecision", query = "SELECT i FROM Issues i WHERE i.decision = :decision")})

public class Issues implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@Basic(optional = false)

@Column(name = "code")

private Integer code;

@Basic(optional = false)

@Column(name = "description", length = 40)

private String description;

@Basic(optional = false)

@Column(name = "decision", length = 40)

private String decision;

@JoinColumn(name = "author_id", referencedColumnName = "id_author")

@ManyToOne(optional = false)

private Authors authorId;

public Issues() {

}

public Issues(Integer code) {

this.code = code;

}

public Issues(Integer code, String description, String decision) {

this.code = code;

this.description = description;

this.decision = decision;

}

public Integer getCode() {

return code;

}

public void setCode(Integer code) {

this.code = code;

}

public String getDescription() {

return description;

}

public void setDescription(String description) {

this.description = description;

}

public String getDecision() {

return decision;

}

public void setDecision(String decision) {

this.decision = decision;

}

public Authors getAuthorId() {

return authorId;

}

public void setAuthorId(Authors authorId) {

this.authorId = authorId;

}

@Override

public int hashCode() {

int hash = 0;

hash += (code != null ? code.hashCode() : 0);

return hash;

}

@Override

public booleanequals(Object object) {

// TODO: Warning - this method won't work in the case the id fields are not set

if (!(object instanceof Issues)) {

return false;

}

Issues other = (Issues) object;

if ((this.code == null &&other.code != null) || (this.code != null && !this.code.equals(other.code))) {

return false;

}

return true;

}

@Override

public String toString() {

return "Entities.Issues[ code=" + code + " ]";

}

}

Класс Skills.java

@Entity

@Table(name = "skills")

@XmlRootElement

@NamedQueries({

@NamedQuery(name = "Skills.findAll", query = "SELECT s FROM Skills s")

, @NamedQuery(name = "Skills.findByIdSkill", query = "SELECT s FROM Skills s WHERE s.idSkill = :idSkill")

, @NamedQuery(name = "Skills.findByTitle", query = "SELECT s FROM Skills s WHERE s.title = :title")

, @NamedQuery(name = "Skills.findByRate", query = "SELECT s FROM Skills s WHERE s.rate = :rate")})

public class Skills implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

@Basic(optional = false)

@Column(name = "id_skill")

private Integer idSkill;

@Basic(optional = false)

@Column(name = "title", length = 40)

private String title;

@Basic(optional = false)

@Column(name = "rate")

private int rate;

@OneToMany(mappedBy = "idSkill")

private Collection<Authors>authorsCollection;

public Skills() {

}

public Skills(Integer idSkill) {

this.idSkill = idSkill;

}

public Skills(Integer idSkill, String title, int rate) {

this.idSkill = idSkill;

this.title = title;

this.rate = rate;

}

public Integer getIdSkill() {

return idSkill;

}

public void setIdSkill(Integer idSkill) {

this.idSkill = idSkill;

}

public String getTitle() {

return title;

}

public void setTitle(String title) {

this.title = title;

}

public int getRate() {

return rate;

}

public void setRate(int rate) {

this.rate = rate;

}

@XmlTransient

public Collection<Authors>getAuthorsCollection() {

return authorsCollection;

}

public void setAuthorsCollection(Collection<Authors>authorsCollection) {

this.authorsCollection = authorsCollection;

}

@Override

public int hashCode() {

int hash = 0;

hash += (idSkill != null ? idSkill.hashCode() : 0);

return hash;

}

@Override

public booleanequals(Object object) {

// TODO: Warning - this method won't work in the case the id fields are not set

if (!(object instanceof Skills)) {

return false;

}

Skills other = (Skills) object;

if ((this.idSkill == null &&other.idSkill != null) || (this.idSkill != null && !this.idSkill.equals(other.idSkill))) {

return false;

}

return true;

}

@Override

public String toString() {

return "Entities.Skills[ idSkill=" + idSkill + " ]";

}

}

Размещено на Allbest.ru

...

Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.