1 | |
|
2 | |
|
3 | |
|
4 | |
package edu.sampleu.bookstore.kew; |
5 | |
|
6 | |
import java.util.ArrayList; |
7 | |
import java.util.List; |
8 | |
|
9 | |
import org.apache.commons.lang.StringUtils; |
10 | |
import org.kuali.rice.core.util.AttributeSet; |
11 | |
import org.kuali.rice.kew.engine.RouteContext; |
12 | |
|
13 | |
import org.kuali.rice.kns.document.MaintenanceDocument; |
14 | |
import org.kuali.rice.kns.maintenance.Maintainable; |
15 | |
import org.kuali.rice.kns.workflow.attribute.QualifierResolverBase; |
16 | |
import edu.sampleu.bookstore.bo.Book; |
17 | |
import edu.sampleu.bookstore.bo.BookstoreKimAttributes; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | 0 | public class BookTypeQualifierResolver extends QualifierResolverBase { |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public List<AttributeSet> resolve(RouteContext context) { |
29 | 0 | List<AttributeSet> qualifiers = new ArrayList<AttributeSet>(); |
30 | 0 | MaintenanceDocument doc = (MaintenanceDocument) getDocument(context); |
31 | 0 | Maintainable maint = doc.getNewMaintainableObject(); |
32 | 0 | Book book = (Book) maint.getBusinessObject(); |
33 | 0 | if (StringUtils.isNotEmpty(book.getTypeCode())) { |
34 | 0 | qualifiers.add(new AttributeSet(BookstoreKimAttributes.BOOK_TYPE_CODE,book.getTypeCode())); |
35 | 0 | decorateWithCommonQualifiers(qualifiers, context, null); |
36 | |
} |
37 | |
else { |
38 | 0 | AttributeSet basicQualifier = new AttributeSet(); |
39 | 0 | qualifiers.add(basicQualifier); |
40 | |
} |
41 | 0 | return qualifiers; |
42 | |
} |
43 | |
|
44 | |
} |