001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package edu.sampleu.bookstore.document.attribs; 017 018 import edu.sampleu.kew.krad.KEWConstants; 019 import org.apache.log4j.Logger; 020 import org.kuali.rice.core.api.uif.DataType; 021 import org.kuali.rice.core.api.uif.RemotableAttributeError; 022 import org.kuali.rice.core.api.uif.RemotableAttributeField; 023 import org.kuali.rice.kew.api.KewApiConstants; 024 import org.kuali.rice.kew.api.document.DocumentWithContent; 025 import org.kuali.rice.kew.api.document.attribute.DocumentAttribute; 026 import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory; 027 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition; 028 import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria; 029 import org.kuali.rice.kew.api.extension.ExtensionDefinition; 030 import org.kuali.rice.kew.docsearch.DocumentSearchInternalUtils; 031 import org.kuali.rice.kew.docsearch.SearchableAttributeValue; 032 import org.kuali.rice.kew.framework.document.attribute.SearchableAttribute; 033 import org.kuali.rice.kew.rule.xmlrouting.XPathHelper; 034 import org.kuali.rice.kns.util.FieldUtils; 035 036 import javax.jws.WebParam; 037 import javax.xml.xpath.XPath; 038 import javax.xml.xpath.XPathConstants; 039 import javax.xml.xpath.XPathExpressionException; 040 import java.io.StringReader; 041 import java.util.ArrayList; 042 import java.util.List; 043 044 /** 045 * Searchable attribute for book title 046 * TODO: probably needs to be wired up to extension repository for remote invocation 047 * 048 * <documentContent> 049 <applicationContent> 050 <org.kuali.rice.krad.workflow.KualiDocumentXmlMaterializer> 051 ... 052 <newMaintainableObject class="edu.sampleu.bookstore.maintenance.BookMaintainable"> 053 <businessObject class="edu.sampleu.bookstore.bo.Book"> 054 <title>asdfasdf</title> 055 <typeCode>ROM</typeCode> 056 <isbn/> 057 <publisher>asfdasdd</publisher> 058 <price> 059 <value>1212.00</value> 060 </price> 061 <rating> 062 <value>1</value> 063 </rating> 064 <authors> 065 <edu.sampleu.bookstore.bo.Author> 066 <authorName>asdfasdf</authorName> 067 <email>asdfasdf@gmailc.om</email> 068 <phoneNbr>123-123-1234</phoneNbr> 069 <active>true</active> 070 <addresses/> 071 <books/> 072 <newCollectionRecord>false</newCollectionRecord> 073 <extension class="edu.sampleu.bookstore.bo.Account"> 074 <bankName>asdfasdf</bankName> 075 <accountNumber>12345</accountNumber> 076 <newCollectionRecord>false</newCollectionRecord> 077 </extension> 078 </edu.sampleu.bookstore.bo.Author> 079 </authors> 080 <newCollectionRecord>false</newCollectionRecord> 081 </businessObject> 082 <newCollectionLines/> 083 <inactiveRecordDisplay/> 084 <newCollectionLineNames/> 085 <documentNumber>3020</documentNumber> 086 <dataObject class="edu.sampleu.bookstore.bo.Book" reference="../businessObject"/> 087 <dataObjectClass>edu.sampleu.bookstore.bo.Book</dataObjectClass> 088 <maintenanceAction>New</maintenanceAction> 089 </newMaintainableObject> 090 .. 091 */ 092 public class BookTitleSearchableAttribute extends XPathSearchableAttribute { 093 public BookTitleSearchableAttribute() { 094 super("book_title", KewApiConstants.SearchableAttributeConstants.DATA_TYPE_STRING, "//newMaintainableObject/businessObject/title/text()", "Book Title"); 095 } 096 }