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