avax.persistence. EntityManager; javax.persistence. PersistenceContext; javax.persistence.criteria. CriteriaBuilder; javax.persistence.criteria. CriteriaQuery;
@ Statelessclass EntityService {
@ PersistenceContextEntityManager entityManager;
lt; T gt; Collection lt; T gt; getList (Class lt; T gt; type) {builder=entityManager.getCriteriaBuilder (); lt; T gt; query=builder.createQuery (type) ;. from (type); entityManager.createQuery (query) .getResultList ();
}
lt; T gt; T save (T entity) {entityManager.merge (entity);
}
lt; T gt; void remove (T entity) {= entityManager.merge (entity) ;. remove (entity);
}
}. javaru.ulstu.secretary.db;
java.util. Date;
javax.ejb. Stateless;
ru.ulstu.secretary.criteria. PropertyCriteriaService; ru.ulstu.secretary.entity. Pay;
@ Statelessclass PayByDateService extends PropertyCriteriaService lt; Pay, Date gt; {
@ OverrideString getProperty () {«date»;
}
@ OverrideClass lt; Pay gt; getType () {Pay.class;
}
}. javaru.ulstu.secretary.db;
java.util. Date;
javax.ejb. Stateless;
ru.ulstu.secretary.criteria. PropertyCriteriaService; ru.ulstu.secretary.entity. Repay;
@ Statelessclass RepayByDateService extends PropertyCriteriaService lt; Repay, Date gt; {
@ OverrideString getProperty () {«date»;
}
@ OverrideClass lt; Repay gt; getType () {Repay.class;
}
}. javaru.ulstu.secretary.db;
javax.ejb. Stateless;
ru.ulstu.secretary.criteria. PropertyCriteriaService; ru.ulstu.secretary.entity. Category; ru.ulstu.secretary.entity. Task;
@ Statelessclass TaskByCategoryService extends PropertyCriteriaService lt; Task, Category gt; {
@ OverrideString getProperty () {«category»;
}
@ OverrideClass lt; Task gt; getType () {Task.class;
}
}. javaru.ulstu.secretary.db;
java.util. Date;
javax.ejb. Stateless;
ru.ulstu.secretary.criteria. PropertyCriteriaService; ru.ulstu.secretary.entity. Task;
@ Statelessclass TaskByDateService extends PropertyCriteriaService lt; Task, Date gt; {
@ OverrideString getProperty () {«date»;
}
@ OverrideClass lt; Task gt; getType () {Task.class;
}
}. javaru.ulstu.secretary.db;
javax.ejb. Stateless; javax.inject. Named;
import ru.ulstu.secretary.entity. Unit;
@ Named
@ Statelessclass UnitService {
Unit [] getList () {Unit.values ??();
}
}. javaru.ulstu.secretary.entity;
java.util. Date;
javax.persistence. Entity;
@ Entityclass Action extends BaseEntity {
Date date;
Double balance;
String comment;
Category category;
boolean complete;
Date getDate () {date;
}
void setDate (Date date) {.date=date;
}
Double getBalance () {balance;
}
void setBalance (Double money) {.balance=money;
}
String getComment () {comment;
}
void setComment (String comment) {ment=comment;
}
Category getCategory () {category;
}
void setCategory (Category category) {.category=category;
}
boolean isComplete () {complete;
}
void setComplete (boolean complete) {...