Kontakt

Fakturační údaje

IČ: 87189224, BÚ: 1958653063/0800

Contact info in QR code

Musico

Informace

  • Webová aplikace vytvořená pomocí technologií EJB a JSF, s úmyslem nasazení na Glassfish serveru.
  • Psaná jako semestrální práce pro předmět X33EJA.
  • Účelem bylo osvojit si:
    • Návrh doménového modelu a jeho implementaci (alespoň jedna vazba M:N)
    • Použití JPA pro persistenci
    • Transakce
    • Použití EJB (stateless i statefull)
    • Lokalizaci do více jazyků
    • Autorizaci uživatelů, rozdělení do rolí a zabezpečení přístupu k business vrstvě
    • Webové rozhrání (servlety, jsp, nebo web framework)

Zdrojové kódy

  1: package cz.cvut.x33eja.macosond.persistence.entity;
  2: 
  3: import java.io.Serializable;
  4: import java.util.Collection;
  5: import java.util.Date;
  6: import javax.persistence.Column;
  7: import javax.persistence.Entity;
  8: import javax.persistence.GeneratedValue;
  9: import javax.persistence.GenerationType;
 10: import javax.persistence.Id;
 11: import javax.persistence.JoinColumn;
 12: import javax.persistence.JoinTable;
 13: import javax.persistence.ManyToMany;
 14: import javax.persistence.ManyToOne;
 15: import javax.persistence.NamedQuery;
 16: import javax.persistence.OneToMany;
 17: import javax.persistence.Table;
 18: import javax.persistence.Temporal;
 19: import javax.persistence.TemporalType;
 20: 
 21: /**
 22:  * @author Ondra
 23:  * @version 1.0
 24:  * @created 23-XII-2009 19:34:16
 25:  */
 26: @Entity
 27: @Table(name="Band")
 28: @NamedQuery(name="Band.list", query="SELECT b FROM Band b")
 29: public class Band implements Serializable
 30: {
 31:         private static final long serialVersionUID = 1L;
 32: 
 33:         @Id
 34:         @GeneratedValue(strategy = GenerationType.AUTO)
 35:         @Column(name="BandID")
 36:     private Integer BandID;
 37:         @Column(name="Name", unique = true)
 38:     private String Name;
 39:         @Column(name="Website")
 40:     private String Website;
 41:         @Column(name="Country")
 42:     private String Country;
 43:         @Temporal(TemporalType.DATE)
 44:         @Column(name="DateFoundation")
 45:     private Date DateFoundation;
 46:         @Temporal(TemporalType.TIMESTAMP)
 47:         @Column(name="DateCreated")
 48:     private Date DateCreated;
 49:         @ManyToOne
 50:         @JoinColumn(name="PreferredGenre")
 51:     private Genre PreferredGenre;
 52: 
 53:         @ManyToMany
 54:         @JoinTable(
 55:                 name = "BandMusician",
 56:                 joinColumns = @JoinColumn(name="BandID", referencedColumnName="BandID"),
 57:                 inverseJoinColumns = @JoinColumn(name="MusicianID", referencedColumnName="MusicianID")
 58:         )
 59:         private Collection<Musician> Musicians;
 60: 
 61:         @OneToMany
 62:     private Collection<Event> Events;
 63:         
 64:         public Band()
 65:         {
 66:                 super();
 67:         }
 68: 
 69:         public Band(Integer BandID)
 70:         {
 71:                 super();
 72:                 this.BandID = BandID;
 73:         }
 74: 
 75:         public Integer getBandID()
 76:         {
 77:                 return BandID;
 78:         }
 79: 
 80:         public void setBandID(Integer BandID)
 81:         {
 82:                 this.BandID = BandID;
 83:         }
 84: 
 85:         public String getName()
 86:         {
 87:                 return Name;
 88:         }
 89: 
 90:         public void setName(String Name)
 91:         {
 92:                 this.Name = Name;
 93:         }
 94: 
 95:         public String getWebsite()        
 96:         {
 97:                 return Website;
 98:         }
 99: 
100:         public void setWebsite(String Website)
101:         {
102:                 this.Website = Website;
103:         }
104: 
105:         public String getCountry()        
106:         {
107:                 return Country;
108:         }
109: 
110:         public void setCountry(String Country)
111:         {
112:                 this.Country = Country;
113:         }
114: 
115:         public Date getDateFoundation()        
116:         {
117:                 return DateFoundation;
118:         }
119: 
120:         public void setDateFoundation(Date DateFoundation)
121:         {
122:                 this.DateFoundation = DateFoundation;
123:         }
124: 
125:         public Date getDateCreated()        
126:         {
127:                 return DateCreated;
128:         }
129: 
130:         public void setDateCreated(Date DateCreated)
131:         {
132:                 this.DateCreated = DateCreated;
133:         }
134: 
135:         public Genre getPreferredGenre()
136:         {
137:                 return PreferredGenre;
138:         }
139: 
140:         public void setPreferredGenre(Genre PreferredGenre)
141:         {
142:                 this.PreferredGenre = PreferredGenre;
143:         }
144: 
145:         public Collection<Musician>  getMusicians()
146:         {
147:                 return Musicians;
148:         }
149: 
150:         public void setMusicians(Collection<Musician>  Musicians)
151:         {
152:                 this.Musicians = Musicians;
153:         }
154: 
155:         public Collection<Event> getEvents()
156:         {
157:                 return Events;
158:         }
159: 
160:         public void setEvents(Collection<Event> Events)
161:         {
162:                 this.Events = Events;
163:         }
164: 
165:         @Override
166:         public int hashCode()
167:         {
168:                 int hash = 0;
169:                 hash = (BandID == null ? 0 : BandID.hashCode());
170:                 return hash;
171:         }
172: 
173:         @Override
174:         public boolean equals(Object o)
175:         {
176:                 if( !(o instanceof Band) ) {
177:                         return false;
178:                 }
179: 
180:                 Band other = (Band) o;
181:                 if( ( this.BandID == null && other.BandID != null )
182:                     || ( this.BandID != null && other.BandID == null )
183:                     || ( !this.BandID.equals(other.BandID) )
184:                   ) {
185:                         return false;
186:                 }
187:                 return true;
188:         }
189: 
190:         @Override
191:         public String toString()
192:         {
193:                 return "cz.cvut.x33eja.macosond.persistence.entity.Band[id=" + BandID + "]";
194:         }
195: 
196: }