This file contains hidden or 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
/** | |
* Service facade for entities with revisions | |
* | |
* @author Dagvadorj Galbadrakh | |
*/ | |
@Stateless | |
public class RevisionBean implements RevisionBeanRemote { | |
@EJB | |
private EntityBeanRemote entityBean; |
This file contains hidden or 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
/** | |
* | |
* @author Dagvadorj Galbadrakh | |
* | |
*/ | |
@Remote | |
public interface RevisionBeanRemote { | |
/** | |
* Returns revision of a revisable entity at a given time. |
This file contains hidden or 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
@Entity | |
public class EmploymentRevision extends RevisionModel implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private Double salary; | |
public Double getSalary() { | |
return salary; | |
} |
This file contains hidden or 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
@Entity | |
public class Employment extends Model implements RevisableModel<EmploymentRevision> { | |
private static final long serialVersionUID = 1L; | |
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | |
private List<EmploymentRevision> revisions; | |
public Employment() { | |
revisions = new ArrayList<EmploymentRevision>(); |
This file contains hidden or 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
@Entity | |
public class Employee extends Model implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private String name; | |
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | |
private Employment employment; |
This file contains hidden or 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
/** | |
* Interface for revisable entities. | |
* | |
* @author Dagvadorj Galbadrakh | |
* | |
*/ | |
public interface RevisableModel<T extends RevisionModel> { | |
public List<T> getRevisions(); |
This file contains hidden or 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
/** | |
* Base model for revision entities. It maintains effective date. | |
* | |
* @author Dagvadorj Galbadrakh | |
* | |
*/ | |
@MappedSuperclass | |
public class RevisionModel extends Model implements Serializable { | |
private static final long serialVersionUID = 1L; |
This file contains hidden or 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
package org.ubdynamics.testapp.ejb.service; | |
import java.io.ByteArrayOutputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.text.SimpleDateFormat; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.Locale; |
This file contains hidden or 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
package org.ubdynamics.testapp.web.backing; | |
import java.io.Serializable; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.annotation.PostConstruct; | |
import javax.annotation.Resource; | |
import javax.ejb.EJB; | |
import javax.faces.bean.ManagedBean; |
This file contains hidden or 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
<xforms:submission id="validation-submission" | |
ref="instance('fr-form-instance')" | |
resource="http://localhost:8080/MyApp/OrbeonValidationServlet" | |
method="post" replace="instance" instance="validation-result"> | |
<!-- Clear external errors just before doing external validation --> | |
<xforms:delete ev:event="xforms-submit" nodeset="//@v:*" /> | |
<xforms:action ev:event="xforms-submit-done"> | |
<!-- Insert external validation results when done --> | |
<xforms:insert nodeset="." | |
origin="instance('validation-result')/v:data/*" /> |