[JBoss Seam] - Re: Paginator EJB and DataModel
by monkeyden
Gavin,
I extended your ListDataModel for this and used @Out instead of @DataModel. My extension provides the methods used for pagination and sorting and, in doing so, attempts to manipulate the super classes attributes (rowCount, rowIndex and wrappedData). The exception I'm getting is:
attempted to bind an Out attribute of the wrong type to: userSearchAction.paginator
Everything works fine up until Seam attempts to outject it. Maybe I'm misunderstanding how your code works. Is it not simply outjected as a ListDataModel?
Here is the relevant code:
My Seam action
public class UserSearchAction implements UserSearch
| @Out(required=false)
| private ListDataModelPaginator paginator;
| ...
| Query query = em.createQuery(query);
| paginator = new ListDataModelPaginator(query.getResultList());
| paginator.sort(ASC_NAME_COMPARATOR);
| ...
| }
Paginator
| public class ListDataModelPaginator extends ListDataModel {
|
| private int rowsPerPage = 20;
|
| public ListDataModelPaginator() {
| super(new ArrayList());
| }
|
| public ListDataModelPaginator(List list) { super(list); }
|
| public ListDataModelPaginator(List list, Comparator comp) {
| super(list);
| }
|
| public void scrollFirst() {
| setRowIndex(0);
| }
|
| public void scrollPrevious() {
| setRowIndex(getRowIndex()-rowsPerPage);
| if (getRowIndex() < 0) {
| setRowIndex(0);
| }
| }
|
| public void scrollNext() {
| setRowIndex(getRowIndex()+rowsPerPage);
| if (getRowIndex() >= getRowCount()) {
| setRowIndex(getRowCount() - rowsPerPage);
| if (getRowIndex() < 0) {
| setRowIndex(0);
| }
| }
| }
|
| public void scrollLast() {
| setRowIndex(getRowCount() - rowsPerPage);
| if (getRowIndex() < 0) {
| setRowIndex(0);
| }
| }
|
| public boolean getIsScrollFirstDisabled() {
| return getRowIndex() == 0;
| }
|
| public boolean getIsScrollLastDisabled() {
| return getRowIndex() >= getRowCount() - rowsPerPage;
| }
|
| public boolean getIsScrollNextDisabled() {
| return getRowIndex() >= getRowCount() - rowsPerPage;
| }
|
| public boolean getIsScrollPreviousDisabled() {
| return getRowIndex() == 0;
| }
|
| public int getRowsPerPage() {
| return rowsPerPage;
| }
|
| public void setRowsPerPage(int rowsPerPage) {
| this.rowsPerPage = rowsPerPage;
| }
|
| public void setSortedList(List items){
| super.setWrappedData(items);
| super.setRowIndex(0);
| }
|
| public void sort(Comparator comp){
| List unsorted = (List)getWrappedData();
| Collections.sort(unsorted, comp);
| super.setWrappedData(unsorted);
| super.setRowIndex(0);
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976679#3976679
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976679
19 years, 7 months
[JBoss jBPM] - Re: Using my own identity database
by bagrehc
Hi Larry,
after search a lot, I found something to solve our problem, but I think it's missing something else.
well I discover that you have to create an ExpressionAssignmentHandler subclass, and override the "getExpressionSession()" method as following:
| public class MyEAHandler extends ExpressionAssignmentHandler{
|
| protected ExpressionSession getExpressionSession() {
| JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
| if (jbpmContext==null) {
| throw new RuntimeException("no active JbpmContext for resolving assignment expression'"+expression+"'");
| }
| //HERE IS WHAT YOU HAVE TO CHANGE
| return new IdentitySession(jbpmContext.getSession());
| }
|
| }
|
So in the place where i commented in the code, above, you have to return your own object that implements ExpressionSession. ( up to here ok, :))
But these are the methods that you have to implement:
| public Group getGroupByName(String groupName);
|
| public User getUserByName(String userName);
|
Thus, here is the point, the "Group" and "User" are entities of the default Identity component and I don't know what to do.
Maybe I have to make my own "User" and "Group" entities extend the classes above, but I think it isn't a good way and may have another way to do that.
I you (Larry) or someone else find something new that could help us, please post here.
thanx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976677#3976677
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976677
19 years, 7 months
[JBoss jBPM] - Task Nodes - conditionally create tasks?
by cpob
(I'm using jBPM 3.1.2)
We have task nodes, and are creating a number of tasks on each task node.
There will always be one mandatory task per task node, and then a number of optional tasks per task node.
We would only like to create the optional task instances when the user wants, not automatically by jBPM.
However, we want the mandatory task instance to be automatically created by jBPM, so we can't use the create-tasks="false" ability of the task node.
I suggest an enhancement, and if people think its worthy, I'll add it to JIRA. I think task definitions should have another Y/N column "AUTOCREATE" (or something along those lines). The default would be yes, and then the task node would create only those which are set to be automatically created.
I searched the forum and JIRA, didn't find any reference to this matter, but sorry if its been talked about.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976672#3976672
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976672
19 years, 7 months