1 /**
2 * Copyright 2005-2015 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package edu.sampleu.bookstore.document.attribs;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.rice.core.api.uif.DataType;
20 import org.kuali.rice.core.api.uif.RemotableAttributeError;
21 import org.kuali.rice.core.api.uif.RemotableAttributeField;
22 import org.kuali.rice.kew.api.KewApiConstants;
23 import org.kuali.rice.kew.api.document.DocumentWithContent;
24 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
25 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
26 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
27 import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
28 import org.kuali.rice.kew.api.extension.ExtensionDefinition;
29 import org.kuali.rice.kew.docsearch.DocumentSearchInternalUtils;
30 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
31 import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
32 import org.kuali.rice.kew.rule.xmlrouting.XPathHelper;
33 import org.kuali.rice.kns.util.FieldUtils;
34
35 import javax.jws.WebParam;
36 import javax.xml.xpath.XPath;
37 import javax.xml.xpath.XPathConstants;
38 import javax.xml.xpath.XPathExpressionException;
39 import java.io.StringReader;
40 import java.util.ArrayList;
41 import java.util.List;
42
43 /**
44 * Searchable attribute for book title
45 * TODO: probably needs to be wired up to extension repository for remote invocation
46 *
47 * <documentContent>
48 <applicationContent>
49 <org.kuali.rice.krad.workflow.KualiDocumentXmlMaterializer>
50 ...
51 <newMaintainableObject class="edu.sampleu.bookstore.maintenance.BookMaintainable">
52 <businessObject class="edu.sampleu.bookstore.bo.Book">
53 <title>asdfasdf</title>
54 <typeCode>ROM</typeCode>
55 <isbn/>
56 <publisher>asfdasdd</publisher>
57 <price>
58 <value>1212.00</value>
59 </price>
60 <rating>
61 <value>1</value>
62 </rating>
63 <authors>
64 <edu.sampleu.bookstore.bo.Author>
65 <authorName>asdfasdf</authorName>
66 <email>asdfasdf@gmailc.om</email>
67 <phoneNbr>123-123-1234</phoneNbr>
68 <active>true</active>
69 <addresses/>
70 <books/>
71 <newCollectionRecord>false</newCollectionRecord>
72 <extension class="edu.sampleu.bookstore.bo.Account">
73 <bankName>asdfasdf</bankName>
74 <accountNumber>12345</accountNumber>
75 <newCollectionRecord>false</newCollectionRecord>
76 </extension>
77 </edu.sampleu.bookstore.bo.Author>
78 </authors>
79 <newCollectionRecord>false</newCollectionRecord>
80 </businessObject>
81 <newCollectionLines/>
82 <inactiveRecordDisplay/>
83 <newCollectionLineNames/>
84 <documentNumber>3020</documentNumber>
85 <dataObject class="edu.sampleu.bookstore.bo.Book" reference="../businessObject"/>
86 <dataObjectClass>edu.sampleu.bookstore.bo.Book</dataObjectClass>
87 <maintenanceAction>New</maintenanceAction>
88 </newMaintainableObject>
89 ..
90 */
91 public class BookTitleSearchableAttribute extends XPathSearchableAttribute {
92 public BookTitleSearchableAttribute() {
93 super("book_title", KewApiConstants.SearchableAttributeConstants.DATA_TYPE_STRING, "//newMaintainableObject/businessObject/title/text()", "Book Title");
94 }
95 }