本文整理汇总了Java中org.kuali.rice.kew.api.document.DocumentWithContent类的典型用法代码示例。如果您正苦于以下问题:Java DocumentWithContent类的具体用法?Java DocumentWithContent怎么用?Java DocumentWithContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentWithContent类属于org.kuali.rice.kew.api.document包,在下文中一共展示了DocumentWithContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent) {
List<SearchableAttributeValue> searchableAttributeValues = new ArrayList<SearchableAttributeValue>();
String documentId = StringUtils.substringBetween(documentWithContent.getDocumentContent().toString(), "<string>", "</string>");
TimesheetDocument timesheetDocument = TkServiceLocator.getTimesheetService().getTimesheetDocument(documentId);
List<Long> workAreasIncluded = new ArrayList<Long>();
for(Assignment assign : timesheetDocument.getAllAssignments()){
if(!workAreasIncluded.contains(assign.getWorkArea())){
SearchableAttributeValue attValue = new SearchableAttributeLongValue();
attValue.setSearchableAttributeKey(WORK_AREA);
attValue.setupAttributeValue(StringUtils.upperCase(assign.getWorkArea().toString()));
searchableAttributeValues.add(attValue);
workAreasIncluded.add(assign.getWorkArea());
}
}
return searchableAttributeValues;
}
示例2: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(@WebParam(name = "extensionDefinition") ExtensionDefinition extensionDefinition,
@WebParam(name = "documentWithContent") DocumentWithContent documentWithContent) {
List<DocumentAttribute> attribs = new ArrayList<DocumentAttribute>(1);
String appContent = documentWithContent.getDocumentContent().getApplicationContent();
XPath xpath = XPathHelper.newXPath();
try {
//InputSource source = new StringReader(appContent);
Element source = DocumentBuilderFactory
.newInstance().newDocumentBuilder().parse(new InputSource(new BufferedReader(new StringReader(appContent)))).getDocumentElement();
String result = (String) xpath.evaluate(xpathExpression, source, XPathConstants.STRING);
// xpath has no concept of null node, missing text values are the empty string
if (StringUtils.isNotEmpty(result)) {
try {
attribs.add(createAttribute(this.key, result, this.dataType));
} catch (ParseException pe) {
log.error("Error converting value '" + result + "' to type '" + this.dataType + "'");
}
}
} catch (XPathExpressionException xep) {
log.error("Error evaluating searchable attribute expression: '" + this.xpathExpression + "'", xep);
} catch (SAXException se) {
log.error("Error parsing application content: '" + appContent + "'", se);
} catch (ParserConfigurationException pce) {
log.error("Error parsing application content: '" + appContent + "'", pce);
} catch (IOException ioe) {
log.error("Error parsing application content: '" + appContent + "'", ioe);
}
return attribs;
}
示例3: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
savs.add(DocumentAttributeFactory.createIntegerAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
return savs;
}
示例4: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> attributes = new ArrayList<DocumentAttribute>();
attributes.add(DocumentAttributeFactory.createStringAttribute("myAttribute", "myValue"));
attributes.add(DocumentAttributeFactory.createStringAttribute("myMultiValuedAttribute", "value1"));
attributes.add(DocumentAttributeFactory.createStringAttribute("myMultiValuedAttribute", "value2"));
attributes.add(DocumentAttributeFactory.createStringAttribute("criteriaUserId", "blank"));
return attributes;
}
示例5: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
savs.add(DocumentAttributeFactory.createStringAttribute("MockSearchableAttributeKey", "MockSearchableAttributeValue"));
return savs;
}
示例6: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
savs.add(DocumentAttributeFactory.createDateTimeAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
return savs;
}
示例7: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
savs.add(DocumentAttributeFactory.createStringAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
return savs;
}
示例8: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> savs = new ArrayList<DocumentAttribute>();
savs.add(DocumentAttributeFactory.createDecimalAttribute(SEARCH_STORAGE_KEY, SEARCH_STORAGE_VALUE));
return savs;
}
示例9: createDocumentWithSearchableContent
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
/**
* Helper to create documentwithcontent with searchable content
*/
protected DocumentWithContent createDocumentWithSearchableContent(String docType, String content) {
Document doc = Document.Builder.create("fakeDocId123", "fake initiator", docType, "fake doc type id").build();
DocumentContent.Builder c = DocumentContent.Builder.create("fakeDocId123");
c.setSearchableContent(content);
return DocumentWithContent.create(doc, c.build());
}
示例10: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "extractDocumentAttributes( " + extensionDefinition + ", " + documentWithContent + " )" );
}
return getSearchableAttribute().extractDocumentAttributes(extensionDefinition, documentWithContent);
}
示例11: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
List<DocumentAttribute> attributes = new ArrayList<DocumentAttribute>();
String docId = documentWithContent.getDocument().getDocumentId();
DocumentService docService = KRADServiceLocatorWeb.getDocumentService();
Document doc = null;
try {
doc = docService.getByDocumentHeaderIdSessionless(docId);
} catch (WorkflowException we) {
LOG.error( "Unable to retrieve document " + docId + " in getSearchStorageValues()", we);
}
String attributeValue = "";
if ( doc != null ) {
if ( doc.getDocumentHeader() != null ) {
attributeValue = doc.getDocumentHeader().getDocumentDescription();
} else {
attributeValue = "null document header";
}
} else {
attributeValue = "null document";
}
DocumentAttributeString attribute = DocumentAttributeFactory.createStringAttribute("documentDescription", attributeValue);
attributes.add(attribute);
attributeValue = "";
if ( doc != null ) {
if ( doc.getDocumentHeader() != null ) {
attributeValue = doc.getDocumentHeader().getOrganizationDocumentNumber();
} else {
attributeValue = "null document header";
}
} else {
attributeValue = "null document";
}
attribute = DocumentAttributeFactory.createStringAttribute("organizationDocumentNumber", attributeValue);
attributes.add(attribute);
if ( doc != null && doc instanceof MaintenanceDocument) {
final Class<? extends BusinessObject> businessObjectClass = getBusinessObjectClass(
documentWithContent.getDocument().getDocumentTypeName());
if (businessObjectClass != null) {
if (GlobalBusinessObject.class.isAssignableFrom(businessObjectClass)) {
final GlobalBusinessObject globalBO = retrieveGlobalBusinessObject(docId, businessObjectClass);
if (globalBO != null) {
attributes.addAll(findAllDocumentAttributesForGlobalBusinessObject(globalBO));
}
} else {
attributes.addAll(parsePrimaryKeyValuesFromDocument(businessObjectClass, (MaintenanceDocument)doc));
}
}
}
if ( doc != null ) {
DocumentEntry docEntry = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDocumentEntry(
documentWithContent.getDocument().getDocumentTypeName());
if ( docEntry != null ) {
WorkflowAttributes workflowAttributes = docEntry.getWorkflowAttributes();
WorkflowAttributePropertyResolutionService waprs = KNSServiceLocator
.getWorkflowAttributePropertyResolutionService();
attributes.addAll(waprs.resolveSearchableAttributeValues(doc, workflowAttributes));
} else {
LOG.error("Unable to find DD document entry for document type: " + documentWithContent.getDocument()
.getDocumentTypeName());
}
}
return attributes;
}
示例12: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public final List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition,
DocumentWithContent documentWithContent) {
return getSearchableAttribute().extractDocumentAttributes(extensionDefinition, documentWithContent);
}
示例13: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent) {
if (LOG.isDebugEnabled()) {
LOG.debug("extractDocumentAttributes( " + extensionDefinition + ", " + documentWithContent + " )");
}
List<DocumentAttribute> searchAttrValues = super.extractDocumentAttributes(extensionDefinition, documentWithContent);
String docId = documentWithContent.getDocument().getDocumentId();
DocumentService docService = SpringContext.getBean(DocumentService.class);
Document doc = null;
try {
doc = docService.getByDocumentHeaderIdSessionless(docId);
}
catch (WorkflowException we) {
}
if (doc != null) {
if (doc instanceof AmountTotaling) {
DocumentAttributeDecimal.Builder searchableAttributeValue = DocumentAttributeDecimal.Builder.create(OLEPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT);
searchableAttributeValue.setValue(((AmountTotaling) doc).getTotalDollarAmount().bigDecimalValue());
searchAttrValues.add(searchableAttributeValue.build());
}
if (doc instanceof AccountingDocument) {
AccountingDocument accountingDoc = (AccountingDocument) doc;
searchAttrValues.addAll(harvestAccountingDocumentSearchableAttributes(accountingDoc));
}
boolean indexedLedgerDoc = false;
if (doc instanceof GeneralLedgerPostingDocument && !indexedLedgerDoc) {
GeneralLedgerPostingDocument GLPostingDoc = (GeneralLedgerPostingDocument) doc;
searchAttrValues.addAll(harvestGLPDocumentSearchableAttributes(GLPostingDoc));
}
if (doc instanceof PurchasingAccountsPayableDocument) {
PurchasingAccountsPayableDocument purchasingAccountsPayableDocument = (PurchasingAccountsPayableDocument)doc;
searchAttrValues.addAll(harvestPurchasingAccountsPayableDocument(purchasingAccountsPayableDocument));
}
if (doc instanceof OleLineItemReceivingDocument |
doc instanceof OleCorrectionReceivingDocument) {
ReceivingDocument receivingDocument = (ReceivingDocument)doc;
searchAttrValues.addAll(harvestReceivingDocument(receivingDocument));
}
if(doc instanceof OleInvoiceDocument){
StringBuffer purchaseOrderDocumentNums = new StringBuffer();
OleInvoiceDocument invoiceDocument = (OleInvoiceDocument) doc;
for (Object purApItem : invoiceDocument.getItems()) {
OleInvoiceItem invoiceItem = (OleInvoiceItem) purApItem;
if(invoiceItem.getPurchaseOrderIdentifier() != null) {
purchaseOrderDocumentNums.append(invoiceItem.getPurchaseOrderIdentifier().toString()+",");
}
}
int len = purchaseOrderDocumentNums.lastIndexOf(",");
if (len > 0) {
purchaseOrderDocumentNums.replace(len, len + 1, " ");
}
DocumentAttributeString.Builder poDocNumSearchableAttributeValue = DocumentAttributeString.Builder.create(OleSelectConstant.InvoiceSearch.PO_DOC_NUMS);
poDocNumSearchableAttributeValue.setValue(purchaseOrderDocumentNums.toString());
searchAttrValues.add(poDocNumSearchableAttributeValue.build());
DateFormat sourceFormat = new SimpleDateFormat("dd-MM-yyyy");
String invoiceDate = sourceFormat.format(invoiceDocument.getInvoiceDate());
String invoicePayDate = sourceFormat.format(invoiceDocument.getInvoicePayDate());
DocumentAttributeString.Builder invDateSearchableAttributeValue = DocumentAttributeString.Builder.create(OleSelectConstant.InvoiceSearch.PO_DIS_INV_DT);
invDateSearchableAttributeValue.setValue(invoiceDate);
searchAttrValues.add(invDateSearchableAttributeValue.build());
DocumentAttributeString.Builder invPayDateSearchableAttributeValue = DocumentAttributeString.Builder.create(OleSelectConstant.InvoiceSearch.PO_DIS_INV_PAY_DT);
invPayDateSearchableAttributeValue.setValue(invoicePayDate);
searchAttrValues.add(invPayDateSearchableAttributeValue.build());
}
}
return searchAttrValues;
}
示例14: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
@Override
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentWithContent) {
if (LOG.isDebugEnabled()) {
LOG.debug("extractDocumentAttributes( " + extensionDefinition + ", " + documentWithContent + " )");
}
List<DocumentAttribute> searchAttrValues = super.extractDocumentAttributes(extensionDefinition, documentWithContent);
String docId = documentWithContent.getDocument().getDocumentId();
DocumentService docService = SpringContext.getBean(DocumentService.class);
Document doc = null;
try {
doc = docService.getByDocumentHeaderIdSessionless(docId);
}
catch (WorkflowException we) {
}
if (doc != null) {
if (doc instanceof AmountTotaling && ((AmountTotaling)doc).getTotalDollarAmount() != null) {
DocumentAttributeDecimal.Builder searchableAttributeValue = DocumentAttributeDecimal.Builder.create(KFSPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT);
searchableAttributeValue.setValue(((AmountTotaling) doc).getTotalDollarAmount().bigDecimalValue());
searchAttrValues.add(searchableAttributeValue.build());
}
if (doc instanceof AccountingDocument) {
AccountingDocument accountingDoc = (AccountingDocument) doc;
searchAttrValues.addAll(harvestAccountingDocumentSearchableAttributes(accountingDoc));
}
boolean indexedLedgerDoc = false;
if (doc instanceof LaborLedgerPostingDocumentForSearching) {
LaborLedgerPostingDocumentForSearching LLPostingDoc = (LaborLedgerPostingDocumentForSearching) doc;
searchAttrValues.addAll(harvestLLPDocumentSearchableAttributes(LLPostingDoc));
indexedLedgerDoc = true;
}
if (doc instanceof GeneralLedgerPostingDocument && !indexedLedgerDoc) {
GeneralLedgerPostingDocument GLPostingDoc = (GeneralLedgerPostingDocument) doc;
searchAttrValues.addAll(harvestGLPDocumentSearchableAttributes(GLPostingDoc));
}
}
return searchAttrValues;
}
示例15: extractDocumentAttributes
import org.kuali.rice.kew.api.document.DocumentWithContent; //导入依赖的package包/类
/**
* Extracts and returns document attributes for the given document in order to allow indexing of those values for
* association with the document and use in document searches. The document and it's XML content is passed to this
* method as that is a common source of data for indexing purposes, though implementations are free to pull data for
* indexing from any readily accessible source.
*
* <p>There are a finite set of {@link DocumentAttribute} implementations which can be returned and interpreted
* correctly. Client application's should <strong>not</strong> create custom extensions of the
* {@code DocumentAttribute} abstract class but should preferably use the
* {@link org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory} to construct strongly-typed document
* attribute instances for indexing.</p>
*
* @param extensionDefinition the extension definition which was used to locate and load this searchable attribute
* implementation
* @param documentWithContent the workflow document and it's XML content
*
* @return a list of document attribute values that should be indexed for the given document, or a null or empty
* list if no attributes should be indexed
*
* @see org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory
*/
@WebMethod(operationName = "extractDocumentAttributes")
@WebResult(name = "documentAttributes")
@XmlElementWrapper(name = "documentAttributes", required = false)
@XmlElement(name = "documentAttribute", required = false)
public List<DocumentAttribute> extractDocumentAttributes(
@WebParam(name = "extensionDefinition") ExtensionDefinition extensionDefinition,
@WebParam(name = "documentWithContent") DocumentWithContent documentWithContent);