-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from SakalAndrej/develop
Releaseable
- Loading branch information
Showing
15 changed files
with
306 additions
and
66 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
HomeDsBackend/src/main/java/at/htl/facades/CampaignFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package at.htl.facades; | ||
|
||
import at.htl.model.Campaign; | ||
import at.htl.model.DataSetDataField; | ||
|
||
import javax.ejb.Stateless; | ||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
import javax.persistence.TypedQuery; | ||
import java.util.List; | ||
|
||
@Stateless | ||
public class CampaignFacade { | ||
|
||
@PersistenceContext | ||
EntityManager entityManager; | ||
|
||
public void save(Campaign campaign) { | ||
entityManager.persist(campaign); | ||
} | ||
|
||
public void merge(Campaign campaign) { | ||
entityManager.merge(campaign); | ||
} | ||
|
||
public Campaign findById(long id) { | ||
return entityManager.find(Campaign.class,id); | ||
} | ||
|
||
public List<Campaign> getAll() { | ||
TypedQuery<Campaign> query = entityManager.createNamedQuery("Campaign.GetAll",Campaign.class); | ||
return query.getResultList(); | ||
} | ||
|
||
public void delete(long id) { | ||
entityManager.remove(findById(id)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package at.htl.model; | ||
|
||
import javax.persistence.*; | ||
|
||
@NamedQueries( | ||
{ | ||
@NamedQuery(name = "Campaign.GetAll", | ||
query = "select d from Campaign d") | ||
}) | ||
|
||
@Table | ||
@Entity | ||
public class Campaign { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private long id; | ||
|
||
private long campaignId; | ||
|
||
public Campaign(long campaignId) { | ||
this.campaignId = campaignId; | ||
} | ||
|
||
public Campaign() { } | ||
|
||
//region Getter & Setter | ||
|
||
public long getCampaignId() { | ||
return campaignId; | ||
} | ||
|
||
public void setCampaignId(long campaignId) { | ||
this.campaignId = campaignId; | ||
} | ||
|
||
public long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
//endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.