View Javadoc

1   /**
2    * Copyright 2005-2012 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 edu.sampleu.kew.krad.KEWConstants;
19  import org.apache.log4j.Logger;
20  import org.kuali.rice.core.api.uif.DataType;
21  import org.kuali.rice.core.api.uif.RemotableAttributeError;
22  import org.kuali.rice.core.api.uif.RemotableAttributeField;
23  import org.kuali.rice.kew.api.KewApiConstants;
24  import org.kuali.rice.kew.api.document.DocumentWithContent;
25  import org.kuali.rice.kew.api.document.attribute.DocumentAttribute;
26  import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory;
27  import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
28  import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
29  import org.kuali.rice.kew.api.extension.ExtensionDefinition;
30  import org.kuali.rice.kew.docsearch.DocumentSearchInternalUtils;
31  import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
32  import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute;
33  import org.kuali.rice.kew.rule.xmlrouting.XPathHelper;
34  import org.kuali.rice.kns.util.FieldUtils;
35  
36  import javax.jws.WebParam;
37  import javax.xml.xpath.XPath;
38  import javax.xml.xpath.XPathConstants;
39  import javax.xml.xpath.XPathExpressionException;
40  import java.io.StringReader;
41  import java.util.ArrayList;
42  import java.util.List;
43  
44  /**
45   * Searchable attribute for book title
46   * TODO: probably needs to be wired up to extension repository for remote invocation
47   *
48   * <documentContent>
49     <applicationContent>
50     <org.kuali.rice.krad.workflow.KualiDocumentXmlMaterializer>
51     ...
52     <newMaintainableObject class="edu.sampleu.bookstore.maintenance.BookMaintainable">
53        <businessObject class="edu.sampleu.bookstore.bo.Book">
54          <title>asdfasdf</title>
55          <typeCode>ROM</typeCode>
56          <isbn/>
57          <publisher>asfdasdd</publisher>
58          <price>
59            <value>1212.00</value>
60          </price>
61          <rating>
62            <value>1</value>
63          </rating>
64          <authors>
65            <edu.sampleu.bookstore.bo.Author>
66              <authorName>asdfasdf</authorName>
67              <email>asdfasdf@gmailc.om</email>
68              <phoneNbr>123-123-1234</phoneNbr>
69              <active>true</active>
70              <addresses/>
71              <books/>
72              <newCollectionRecord>false</newCollectionRecord>
73              <extension class="edu.sampleu.bookstore.bo.Account">
74                <bankName>asdfasdf</bankName>
75                <accountNumber>12345</accountNumber>
76                <newCollectionRecord>false</newCollectionRecord>
77              </extension>
78            </edu.sampleu.bookstore.bo.Author>
79          </authors>
80          <newCollectionRecord>false</newCollectionRecord>
81        </businessObject>
82        <newCollectionLines/>
83        <inactiveRecordDisplay/>
84        <newCollectionLineNames/>
85        <documentNumber>3020</documentNumber>
86        <dataObject class="edu.sampleu.bookstore.bo.Book" reference="../businessObject"/>
87        <dataObjectClass>edu.sampleu.bookstore.bo.Book</dataObjectClass>
88        <maintenanceAction>New</maintenanceAction>
89      </newMaintainableObject>
90      ..
91   */
92  public class BookTitleSearchableAttribute extends XPathSearchableAttribute {
93      public BookTitleSearchableAttribute() {
94          super("book_title", KewApiConstants.SearchableAttributeConstants.DATA_TYPE_STRING, "//newMaintainableObject/businessObject/title/text()", "Book Title");
95      }
96  }