You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:35:00 UTC
svn commit: r673822 [2/7] - in /myfaces/orchestra/trunk:
examples/src/main/java/org/apache/myfaces/examples/annotations/
examples/src/main/java/org/apache/myfaces/examples/ballot/backings/
examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ ...
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Topic.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Topic.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Topic.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Topic.java Thu Jul 3 14:34:56 2008
@@ -33,151 +33,151 @@
import java.util.List;
@NamedQuery(
- name="getVotes",
- query="select topic.id, count(topic.id) from Topic topic join topic.items items join items.votes vote group by topic.id"
+ name="getVotes",
+ query="select topic.id, count(topic.id) from Topic topic join topic.items items join items.votes vote group by topic.id"
)
@Entity
public class Topic
{
- @Id
- @GeneratedValue(strategy= GenerationType.SEQUENCE)
- private Long id;
-
- @Column(nullable = false)
- private String name;
-
- @Column(nullable = false, length = 1024)
- private String description;
-
- @Column(nullable = false)
- private int minVote;
-
- @Column(nullable = false)
- private int maxVote;
-
- @Column(nullable = false)
- private int maxVoteCount;
-
- @ManyToOne(optional = false)
- private Voter owner;
-
- @OneToMany(mappedBy="topic", cascade = CascadeType.ALL)
- @OrderBy(value="content")
- private List<Item> items;
-
- private boolean started;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public List<Item> getItems()
- {
- return items;
- }
-
- public void setItems(List<Item> items)
- {
- this.items = items;
- }
-
- public void addItem(Item item)
- {
- if (items == null)
- {
- items = new ArrayList<Item>();
- }
-
- item.setTopic(this);
- items.add(item);
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
-
- public boolean isStarted()
- {
- return started;
- }
-
- public void setStarted(boolean started)
- {
- this.started = started;
- }
-
- public int getMinVote()
- {
- return minVote;
- }
-
- public void setMinVote(int minVote)
- {
- this.minVote = minVote;
- }
-
- public int getMaxVote()
- {
- return maxVote;
- }
-
- public void setMaxVote(int maxVote)
- {
- this.maxVote = maxVote;
- }
-
- public int getMaxVoteCount()
- {
- return maxVoteCount;
- }
-
- public void setMaxVoteCount(int maxVoteCount)
- {
- this.maxVoteCount = maxVoteCount;
- }
-
- public Voter getOwner()
- {
- return owner;
- }
-
- public void setOwner(Voter owner)
- {
- this.owner = owner;
- }
+ @Id
+ @GeneratedValue(strategy= GenerationType.SEQUENCE)
+ private Long id;
+
+ @Column(nullable = false)
+ private String name;
+
+ @Column(nullable = false, length = 1024)
+ private String description;
+
+ @Column(nullable = false)
+ private int minVote;
+
+ @Column(nullable = false)
+ private int maxVote;
+
+ @Column(nullable = false)
+ private int maxVoteCount;
+
+ @ManyToOne(optional = false)
+ private Voter owner;
+
+ @OneToMany(mappedBy="topic", cascade = CascadeType.ALL)
+ @OrderBy(value="content")
+ private List<Item> items;
+
+ private boolean started;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public List<Item> getItems()
+ {
+ return items;
+ }
+
+ public void setItems(List<Item> items)
+ {
+ this.items = items;
+ }
+
+ public void addItem(Item item)
+ {
+ if (items == null)
+ {
+ items = new ArrayList<Item>();
+ }
+
+ item.setTopic(this);
+ items.add(item);
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
+
+ public boolean isStarted()
+ {
+ return started;
+ }
+
+ public void setStarted(boolean started)
+ {
+ this.started = started;
+ }
+
+ public int getMinVote()
+ {
+ return minVote;
+ }
+
+ public void setMinVote(int minVote)
+ {
+ this.minVote = minVote;
+ }
+
+ public int getMaxVote()
+ {
+ return maxVote;
+ }
+
+ public void setMaxVote(int maxVote)
+ {
+ this.maxVote = maxVote;
+ }
+
+ public int getMaxVoteCount()
+ {
+ return maxVoteCount;
+ }
+
+ public void setMaxVoteCount(int maxVoteCount)
+ {
+ this.maxVoteCount = maxVoteCount;
+ }
+
+ public Voter getOwner()
+ {
+ return owner;
+ }
+
+ public void setOwner(Voter owner)
+ {
+ this.owner = owner;
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Vote.java Thu Jul 3 14:34:56 2008
@@ -35,104 +35,104 @@
import java.util.Date;
@NamedQuery(
- name="getVotesForVoter",
- query="select vote from Vote vote where vote.voter = :voter"
+ name="getVotesForVoter",
+ query="select vote from Vote vote where vote.voter = :voter"
)
@Entity
public class Vote
{
- @Id
- @GeneratedValue(strategy= GenerationType.SEQUENCE)
- private Long id;
-
- @ManyToOne
- @JoinColumn(nullable = false)
- private Item item;
-
- @ManyToOne
- @JoinColumn(nullable = false)
- private Voter voter;
-
- @Column(nullable = false)
- public int choice;
-
- @Temporal(value= TemporalType.TIMESTAMP)
- @Column(nullable = false)
- public Date created;
-
- @Temporal(value= TemporalType.TIMESTAMP)
- public Date changed;
-
- @Column(nullable = false)
- public String remoteIp;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public Item getItem()
- {
- return item;
- }
-
- public void setItem(Item item)
- {
- this.item = item;
- }
-
- public Voter getVoter()
- {
- return voter;
- }
-
- public void setVoter(Voter voter)
- {
- this.voter = voter;
- }
-
- public int getChoice()
- {
- return choice;
- }
-
- public void setChoice(int choice)
- {
- this.choice = choice;
- }
-
- public Date getCreated()
- {
- return created;
- }
-
- public void setCreated(Date created)
- {
- this.created = created;
- }
-
- public Date getChanged()
- {
- return changed;
- }
-
- public void setChanged(Date changed)
- {
- this.changed = changed;
- }
-
- public String getRemoteIp()
- {
- return remoteIp;
- }
-
- public void setRemoteIp(String remoteIp)
- {
- this.remoteIp = remoteIp;
- }
+ @Id
+ @GeneratedValue(strategy= GenerationType.SEQUENCE)
+ private Long id;
+
+ @ManyToOne
+ @JoinColumn(nullable = false)
+ private Item item;
+
+ @ManyToOne
+ @JoinColumn(nullable = false)
+ private Voter voter;
+
+ @Column(nullable = false)
+ public int choice;
+
+ @Temporal(value= TemporalType.TIMESTAMP)
+ @Column(nullable = false)
+ public Date created;
+
+ @Temporal(value= TemporalType.TIMESTAMP)
+ public Date changed;
+
+ @Column(nullable = false)
+ public String remoteIp;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Item getItem()
+ {
+ return item;
+ }
+
+ public void setItem(Item item)
+ {
+ this.item = item;
+ }
+
+ public Voter getVoter()
+ {
+ return voter;
+ }
+
+ public void setVoter(Voter voter)
+ {
+ this.voter = voter;
+ }
+
+ public int getChoice()
+ {
+ return choice;
+ }
+
+ public void setChoice(int choice)
+ {
+ this.choice = choice;
+ }
+
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ public void setCreated(Date created)
+ {
+ this.created = created;
+ }
+
+ public Date getChanged()
+ {
+ return changed;
+ }
+
+ public void setChanged(Date changed)
+ {
+ this.changed = changed;
+ }
+
+ public String getRemoteIp()
+ {
+ return remoteIp;
+ }
+
+ public void setRemoteIp(String remoteIp)
+ {
+ this.remoteIp = remoteIp;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Voter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Voter.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Voter.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/ballot/model/Voter.java Thu Jul 3 14:34:56 2008
@@ -33,83 +33,83 @@
@NamedQueries(
- value = {
- @NamedQuery(
- name = "getVoterByIdentification",
- query = "select voter from Voter voter where voter.identification = :identification"),
- @NamedQuery(
- name = "getVoterByEmail",
- query = "select voter from Voter voter where voter.email = :email"),
- @NamedQuery(
- name = "getVoterForTopic",
- query = "select distinct voter from Vote vote join vote.voter voter where vote.item.topic = :topic")
- })
+ value = {
+ @NamedQuery(
+ name = "getVoterByIdentification",
+ query = "select voter from Voter voter where voter.identification = :identification"),
+ @NamedQuery(
+ name = "getVoterByEmail",
+ query = "select voter from Voter voter where voter.email = :email"),
+ @NamedQuery(
+ name = "getVoterForTopic",
+ query = "select distinct voter from Vote vote join vote.voter voter where vote.item.topic = :topic")
+ })
@Entity
public class Voter
{
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE)
- private Long id;
-
- @Column(nullable = false)
- private String email;
-
- @Column(nullable = false)
- private String name;
-
- @Column(nullable = false)
- private String identification;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getEmail()
- {
- return email;
- }
-
- public void setEmail(String email)
- {
- this.email = email;
- }
-
- public String getIdentification()
- {
- return identification;
- }
-
- public void setIdentification(String identification)
- {
- this.identification = identification;
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE)
+ private Long id;
+
+ @Column(nullable = false)
+ private String email;
+
+ @Column(nullable = false)
+ private String name;
+
+ @Column(nullable = false)
+ private String identification;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ public String getIdentification()
+ {
+ return identification;
+ }
+
+ public void setIdentification(String identification)
+ {
+ this.identification = identification;
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Checkout.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Checkout.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Checkout.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Checkout.java Thu Jul 3 14:34:56 2008
@@ -22,8 +22,8 @@
public class Checkout
{
- public void initView()
- {
- ConversationUtils.ensureConversationRedirect("configuratorData", "/configurator/ComponentSelection.faces");
- }
+ public void initView()
+ {
+ ConversationUtils.ensureConversationRedirect("configuratorData", "/configurator/ComponentSelection.faces");
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/ConfiguratorData.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/ConfiguratorData.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/ConfiguratorData.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/ConfiguratorData.java Thu Jul 3 14:34:56 2008
@@ -35,165 +35,165 @@
public class ConfiguratorData
{
- private Long selectedComponent;
- private Long selectedPiece;
+ private Long selectedComponent;
+ private Long selectedPiece;
- // echte conversation scoped daten
- private ComponentDAO componentDao;
- private PieceDAO pieceDao;
- private OrderHeadDAO orderHeadDao;
- private Initialization initialization;
-
- private OrderHead orderHead;
-
- public Long getSelectedComponent()
- {
- return selectedComponent;
- }
-
- public void setSelectedComponent(Long selectedComponent)
- {
- this.selectedComponent = selectedComponent;
- }
-
- public Long getSelectedPiece()
- {
- return selectedPiece;
- }
-
- public void setSelectedPiece(Long selectedPiece)
- {
- this.selectedPiece = selectedPiece;
- }
-
- public ComponentDAO getComponentDao()
- {
- return componentDao;
- }
-
- public void setComponentDao(ComponentDAO componentDao)
- {
- this.componentDao = componentDao;
- }
-
- public Initialization getInitialization()
- {
- return initialization;
- }
-
- public void setInitialization(Initialization initialization)
- {
- this.initialization = initialization;
- }
-
- public PieceDAO getPieceDao()
- {
- return pieceDao;
- }
-
- public void setPieceDao(PieceDAO pieceDao)
- {
- this.pieceDao = pieceDao;
- }
-
- public OrderHeadDAO getOrderHeadDao()
- {
- return orderHeadDao;
- }
-
- public void setOrderHeadDao(OrderHeadDAO orderHeadDao)
- {
- this.orderHeadDao = orderHeadDao;
- }
-
- public List<SelectItem> getComponents()
- {
- List<SelectItem> ret = new ArrayList<SelectItem>();
- for (Component component : componentDao.getComponents())
- {
- ret.add(new SelectItem(component.getId(), component.getDescription()));
- }
- return ret;
- }
-
- public List<Piece> getPieces()
- {
- // XXX: Workaround
- Long cmp = getSelectedComponent();
- if (cmp == null && getComponents().size() > 0)
- {
- cmp = (Long) getComponents().get(0).getValue();
- }
- if (cmp == null)
- {
- return null;
- }
-
- Component component = componentDao.getByKey(cmp);
- return new ArrayList<Piece>(component.getPieces());
- }
-
- public OrderHead getOrder()
- {
- return orderHead;
- }
-
- public List<OrderItem> getOrderItems()
- {
- if (orderHead == null || orderHead.getOrderItems() == null)
- {
- return null;
- }
-
- return new ArrayList<OrderItem>(orderHead.getOrderItems());
- }
-
- public String orderItemAction()
- {
- if (orderHead == null)
- {
- orderHead = new OrderHead();
- }
-
- Piece piece = pieceDao.getByKey(getSelectedPiece());
-
- OrderItem orderItem = new OrderItem();
- orderItem.setPiece(piece);
- orderItem.setAmount(1);
-
- orderHead.addOrderItem(orderItem);
-
- return null;
- }
-
- @Transactional()
- public String buyAction()
- {
- orderHeadDao.save(orderHead);
-
- Conversation.getCurrentInstance()
- .invalidate();
-
- return "success";
- }
-
- @Transactional()
- public String setupDatabaseAction()
- {
- getInitialization().populateDatabase();
- return null;
- }
-
- public String cancelAction()
- {
- Conversation.getCurrentInstance()
- .invalidate();
-
- return "success";
- }
-
- public String checkoutAction()
- {
- return "success";
- }
+ // echte conversation scoped daten
+ private ComponentDAO componentDao;
+ private PieceDAO pieceDao;
+ private OrderHeadDAO orderHeadDao;
+ private Initialization initialization;
+
+ private OrderHead orderHead;
+
+ public Long getSelectedComponent()
+ {
+ return selectedComponent;
+ }
+
+ public void setSelectedComponent(Long selectedComponent)
+ {
+ this.selectedComponent = selectedComponent;
+ }
+
+ public Long getSelectedPiece()
+ {
+ return selectedPiece;
+ }
+
+ public void setSelectedPiece(Long selectedPiece)
+ {
+ this.selectedPiece = selectedPiece;
+ }
+
+ public ComponentDAO getComponentDao()
+ {
+ return componentDao;
+ }
+
+ public void setComponentDao(ComponentDAO componentDao)
+ {
+ this.componentDao = componentDao;
+ }
+
+ public Initialization getInitialization()
+ {
+ return initialization;
+ }
+
+ public void setInitialization(Initialization initialization)
+ {
+ this.initialization = initialization;
+ }
+
+ public PieceDAO getPieceDao()
+ {
+ return pieceDao;
+ }
+
+ public void setPieceDao(PieceDAO pieceDao)
+ {
+ this.pieceDao = pieceDao;
+ }
+
+ public OrderHeadDAO getOrderHeadDao()
+ {
+ return orderHeadDao;
+ }
+
+ public void setOrderHeadDao(OrderHeadDAO orderHeadDao)
+ {
+ this.orderHeadDao = orderHeadDao;
+ }
+
+ public List<SelectItem> getComponents()
+ {
+ List<SelectItem> ret = new ArrayList<SelectItem>();
+ for (Component component : componentDao.getComponents())
+ {
+ ret.add(new SelectItem(component.getId(), component.getDescription()));
+ }
+ return ret;
+ }
+
+ public List<Piece> getPieces()
+ {
+ // XXX: Workaround
+ Long cmp = getSelectedComponent();
+ if (cmp == null && getComponents().size() > 0)
+ {
+ cmp = (Long) getComponents().get(0).getValue();
+ }
+ if (cmp == null)
+ {
+ return null;
+ }
+
+ Component component = componentDao.getByKey(cmp);
+ return new ArrayList<Piece>(component.getPieces());
+ }
+
+ public OrderHead getOrder()
+ {
+ return orderHead;
+ }
+
+ public List<OrderItem> getOrderItems()
+ {
+ if (orderHead == null || orderHead.getOrderItems() == null)
+ {
+ return null;
+ }
+
+ return new ArrayList<OrderItem>(orderHead.getOrderItems());
+ }
+
+ public String orderItemAction()
+ {
+ if (orderHead == null)
+ {
+ orderHead = new OrderHead();
+ }
+
+ Piece piece = pieceDao.getByKey(getSelectedPiece());
+
+ OrderItem orderItem = new OrderItem();
+ orderItem.setPiece(piece);
+ orderItem.setAmount(1);
+
+ orderHead.addOrderItem(orderItem);
+
+ return null;
+ }
+
+ @Transactional()
+ public String buyAction()
+ {
+ orderHeadDao.save(orderHead);
+
+ Conversation.getCurrentInstance()
+ .invalidate();
+
+ return "success";
+ }
+
+ @Transactional()
+ public String setupDatabaseAction()
+ {
+ getInitialization().populateDatabase();
+ return null;
+ }
+
+ public String cancelAction()
+ {
+ Conversation.getCurrentInstance()
+ .invalidate();
+
+ return "success";
+ }
+
+ public String checkoutAction()
+ {
+ return "success";
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Customer.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Customer.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Customer.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/backings/Customer.java Thu Jul 3 14:34:56 2008
@@ -24,51 +24,51 @@
public class Customer
{
- private CustomerDAO customerDao;
- private org.apache.myfaces.examples.configurator.model.po.Customer customer;
+ private CustomerDAO customerDao;
+ private org.apache.myfaces.examples.configurator.model.po.Customer customer;
- public CustomerDAO getCustomerDao()
- {
- return customerDao;
- }
-
- public void setCustomerDao(CustomerDAO customerDao)
- {
- this.customerDao = customerDao;
- }
-
- public void initView()
- {
- if (customer == null)
- {
- customer = new org.apache.myfaces.examples.configurator.model.po.Customer();
- }
- }
-
- public org.apache.myfaces.examples.configurator.model.po.Customer getCustomer()
- {
- return customer;
- }
-
- @Transactional
- public String saveAction()
- {
- // should insert or update
- getCustomerDao().save(getCustomer());
-
- return FacesConst.SUCCESS;
- }
-
- @Transactional
- public String updateAction()
- {
- // should update
- return FacesConst.SUCCESS;
- }
-
- public String checkAction()
- {
- // should not issue a db request even if you changed something in the view
- return FacesConst.SUCCESS;
- }
+ public CustomerDAO getCustomerDao()
+ {
+ return customerDao;
+ }
+
+ public void setCustomerDao(CustomerDAO customerDao)
+ {
+ this.customerDao = customerDao;
+ }
+
+ public void initView()
+ {
+ if (customer == null)
+ {
+ customer = new org.apache.myfaces.examples.configurator.model.po.Customer();
+ }
+ }
+
+ public org.apache.myfaces.examples.configurator.model.po.Customer getCustomer()
+ {
+ return customer;
+ }
+
+ @Transactional
+ public String saveAction()
+ {
+ // should insert or update
+ getCustomerDao().save(getCustomer());
+
+ return FacesConst.SUCCESS;
+ }
+
+ @Transactional
+ public String updateAction()
+ {
+ // should update
+ return FacesConst.SUCCESS;
+ }
+
+ public String checkAction()
+ {
+ // should not issue a db request even if you changed something in the view
+ return FacesConst.SUCCESS;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/Initialization.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/Initialization.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/Initialization.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/Initialization.java Thu Jul 3 14:34:56 2008
@@ -27,47 +27,47 @@
public class Initialization
{
- @PersistenceContext
- private EntityManager entityManager;
+ @PersistenceContext
+ private EntityManager entityManager;
- public void populateDatabase()
- {
- // check if we have to initialize
- Query q = entityManager.createQuery("select component from Component component order by component.description");
- q.setMaxResults(1);
- if (q.getResultList().size() > 0)
- {
- // nope, return
- return;
- }
-
-
- Component cmpCase = new Component();
- cmpCase.setDescription("case");
- cmpCase.addPiece(createPiece("silent-lq", "low quality, not really silent, midi tower", 5));
- cmpCase.addPiece(createPiece("silent-hq", "high quality, super silent, tower", 50));
- cmpCase.addPiece(createPiece("desktop", "desktop, slim-sized, gray", 25));
- cmpCase.addPiece(createPiece("midi", "midi tower", 30));
- cmpCase.addPiece(createPiece("tower", "tower, plastic cover", 50));
- cmpCase.addPiece(createPiece("premium", "black tiger", 60));
- cmpCase.addPiece(createPiece("modder", "transparent door", 120));
- entityManager.persist(cmpCase);
-
- Component cmpMonitor = new Component();
- cmpMonitor.setDescription("monitor");
- cmpMonitor.addPiece(createPiece("lcd8", "high end pos 8\" lcd", 700));
- cmpMonitor.addPiece(createPiece("monitor", "old crt", 100));
- cmpMonitor.addPiece(createPiece("lcd19", "19\" lcd", 560));
- cmpMonitor.addPiece(createPiece("lcdWide", "21\" 16:9 video lcd", 1299));
- entityManager.persist(cmpMonitor);
- }
-
- private Piece createPiece(String name, String description, double price)
- {
- Piece piece = new Piece();
- piece.setNumber(name);
- piece.setDescription(description);
- piece.setPrice(price);
- return piece;
- }
+ public void populateDatabase()
+ {
+ // check if we have to initialize
+ Query q = entityManager.createQuery("select component from Component component order by component.description");
+ q.setMaxResults(1);
+ if (q.getResultList().size() > 0)
+ {
+ // nope, return
+ return;
+ }
+
+
+ Component cmpCase = new Component();
+ cmpCase.setDescription("case");
+ cmpCase.addPiece(createPiece("silent-lq", "low quality, not really silent, midi tower", 5));
+ cmpCase.addPiece(createPiece("silent-hq", "high quality, super silent, tower", 50));
+ cmpCase.addPiece(createPiece("desktop", "desktop, slim-sized, gray", 25));
+ cmpCase.addPiece(createPiece("midi", "midi tower", 30));
+ cmpCase.addPiece(createPiece("tower", "tower, plastic cover", 50));
+ cmpCase.addPiece(createPiece("premium", "black tiger", 60));
+ cmpCase.addPiece(createPiece("modder", "transparent door", 120));
+ entityManager.persist(cmpCase);
+
+ Component cmpMonitor = new Component();
+ cmpMonitor.setDescription("monitor");
+ cmpMonitor.addPiece(createPiece("lcd8", "high end pos 8\" lcd", 700));
+ cmpMonitor.addPiece(createPiece("monitor", "old crt", 100));
+ cmpMonitor.addPiece(createPiece("lcd19", "19\" lcd", 560));
+ cmpMonitor.addPiece(createPiece("lcdWide", "21\" 16:9 video lcd", 1299));
+ entityManager.persist(cmpMonitor);
+ }
+
+ private Piece createPiece(String name, String description, double price)
+ {
+ Piece piece = new Piece();
+ piece.setNumber(name);
+ piece.setDescription(description);
+ piece.setPrice(price);
+ return piece;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/ComponentDAO.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/ComponentDAO.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/ComponentDAO.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/ComponentDAO.java Thu Jul 3 14:34:56 2008
@@ -27,18 +27,18 @@
public class ComponentDAO
{
- @PersistenceContext
- private EntityManager entityManager;
+ @PersistenceContext
+ private EntityManager entityManager;
- @SuppressWarnings("unchecked")
- public List<Component> getComponents()
- {
- Query query = entityManager.createQuery("select component from Component component order by component.description");
- return (List<Component>) query.getResultList();
- }
+ @SuppressWarnings("unchecked")
+ public List<Component> getComponents()
+ {
+ Query query = entityManager.createQuery("select component from Component component order by component.description");
+ return (List<Component>) query.getResultList();
+ }
- public Component getByKey(Long selectedComponent)
- {
- return entityManager.find(Component.class, selectedComponent);
- }
+ public Component getByKey(Long selectedComponent)
+ {
+ return entityManager.find(Component.class, selectedComponent);
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/CustomerDAO.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/CustomerDAO.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/CustomerDAO.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/CustomerDAO.java Thu Jul 3 14:34:56 2008
@@ -25,11 +25,11 @@
public class CustomerDAO
{
- @PersistenceContext
- private EntityManager entityManager;
+ @PersistenceContext
+ private EntityManager entityManager;
- public void save(Customer customer)
- {
- entityManager.persist(customer);
- }
+ public void save(Customer customer)
+ {
+ entityManager.persist(customer);
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/OrderHeadDAO.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/OrderHeadDAO.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/OrderHeadDAO.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/OrderHeadDAO.java Thu Jul 3 14:34:56 2008
@@ -25,11 +25,11 @@
public class OrderHeadDAO
{
- @PersistenceContext
- private EntityManager entityManager;
+ @PersistenceContext
+ private EntityManager entityManager;
- public void save(OrderHead orderHead)
- {
- entityManager.persist(orderHead);
- }
+ public void save(OrderHead orderHead)
+ {
+ entityManager.persist(orderHead);
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/PieceDAO.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/PieceDAO.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/PieceDAO.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/dao/PieceDAO.java Thu Jul 3 14:34:56 2008
@@ -25,11 +25,11 @@
public class PieceDAO
{
- @PersistenceContext
- private EntityManager entityManager;
+ @PersistenceContext
+ private EntityManager entityManager;
- public Piece getByKey(Long pieceId)
- {
- return entityManager.find(Piece.class, pieceId);
- }
+ public Piece getByKey(Long pieceId)
+ {
+ return entityManager.find(Piece.class, pieceId);
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Component.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Component.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Component.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Component.java Thu Jul 3 14:34:56 2008
@@ -33,62 +33,62 @@
@Entity
public class Component
{
- @Id
- @GeneratedValue(strategy= GenerationType.TABLE)
- private Long id;
-
- private String description;
-
- @OneToMany(fetch = FetchType.LAZY, cascade=CascadeType.ALL, mappedBy = "component")
- @OrderBy(value="description")
- private Set<Piece> pieces;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public Set<Piece> getPieces()
- {
- return pieces;
- }
-
- public void addPiece(Piece piece)
- {
- if (this.pieces == null)
- {
- this.pieces = new HashSet<Piece>();
- }
-
- piece.setComponent(this);
- this.pieces.add(piece);
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy= GenerationType.TABLE)
+ private Long id;
+
+ private String description;
+
+ @OneToMany(fetch = FetchType.LAZY, cascade=CascadeType.ALL, mappedBy = "component")
+ @OrderBy(value="description")
+ private Set<Piece> pieces;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public Set<Piece> getPieces()
+ {
+ return pieces;
+ }
+
+ public void addPiece(Piece piece)
+ {
+ if (this.pieces == null)
+ {
+ this.pieces = new HashSet<Piece>();
+ }
+
+ piece.setComponent(this);
+ this.pieces.add(piece);
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Customer.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Customer.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Customer.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Customer.java Thu Jul 3 14:34:56 2008
@@ -27,66 +27,66 @@
@Entity
public class Customer
{
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE)
- private Long id;
-
- private String firstName;
-
- private String lastName;
-
- private String email;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public String getFirstName()
- {
- return firstName;
- }
-
- public void setFirstName(String firstName)
- {
- this.firstName = firstName;
- }
-
- public String getLastName()
- {
- return lastName;
- }
-
- public void setLastName(String lastName)
- {
- this.lastName = lastName;
- }
-
- public String getEmail()
- {
- return email;
- }
-
- public void setEmail(String email)
- {
- this.email = email;
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE)
+ private Long id;
+
+ private String firstName;
+
+ private String lastName;
+
+ private String email;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderHead.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderHead.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderHead.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderHead.java Thu Jul 3 14:34:56 2008
@@ -32,56 +32,56 @@
@Entity
public class OrderHead
{
- private Long id;
+ private Long id;
- private Set<OrderItem> orderItems;
+ private Set<OrderItem> orderItems;
- private Long version;
+ private Long version;
- @Id
- @GeneratedValue(strategy= GenerationType.TABLE)
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- @OneToMany(fetch = FetchType.LAZY, cascade= CascadeType.ALL, mappedBy="orderHead")
- public Set<OrderItem> getOrderItems()
- {
- return orderItems;
- }
-
- public void setOrderItems(Set<OrderItem> orderItems)
- {
- this.orderItems = orderItems;
- }
-
- public void addOrderItem(OrderItem orderItem)
- {
- if (this.orderItems == null)
- {
- this.orderItems = new HashSet<OrderItem>();
- }
-
- orderItem.setOrderHead(this);
- orderItem.setPosnr(orderItems.size()+10);
-
- this.orderItems.add(orderItem);
- }
-
- @Version
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy= GenerationType.TABLE)
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @OneToMany(fetch = FetchType.LAZY, cascade= CascadeType.ALL, mappedBy="orderHead")
+ public Set<OrderItem> getOrderItems()
+ {
+ return orderItems;
+ }
+
+ public void setOrderItems(Set<OrderItem> orderItems)
+ {
+ this.orderItems = orderItems;
+ }
+
+ public void addOrderItem(OrderItem orderItem)
+ {
+ if (this.orderItems == null)
+ {
+ this.orderItems = new HashSet<OrderItem>();
+ }
+
+ orderItem.setOrderHead(this);
+ orderItem.setPosnr(orderItems.size()+10);
+
+ this.orderItems.add(orderItem);
+ }
+
+ @Version
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderItem.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderItem.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderItem.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/OrderItem.java Thu Jul 3 14:34:56 2008
@@ -31,83 +31,83 @@
@Entity
public class OrderItem
{
- private Long id;
+ private Long id;
- private OrderHead orderHead;
+ private OrderHead orderHead;
- private int posnr;
+ private int posnr;
- private int amount;
+ private int amount;
- private Piece piece;
-
- private Long version;
-
-
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE)
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- @Version
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
-
- @ManyToOne()
- public OrderHead getOrderHead()
- {
- return orderHead;
- }
-
- public void setOrderHead(OrderHead orderHead)
- {
- this.orderHead = orderHead;
- }
-
- @Column(nullable = false)
- public int getPosnr()
- {
- return posnr;
- }
-
- public void setPosnr(int posnr)
- {
- this.posnr = posnr;
- }
-
- @Column(nullable = false)
- public int getAmount()
- {
- return amount;
- }
-
- public void setAmount(int amount)
- {
- this.amount = amount;
- }
-
- @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional=false)
- public Piece getPiece()
- {
- return piece;
- }
-
- public void setPiece(Piece piece)
- {
- this.piece = piece;
- }
+ private Piece piece;
+
+ private Long version;
+
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE)
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @Version
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
+
+ @ManyToOne()
+ public OrderHead getOrderHead()
+ {
+ return orderHead;
+ }
+
+ public void setOrderHead(OrderHead orderHead)
+ {
+ this.orderHead = orderHead;
+ }
+
+ @Column(nullable = false)
+ public int getPosnr()
+ {
+ return posnr;
+ }
+
+ public void setPosnr(int posnr)
+ {
+ this.posnr = posnr;
+ }
+
+ @Column(nullable = false)
+ public int getAmount()
+ {
+ return amount;
+ }
+
+ public void setAmount(int amount)
+ {
+ this.amount = amount;
+ }
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional=false)
+ public Piece getPiece()
+ {
+ return piece;
+ }
+
+ public void setPiece(Piece piece)
+ {
+ this.piece = piece;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Piece.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Piece.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Piece.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/configurator/model/po/Piece.java Thu Jul 3 14:34:56 2008
@@ -29,82 +29,82 @@
@Entity
public class Piece
{
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE)
- private Long id;
-
- @ManyToOne
- private Component component;
-
- // business key
- @Column(nullable = false)
- private String number;
-
- @Column(nullable = false)
- private String description;
-
- private double price;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public Component getComponent()
- {
- return component;
- }
-
- public void setComponent(Component component)
- {
- this.component = component;
- }
-
- public String getNumber()
- {
- return number;
- }
-
- public void setNumber(String number)
- {
- this.number = number;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public double getPrice()
- {
- return price;
- }
-
- public void setPrice(double price)
- {
- this.price = price;
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE)
+ private Long id;
+
+ @ManyToOne
+ private Component component;
+
+ // business key
+ @Column(nullable = false)
+ private String number;
+
+ @Column(nullable = false)
+ private String description;
+
+ private double price;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public Component getComponent()
+ {
+ return component;
+ }
+
+ public void setComponent(Component component)
+ {
+ this.component = component;
+ }
+
+ public String getNumber()
+ {
+ return number;
+ }
+
+ public void setNumber(String number)
+ {
+ this.number = number;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public double getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(double price)
+ {
+ this.price = price;
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/dynaForm/model/SimpleEntity.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/dynaForm/model/SimpleEntity.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/dynaForm/model/SimpleEntity.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/dynaForm/model/SimpleEntity.java Thu Jul 3 14:34:56 2008
@@ -37,107 +37,107 @@
@Entity
public class SimpleEntity
{
- @Id
- @GeneratedValue(strategy= GenerationType.SEQUENCE)
- private Long id;
-
- @Column(nullable = false)
- private String content;
-
- private boolean active;
-
- @Temporal(value = TemporalType.DATE)
- private Date startDate;
-
- @Temporal(value = TemporalType.TIME)
- private Date startTime;
-
- @Temporal(value = TemporalType.TIMESTAMP)
- @ReadOnly(disabled = true)
- private Date lastChanged;
-
- private Double value;
-
- @Version
- private Long version;
-
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- public String getContent()
- {
- return content;
- }
-
- public void setContent(String content)
- {
- this.content = content;
- }
-
- public boolean isActive()
- {
- return active;
- }
-
- public void setActive(boolean active)
- {
- this.active = active;
- }
-
- public Date getStartDate()
- {
- return startDate;
- }
-
- public void setStartDate(Date startDate)
- {
- this.startDate = startDate;
- }
-
- public Date getStartTime()
- {
- return startTime;
- }
-
- public void setStartTime(Date startTime)
- {
- this.startTime = startTime;
- }
-
- public Date getLastChanged()
- {
- return lastChanged;
- }
-
- public void setLastChanged(Date lastChanged)
- {
- this.lastChanged = lastChanged;
- }
-
- public Double getValue()
- {
- return value;
- }
-
- public void setValue(Double value)
- {
- this.value = value;
- }
-
- public Long getVersion()
- {
- return version;
- }
-
- public void setVersion(Long version)
- {
- this.version = version;
- }
+ @Id
+ @GeneratedValue(strategy= GenerationType.SEQUENCE)
+ private Long id;
+
+ @Column(nullable = false)
+ private String content;
+
+ private boolean active;
+
+ @Temporal(value = TemporalType.DATE)
+ private Date startDate;
+
+ @Temporal(value = TemporalType.TIME)
+ private Date startTime;
+
+ @Temporal(value = TemporalType.TIMESTAMP)
+ @ReadOnly(disabled = true)
+ private Date lastChanged;
+
+ private Double value;
+
+ @Version
+ private Long version;
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getContent()
+ {
+ return content;
+ }
+
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+ public boolean isActive()
+ {
+ return active;
+ }
+
+ public void setActive(boolean active)
+ {
+ this.active = active;
+ }
+
+ public Date getStartDate()
+ {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate)
+ {
+ this.startDate = startDate;
+ }
+
+ public Date getStartTime()
+ {
+ return startTime;
+ }
+
+ public void setStartTime(Date startTime)
+ {
+ this.startTime = startTime;
+ }
+
+ public Date getLastChanged()
+ {
+ return lastChanged;
+ }
+
+ public void setLastChanged(Date lastChanged)
+ {
+ this.lastChanged = lastChanged;
+ }
+
+ public Double getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Double value)
+ {
+ this.value = value;
+ }
+
+ public Long getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(Long version)
+ {
+ this.version = version;
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/filter/RequestEncodingFilter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/filter/RequestEncodingFilter.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/filter/RequestEncodingFilter.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/filter/RequestEncodingFilter.java Thu Jul 3 14:34:56 2008
@@ -28,20 +28,20 @@
public class RequestEncodingFilter implements Filter
{
- public void init(FilterConfig filterConfig) throws ServletException
- {
- // do nothing
- }
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ // do nothing
+ }
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
- {
- servletRequest.setCharacterEncoding("UTF-8");
-
- filterChain.doFilter(servletRequest, servletResponse);
- }
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ servletRequest.setCharacterEncoding("UTF-8");
+
+ filterChain.doFilter(servletRequest, servletResponse);
+ }
- public void destroy()
- {
- // do nothing
- }
+ public void destroy()
+ {
+ // do nothing
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java Thu Jul 3 14:34:56 2008
@@ -22,10 +22,10 @@
public final class FacesConst
{
- private FacesConst()
- {
- }
+ private FacesConst()
+ {
+ }
- public final static String SUCCESS = "success";
- public final static String FAILURE = "failure";
+ public final static String SUCCESS = "success";
+ public final static String FAILURE = "failure";
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesUtils.java Thu Jul 3 14:34:56 2008
@@ -24,19 +24,19 @@
public final class FacesUtils
{
- private FacesUtils()
- {
- }
+ private FacesUtils()
+ {
+ }
- public static void addErrorMessage(String message)
- {
- FacesContext.getCurrentInstance().addMessage(null,
- new FacesMessage(FacesMessage.SEVERITY_ERROR, null, message));
- }
+ public static void addErrorMessage(String message)
+ {
+ FacesContext.getCurrentInstance().addMessage(null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR, null, message));
+ }
- public static void addInfoMessage(String message)
- {
- FacesContext.getCurrentInstance().addMessage(null,
- new FacesMessage(FacesMessage.SEVERITY_INFO, null, message));
- }
+ public static void addInfoMessage(String message)
+ {
+ FacesContext.getCurrentInstance().addMessage(null,
+ new FacesMessage(FacesMessage.SEVERITY_INFO, null, message));
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/SpringUtils.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/SpringUtils.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/SpringUtils.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/SpringUtils.java Thu Jul 3 14:34:56 2008
@@ -26,17 +26,17 @@
public final class SpringUtils
{
- private SpringUtils()
- {
- }
+ private SpringUtils()
+ {
+ }
- public static void commit(PlatformTransactionManager transactionManager)
- {
- /* programmatic commit - should be easier, no?*/
-
- DefaultTransactionDefinition def = new DefaultTransactionDefinition();
- def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
- TransactionStatus status = transactionManager.getTransaction(def);
- transactionManager.commit(status);
- }
+ public static void commit(PlatformTransactionManager transactionManager)
+ {
+ /* programmatic commit - should be easier, no?*/
+
+ DefaultTransactionDefinition def = new DefaultTransactionDefinition();
+ def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
+ TransactionStatus status = transactionManager.getTransaction(def);
+ transactionManager.commit(status);
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/CustomerLogin.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/CustomerLogin.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/CustomerLogin.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/CustomerLogin.java Thu Jul 3 14:34:56 2008
@@ -30,93 +30,93 @@
@ViewController(viewIds="/mops/CustomerLogin.jsp")
public class CustomerLogin
{
- private PlatformTransactionManager transactionManager;
+ private PlatformTransactionManager transactionManager;
- private ShopCustomerDao shopCustomerDao;
+ private ShopCustomerDao shopCustomerDao;
- private ShopCustomer shopCustomer;
+ private ShopCustomer shopCustomer;
- private PetstoreData petstoreData;
+ private PetstoreData petstoreData;
- @InitView
- public void initView()
- {
- if (petstoreData.getCustomerId() != null)
- {
- shopCustomer = shopCustomerDao.getByKey(petstoreData.getCustomerId());
- }
-
- if (shopCustomer == null)
- {
- shopCustomer = new ShopCustomer();
- }
- }
-
- public PlatformTransactionManager getTransactionManager()
- {
- return transactionManager;
- }
-
- public void setTransactionManager(PlatformTransactionManager transactionManager)
- {
- this.transactionManager = transactionManager;
- }
-
- public PetstoreData getPetstoreData()
- {
- return petstoreData;
- }
-
- public void setPetstoreData(PetstoreData petstoreData)
- {
- this.petstoreData = petstoreData;
- }
-
- public ShopCustomerDao getShopCustomerDao()
- {
- return shopCustomerDao;
- }
-
- public void setShopCustomerDao(ShopCustomerDao shopCustomerDao)
- {
- this.shopCustomerDao = shopCustomerDao;
- }
-
- public ShopCustomer getShopCustomer()
- {
- return shopCustomer;
- }
-
- public void setShopCustomer(ShopCustomer shopCustomer)
- {
- this.shopCustomer = shopCustomer;
- }
-
- public boolean isLoggedIn()
- {
- return petstoreData.getCustomerId() != null;
- }
-
- public String saveAction()
- {
- SpringUtils.commit(transactionManager);
-
- // tell the other conversation to reload its data
- petstoreData.refreshCustomer();
-
- Conversation.getCurrentInstance().invalidate();
- return FacesConst.SUCCESS;
- }
-
- public String loginAction()
- {
- shopCustomerDao.save(shopCustomer);
-
- SpringUtils.commit(transactionManager);
-
- petstoreData.loginCustomer(shopCustomer.getId());
-
- Conversation.getCurrentInstance().invalidate();
- return FacesConst.SUCCESS;
- }
+ @InitView
+ public void initView()
+ {
+ if (petstoreData.getCustomerId() != null)
+ {
+ shopCustomer = shopCustomerDao.getByKey(petstoreData.getCustomerId());
+ }
+
+ if (shopCustomer == null)
+ {
+ shopCustomer = new ShopCustomer();
+ }
+ }
+
+ public PlatformTransactionManager getTransactionManager()
+ {
+ return transactionManager;
+ }
+
+ public void setTransactionManager(PlatformTransactionManager transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+
+ public PetstoreData getPetstoreData()
+ {
+ return petstoreData;
+ }
+
+ public void setPetstoreData(PetstoreData petstoreData)
+ {
+ this.petstoreData = petstoreData;
+ }
+
+ public ShopCustomerDao getShopCustomerDao()
+ {
+ return shopCustomerDao;
+ }
+
+ public void setShopCustomerDao(ShopCustomerDao shopCustomerDao)
+ {
+ this.shopCustomerDao = shopCustomerDao;
+ }
+
+ public ShopCustomer getShopCustomer()
+ {
+ return shopCustomer;
+ }
+
+ public void setShopCustomer(ShopCustomer shopCustomer)
+ {
+ this.shopCustomer = shopCustomer;
+ }
+
+ public boolean isLoggedIn()
+ {
+ return petstoreData.getCustomerId() != null;
+ }
+
+ public String saveAction()
+ {
+ SpringUtils.commit(transactionManager);
+
+ // tell the other conversation to reload its data
+ petstoreData.refreshCustomer();
+
+ Conversation.getCurrentInstance().invalidate();
+ return FacesConst.SUCCESS;
+ }
+
+ public String loginAction()
+ {
+ shopCustomerDao.save(shopCustomer);
+
+ SpringUtils.commit(transactionManager);
+
+ petstoreData.loginCustomer(shopCustomer.getId());
+
+ Conversation.getCurrentInstance().invalidate();
+ return FacesConst.SUCCESS;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditCustomerGroup.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditCustomerGroup.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditCustomerGroup.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditCustomerGroup.java Thu Jul 3 14:34:56 2008
@@ -29,98 +29,98 @@
public class EditCustomerGroup
{
- private CustomerGroupDao customerGroupDao;
+ private CustomerGroupDao customerGroupDao;
- private CustomerGroup customerGroup = new CustomerGroup();
+ private CustomerGroup customerGroup = new CustomerGroup();
- public CustomerGroupDao getCustomerGroupDao()
- {
- return customerGroupDao;
- }
-
- public void setCustomerGroupDao(CustomerGroupDao customerGroupDao)
- {
- this.customerGroupDao = customerGroupDao;
- }
-
- public CustomerGroup getCustomerGroup()
- {
- return customerGroup;
- }
-
- public void setCustomerGroup(CustomerGroup customerGroup)
- {
- this.customerGroup = customerGroup;
- }
-
- public boolean isSavedCustomerGroup()
- {
- return this.customerGroup != null && this.customerGroup.getId() != null;
- }
-
- public String newCustomerGroupAction()
- {
- Conversation.getCurrentInstance().invalidate();
-
- return FacesConst.SUCCESS;
- }
-
- public List<CustomerGroup> getCustomerGroups()
- {
- return customerGroupDao.getAll();
- }
-
- @Transactional()
- public String saveCustomerGroupAction()
- {
- customerGroupDao.save(getCustomerGroup());
-
- Conversation.getCurrentInstance().invalidate();
-
- return FacesConst.SUCCESS;
- }
-
- public void initCustomerGroup(Long id)
- {
- setCustomerGroup(customerGroupDao.getByKey(id));
- }
-
- public void deleteCustomerGroup(Long id)
- {
- CustomerGroup customerGroup = customerGroupDao.getByKey(id);
- customerGroupDao.delete(customerGroup);
-
- CustomerGroup newCustomerGroup = new CustomerGroup();
- newCustomerGroup.setDescription(customerGroup.getDescription());
-
- setCustomerGroup(newCustomerGroup);
- }
-
- @Transactional
- public String saveCustomerGroupsAction()
- {
- // due to @transaction we save any change in the list and invalidate the conversation then
- // a new one will be created and we get fresh data from the database
-
- Conversation.getCurrentInstance().invalidate();
-
- return FacesConst.SUCCESS;
- }
-
- @Transactional
- public String deleteCustomerGroupAction()
- {
- if (isSavedCustomerGroup())
- {
- // get the selected customer-group id
- Long customerGroupId = getCustomerGroup().getId();
-
- // restart the conversation to get rid of any queued entity change
- EditCustomerGroup newConversation = (EditCustomerGroup) ConversationUtils.invalidateAndRestartCurrent();
-
- // now finally delete and reinitialize the customer group
- newConversation.deleteCustomerGroup(customerGroupId);
- }
- return FacesConst.SUCCESS;
- }
+ public CustomerGroupDao getCustomerGroupDao()
+ {
+ return customerGroupDao;
+ }
+
+ public void setCustomerGroupDao(CustomerGroupDao customerGroupDao)
+ {
+ this.customerGroupDao = customerGroupDao;
+ }
+
+ public CustomerGroup getCustomerGroup()
+ {
+ return customerGroup;
+ }
+
+ public void setCustomerGroup(CustomerGroup customerGroup)
+ {
+ this.customerGroup = customerGroup;
+ }
+
+ public boolean isSavedCustomerGroup()
+ {
+ return this.customerGroup != null && this.customerGroup.getId() != null;
+ }
+
+ public String newCustomerGroupAction()
+ {
+ Conversation.getCurrentInstance().invalidate();
+
+ return FacesConst.SUCCESS;
+ }
+
+ public List<CustomerGroup> getCustomerGroups()
+ {
+ return customerGroupDao.getAll();
+ }
+
+ @Transactional()
+ public String saveCustomerGroupAction()
+ {
+ customerGroupDao.save(getCustomerGroup());
+
+ Conversation.getCurrentInstance().invalidate();
+
+ return FacesConst.SUCCESS;
+ }
+
+ public void initCustomerGroup(Long id)
+ {
+ setCustomerGroup(customerGroupDao.getByKey(id));
+ }
+
+ public void deleteCustomerGroup(Long id)
+ {
+ CustomerGroup customerGroup = customerGroupDao.getByKey(id);
+ customerGroupDao.delete(customerGroup);
+
+ CustomerGroup newCustomerGroup = new CustomerGroup();
+ newCustomerGroup.setDescription(customerGroup.getDescription());
+
+ setCustomerGroup(newCustomerGroup);
+ }
+
+ @Transactional
+ public String saveCustomerGroupsAction()
+ {
+ // due to @transaction we save any change in the list and invalidate the conversation then
+ // a new one will be created and we get fresh data from the database
+
+ Conversation.getCurrentInstance().invalidate();
+
+ return FacesConst.SUCCESS;
+ }
+
+ @Transactional
+ public String deleteCustomerGroupAction()
+ {
+ if (isSavedCustomerGroup())
+ {
+ // get the selected customer-group id
+ Long customerGroupId = getCustomerGroup().getId();
+
+ // restart the conversation to get rid of any queued entity change
+ EditCustomerGroup newConversation = (EditCustomerGroup) ConversationUtils.invalidateAndRestartCurrent();
+
+ // now finally delete and reinitialize the customer group
+ newConversation.deleteCustomerGroup(customerGroupId);
+ }
+ return FacesConst.SUCCESS;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/EditProduct.java Thu Jul 3 14:34:56 2008
@@ -37,133 +37,133 @@
@ViewController(viewIds="/mops/EditProduct.jsp")
public class EditProduct
{
- private ProductDao productDao;
+ private ProductDao productDao;
- private Product product;
- private ProductPrice productPrice;
+ private Product product;
+ private ProductPrice productPrice;
- public final static class ProductPriceWrapper
- {
- private final ProductPrice productPrice;
-
- public ProductPriceWrapper(ProductPrice productPrice)
- {
- this.productPrice = productPrice;
- }
-
- public ProductPrice getProductPrice()
- {
- return productPrice;
- }
- }
-
- @InitView
- public void myInitView()
- {
- String productId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("productId");
- if (!StringUtils.isEmpty(productId))
- {
- initProduct(Long.valueOf(productId, 10));
- }
-
- if (getProduct() == null)
- {
- setProduct(new Product());
- }
+ public final static class ProductPriceWrapper
+ {
+ private final ProductPrice productPrice;
+
+ public ProductPriceWrapper(ProductPrice productPrice)
+ {
+ this.productPrice = productPrice;
+ }
+
+ public ProductPrice getProductPrice()
+ {
+ return productPrice;
+ }
+ }
+
+ @InitView
+ public void myInitView()
+ {
+ String productId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("productId");
+ if (!StringUtils.isEmpty(productId))
+ {
+ initProduct(Long.valueOf(productId, 10));
+ }
+
+ if (getProduct() == null)
+ {
+ setProduct(new Product());
+ }
else if (getProductPrice() == null)
{
initNewProductPrice();
}
}
- public ProductDao getProductDao()
- {
- return productDao;
- }
-
- public void setProductDao(ProductDao productDao)
- {
- this.productDao = productDao;
- }
-
- public void initProduct(Long productId)
- {
- product = productDao.getByKey(productId);
- if (product == null)
- {
- FacesUtils.addInfoMessage("can't find a product with id '" + productId + "'");
- }
- }
-
- public Product getProduct()
- {
- return product;
- }
-
- public void setProduct(Product product)
- {
- this.product = product;
- }
-
- public boolean isSavedProduct()
- {
- return this.product != null && this.product.getVersion() != null;
- }
-
- public List<ProductPriceWrapper> getProductPrices()
- {
- if (product == null)
- {
- return Collections.EMPTY_LIST;
- }
-
- List<ProductPriceWrapper> ret = new ArrayList<ProductPriceWrapper>();
- for (ProductPrice price : product.getProductPrices())
- {
- ret.add(new ProductPriceWrapper(price));
- }
-
- return ret;
- }
-
- public String newProductAction()
- {
- Conversation.getCurrentInstance().invalidate();
-
- return FacesConst.SUCCESS;
- }
-
- @Transactional()
- public String saveProductAction()
- {
- productDao.save(product);
- initNewProductPrice();
-
- return FacesConst.SUCCESS;
- }
-
- public ProductPrice getProductPrice()
- {
- return productPrice;
- }
-
- public void setProductPrice(ProductPrice productPrice)
- {
- this.productPrice = productPrice;
- }
-
- public String newPriceAction()
- {
- initNewProductPrice();
-
- return FacesConst.SUCCESS;
- }
-
- private void initNewProductPrice()
- {
- productPrice = new ProductPrice();
- productPrice.setProduct(getProduct());
- }
+ public ProductDao getProductDao()
+ {
+ return productDao;
+ }
+
+ public void setProductDao(ProductDao productDao)
+ {
+ this.productDao = productDao;
+ }
+
+ public void initProduct(Long productId)
+ {
+ product = productDao.getByKey(productId);
+ if (product == null)
+ {
+ FacesUtils.addInfoMessage("can't find a product with id '" + productId + "'");
+ }
+ }
+
+ public Product getProduct()
+ {
+ return product;
+ }
+
+ public void setProduct(Product product)
+ {
+ this.product = product;
+ }
+
+ public boolean isSavedProduct()
+ {
+ return this.product != null && this.product.getVersion() != null;
+ }
+
+ public List<ProductPriceWrapper> getProductPrices()
+ {
+ if (product == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ List<ProductPriceWrapper> ret = new ArrayList<ProductPriceWrapper>();
+ for (ProductPrice price : product.getProductPrices())
+ {
+ ret.add(new ProductPriceWrapper(price));
+ }
+
+ return ret;
+ }
+
+ public String newProductAction()
+ {
+ Conversation.getCurrentInstance().invalidate();
+
+ return FacesConst.SUCCESS;
+ }
+
+ @Transactional()
+ public String saveProductAction()
+ {
+ productDao.save(product);
+ initNewProductPrice();
+
+ return FacesConst.SUCCESS;
+ }
+
+ public ProductPrice getProductPrice()
+ {
+ return productPrice;
+ }
+
+ public void setProductPrice(ProductPrice productPrice)
+ {
+ this.productPrice = productPrice;
+ }
+
+ public String newPriceAction()
+ {
+ initNewProductPrice();
+
+ return FacesConst.SUCCESS;
+ }
+
+ private void initNewProductPrice()
+ {
+ productPrice = new ProductPrice();
+ productPrice.setProduct(getProduct());
+ }
@Transactional()
public String savePricesAction()
@@ -172,18 +172,18 @@
}
@Transactional()
- public String savePriceAction()
- {
- getProduct().addProductPrice(productPrice);
-
- return FacesConst.SUCCESS;
- }
-
- @Transactional()
- public String deletePriceAction()
- {
- getProduct().removeProductPrice(productPrice);
+ public String savePriceAction()
+ {
+ getProduct().addProductPrice(productPrice);
- return FacesConst.SUCCESS;
- }
+ return FacesConst.SUCCESS;
+ }
+
+ @Transactional()
+ public String deletePriceAction()
+ {
+ getProduct().removeProductPrice(productPrice);
+
+ return FacesConst.SUCCESS;
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/PetstoreData.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/PetstoreData.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/PetstoreData.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/PetstoreData.java Thu Jul 3 14:34:56 2008
@@ -8,79 +8,79 @@
public class PetstoreData
{
- private ProductDao productDao;
- private ShopCustomerDao shopCustomerDao;
+ private ProductDao productDao;
+ private ShopCustomerDao shopCustomerDao;
- private ShopCustomer customer;
- private ShoppingCart shoppingCart;
+ private ShopCustomer customer;
+ private ShoppingCart shoppingCart;
- public ProductDao getProductDao()
- {
- return productDao;
- }
-
- public void setProductDao(ProductDao productDao)
- {
- this.productDao = productDao;
- }
-
- public ShopCustomerDao getShopCustomerDao()
- {
- return shopCustomerDao;
- }
-
- public void setShopCustomerDao(ShopCustomerDao shopCustomerDao)
- {
- this.shopCustomerDao = shopCustomerDao;
- }
-
- public ShopCustomer getCustomer()
- {
- return customer;
- }
-
- public Long getCustomerGroupId()
- {
- if (customer != null)
- {
- return customer.getCustomerGroup().getId();
- }
-
- return null;
- }
-
- @Transactional
- public void addProduct(Long productId, long quantity)
- {
- if (shoppingCart == null)
- {
- shoppingCart = new ShoppingCart();
- }
- shoppingCart.addProduct(productDao.getByKey(productId), quantity);
- }
-
- public void loginCustomer(long customerId)
- {
- customer = shopCustomerDao.getByKey(customerId);
- }
-
- public boolean isLoggedIn()
- {
- return customer != null;
- }
-
- public Long getCustomerId()
- {
- if (customer == null)
- {
- return null;
- }
-
- return customer.getId();
- }
-
- public void refreshCustomer()
- {
- shopCustomerDao.refresh(customer);
- }
+ public ProductDao getProductDao()
+ {
+ return productDao;
+ }
+
+ public void setProductDao(ProductDao productDao)
+ {
+ this.productDao = productDao;
+ }
+
+ public ShopCustomerDao getShopCustomerDao()
+ {
+ return shopCustomerDao;
+ }
+
+ public void setShopCustomerDao(ShopCustomerDao shopCustomerDao)
+ {
+ this.shopCustomerDao = shopCustomerDao;
+ }
+
+ public ShopCustomer getCustomer()
+ {
+ return customer;
+ }
+
+ public Long getCustomerGroupId()
+ {
+ if (customer != null)
+ {
+ return customer.getCustomerGroup().getId();
+ }
+
+ return null;
+ }
+
+ @Transactional
+ public void addProduct(Long productId, long quantity)
+ {
+ if (shoppingCart == null)
+ {
+ shoppingCart = new ShoppingCart();
+ }
+ shoppingCart.addProduct(productDao.getByKey(productId), quantity);
+ }
+
+ public void loginCustomer(long customerId)
+ {
+ customer = shopCustomerDao.getByKey(customerId);
+ }
+
+ public boolean isLoggedIn()
+ {
+ return customer != null;
+ }
+
+ public Long getCustomerId()
+ {
+ if (customer == null)
+ {
+ return null;
+ }
+
+ return customer.getId();
+ }
+
+ public void refreshCustomer()
+ {
+ shopCustomerDao.refresh(customer);
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/ProductDetail.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/ProductDetail.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/ProductDetail.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/ProductDetail.java Thu Jul 3 14:34:56 2008
@@ -33,94 +33,94 @@
@ViewController(viewIds="/mops/ProductDetail.jsp")
public class ProductDetail
{
- private ProductDao productDao;
- private ProductPriceDao productPriceDao;
+ private ProductDao productDao;
+ private ProductPriceDao productPriceDao;
- private Product product;
- private ProductPrice price;
+ private Product product;
+ private ProductPrice price;
- private PetstoreData petstoreData;
+ private PetstoreData petstoreData;
- private long quantity;
-
- @InitView
- public void myInitView()
- {
- String productId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("productId");
- if (!StringUtils.isEmpty(productId))
- {
- initProduct(Long.valueOf(productId, 10));
- }
- }
-
- public ProductDao getProductDao()
- {
- return productDao;
- }
-
- public void setProductDao(ProductDao productDao)
- {
- this.productDao = productDao;
- }
-
- public ProductPriceDao getProductPriceDao()
- {
- return productPriceDao;
- }
-
- public void setProductPriceDao(ProductPriceDao productPriceDao)
- {
- this.productPriceDao = productPriceDao;
- }
-
- public PetstoreData getPetstoreData()
- {
- return petstoreData;
- }
-
- public void setPetstoreData(PetstoreData petstoreData)
- {
- this.petstoreData = petstoreData;
- }
-
- public void initProduct(Long productId)
- {
- product = productDao.getByKey(productId);
- if (product == null)
- {
- FacesUtils.addInfoMessage("can't find a product with id '" + productId + "'");
- return;
- }
-
- price = productPriceDao.getPriceForProduct(
- product,
- petstoreData.getCustomerGroupId());
- }
-
- public Product getProduct()
- {
- return product;
- }
-
- public ProductPrice getPrice()
- {
- return price;
- }
-
- public long getQuantity()
- {
- return quantity;
- }
-
- public void setQuantity(long quantity)
- {
- this.quantity = quantity;
- }
-
- public String buyAction()
- {
- petstoreData.addProduct(getProduct().getId(), quantity);
+ private long quantity;
+
+ @InitView
+ public void myInitView()
+ {
+ String productId = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("productId");
+ if (!StringUtils.isEmpty(productId))
+ {
+ initProduct(Long.valueOf(productId, 10));
+ }
+ }
+
+ public ProductDao getProductDao()
+ {
+ return productDao;
+ }
+
+ public void setProductDao(ProductDao productDao)
+ {
+ this.productDao = productDao;
+ }
+
+ public ProductPriceDao getProductPriceDao()
+ {
+ return productPriceDao;
+ }
+
+ public void setProductPriceDao(ProductPriceDao productPriceDao)
+ {
+ this.productPriceDao = productPriceDao;
+ }
+
+ public PetstoreData getPetstoreData()
+ {
+ return petstoreData;
+ }
+
+ public void setPetstoreData(PetstoreData petstoreData)
+ {
+ this.petstoreData = petstoreData;
+ }
- return FacesConst.SUCCESS;
- }
+ public void initProduct(Long productId)
+ {
+ product = productDao.getByKey(productId);
+ if (product == null)
+ {
+ FacesUtils.addInfoMessage("can't find a product with id '" + productId + "'");
+ return;
+ }
+
+ price = productPriceDao.getPriceForProduct(
+ product,
+ petstoreData.getCustomerGroupId());
+ }
+
+ public Product getProduct()
+ {
+ return product;
+ }
+
+ public ProductPrice getPrice()
+ {
+ return price;
+ }
+
+ public long getQuantity()
+ {
+ return quantity;
+ }
+
+ public void setQuantity(long quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ public String buyAction()
+ {
+ petstoreData.addProduct(getProduct().getId(), quantity);
+
+ return FacesConst.SUCCESS;
+ }
}
\ No newline at end of file
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/SearchProduct.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/SearchProduct.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/SearchProduct.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/SearchProduct.java Thu Jul 3 14:34:56 2008
@@ -11,105 +11,105 @@
public class SearchProduct
{
- private ProductDao productDao;
- private ProductPriceDao productPriceDao;
+ private ProductDao productDao;
+ private ProductPriceDao productPriceDao;
- private PetstoreData petstoreData;
+ private PetstoreData petstoreData;
- private String searchText;
+ private String searchText;
- private List<ProductWrapper> products;
+ private List<ProductWrapper> products;
- public static class ProductWrapper
- {
- private final Product product;
- private final ProductPrice price;
-
- public ProductWrapper(Product product, ProductPrice price)
- {
- this.product = product;
- this.price = price;
- }
-
- public Product getProduct()
- {
- return product;
- }
-
- public ProductPrice getPrice()
- {
- return price;
- }
- }
-
- public PetstoreData getPetstoreData()
- {
- return petstoreData;
- }
-
- public void setPetstoreData(PetstoreData petstoreData)
- {
- this.petstoreData = petstoreData;
- }
-
- public ProductDao getProductDao()
- {
- return productDao;
- }
-
- public void setProductDao(ProductDao productDao)
- {
- this.productDao = productDao;
- }
-
- public ProductPriceDao getProductPriceDao()
- {
- return productPriceDao;
- }
-
- public void setProductPriceDao(ProductPriceDao productPriceDao)
- {
- this.productPriceDao = productPriceDao;
- }
-
- public String getSearchText()
- {
- return searchText;
- }
-
- public void setSearchText(String searchText)
- {
- this.searchText = searchText;
- }
-
- public List<ProductWrapper> getProducts()
- {
- return products;
- }
-
- public String searchProductAction()
- {
- List<Product> foundProducts;
- if (searchText == null)
- {
- foundProducts = productDao.getAll();
- }
- else
- {
- foundProducts = productDao.getProductsByFulltext(searchText);
- }
-
- List<ProductWrapper> result = new ArrayList<ProductWrapper>();
- for (Product product : foundProducts)
- {
- result.add(new ProductWrapper(
- product,
- productPriceDao.getPriceForProduct(product,
- petstoreData.getCustomerGroupId())));
- }
+ public static class ProductWrapper
+ {
+ private final Product product;
+ private final ProductPrice price;
+
+ public ProductWrapper(Product product, ProductPrice price)
+ {
+ this.product = product;
+ this.price = price;
+ }
+
+ public Product getProduct()
+ {
+ return product;
+ }
+
+ public ProductPrice getPrice()
+ {
+ return price;
+ }
+ }
+
+ public PetstoreData getPetstoreData()
+ {
+ return petstoreData;
+ }
+
+ public void setPetstoreData(PetstoreData petstoreData)
+ {
+ this.petstoreData = petstoreData;
+ }
+
+ public ProductDao getProductDao()
+ {
+ return productDao;
+ }
+
+ public void setProductDao(ProductDao productDao)
+ {
+ this.productDao = productDao;
+ }
+
+ public ProductPriceDao getProductPriceDao()
+ {
+ return productPriceDao;
+ }
+
+ public void setProductPriceDao(ProductPriceDao productPriceDao)
+ {
+ this.productPriceDao = productPriceDao;
+ }
+
+ public String getSearchText()
+ {
+ return searchText;
+ }
+
+ public void setSearchText(String searchText)
+ {
+ this.searchText = searchText;
+ }
+
+ public List<ProductWrapper> getProducts()
+ {
+ return products;
+ }
+
+ public String searchProductAction()
+ {
+ List<Product> foundProducts;
+ if (searchText == null)
+ {
+ foundProducts = productDao.getAll();
+ }
+ else
+ {
+ foundProducts = productDao.getProductsByFulltext(searchText);
+ }
+
+ List<ProductWrapper> result = new ArrayList<ProductWrapper>();
+ for (Product product : foundProducts)
+ {
+ result.add(new ProductWrapper(
+ product,
+ productPriceDao.getPriceForProduct(product,
+ petstoreData.getCustomerGroupId())));
+ }
- products = result;
+ products = result;
- return FacesConst.SUCCESS;
- }
+ return FacesConst.SUCCESS;
+ }
}
Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/Security.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/Security.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/Security.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/Security.java Thu Jul 3 14:34:56 2008
@@ -3,16 +3,16 @@
public class Security
{
- private boolean administratorMode;
+ private boolean administratorMode;
- public boolean isAdministratorMode()
- {
- return administratorMode;
- }
+ public boolean isAdministratorMode()
+ {
+ return administratorMode;
+ }
- public String switchAdministratorModeAction()
- {
- administratorMode = !administratorMode;
- return null;
- }
+ public String switchAdministratorModeAction()
+ {
+ administratorMode = !administratorMode;
+ return null;
+ }
}