本文整理汇总了Java中org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException类的典型用法代码示例。如果您正苦于以下问题:Java IllegalDocumentTypeException类的具体用法?Java IllegalDocumentTypeException怎么用?Java IllegalDocumentTypeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IllegalDocumentTypeException类属于org.kuali.rice.kew.api.doctype包,在下文中一共展示了IllegalDocumentTypeException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeDocument
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* This method initializes the document by materializing and activating the
* first node instance on the document.
*/
public void initializeDocument(DocumentRouteHeaderValue document) {
// we set up a local route context here just so that we are able to
// utilize the saveNode method at the end of
// this method. Incidentally, this was changed from pulling the existing
// context out because it would override
// the document in the route context in the case of a document being
// initialized for reporting purposes.
RouteContext context = new RouteContext();
context.setDocument(document);
if (context.getEngineState() == null) {
context.setEngineState(new EngineState());
}
ProcessDefinitionBo process = document.getDocumentType().getPrimaryProcess();
if (process == null) {
throw new IllegalDocumentTypeException("DocumentType '" + document.getDocumentType().getName() + "' has no primary process configured!");
}
if (process.getInitialRouteNode() != null) {
RouteNodeInstance nodeInstance = helper.getNodeFactory().createRouteNodeInstance(document.getDocumentId(), process.getInitialRouteNode());
nodeInstance.setActive(true);
helper.getNodeFactory().createBranch(KewApiConstants.PRIMARY_BRANCH_NAME, null, nodeInstance);
nodeInstance = saveNode(context, nodeInstance);
document.getInitialRouteNodeInstances().add(nodeInstance);
}
}
示例2: testCreateNonRoutableDocumentType
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* Tests the attempt to create a document from a document type with no routing path.
*/
@Test(expected=IllegalDocumentTypeException.class)
public void testCreateNonRoutableDocumentType() throws Exception {
// the BlanketApproveTest is a parent document type that has no routing path defined. Attempts to
// create documents of this type should return a DocumentCreationException
WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "BlanketApproveTest");
}
示例3: testCreateInactiveDocumentType
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* Tests the attempt to create a document from a document type with no routing path.
*/
@Test(expected=IllegalDocumentTypeException.class)
public void testCreateInactiveDocumentType() throws Exception {
// the CreatedDocumentInactive document type is inactive and should not be able to
// be initiated for a new document
WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "CreatedDocumentInactive");
}
示例4: initializeDocument
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* This method initializes the document by materializing and activating the
* first node instance on the document.
*/
public void initializeDocument(DocumentRouteHeaderValue document) {
// we set up a local route context here just so that we are able to
// utilize the saveNode method at the end of
// this method. Incidentally, this was changed from pulling the existing
// context out because it would override
// the document in the route context in the case of a document being
// initialized for reporting purposes.
RouteContext context = new RouteContext();
context.setDocument(document);
if (context.getEngineState() == null) {
context.setEngineState(new EngineState());
}
ProcessDefinitionBo process = document.getDocumentType().getPrimaryProcess();
if (process == null) {
throw new IllegalDocumentTypeException("DocumentType '" + document.getDocumentType().getName() + "' has no primary process configured!");
}
if (process.getInitialRouteNode() != null) {
RouteNodeInstance nodeInstance = helper.getNodeFactory().createRouteNodeInstance(document.getDocumentId(), process.getInitialRouteNode());
nodeInstance.setActive(true);
helper.getNodeFactory().createBranch(KewApiConstants.PRIMARY_BRANCH_NAME, null, nodeInstance);
document.getInitialRouteNodeInstances().add(nodeInstance);
saveNode(context, nodeInstance);
}
}
示例5: createDocument
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
public DocumentRouteHeaderValue createDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
if (routeHeader.getDocumentId() != null) { // this is a debateable
// check - means the
// client is off
throw new InvalidActionTakenException("Document already has a Document id");
}
Principal principal = loadPrincipal(principalId);
boolean canInitiate = KEWServiceLocator.getDocumentTypePermissionService().canInitiate(principalId, routeHeader.getDocumentType());
if (!canInitiate) {
throw new InvalidActionTakenException("Principal with name '" + principal.getPrincipalName() + "' is not authorized to initiate documents of type '" + routeHeader.getDocumentType().getName());
}
if (!routeHeader.getDocumentType().isDocTypeActive()) {
// don't allow creation if document type is inactive
throw new IllegalDocumentTypeException("Document type '" + routeHeader.getDocumentType().getName() + "' is inactive");
}
routeHeader.setInitiatorWorkflowId(principalId);
if (routeHeader.getDocRouteStatus() == null) {
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
}
if (routeHeader.getDocRouteLevel() == null) {
routeHeader.setDocRouteLevel(Integer.valueOf(KewApiConstants.ADHOC_ROUTE_LEVEL));
}
if (routeHeader.getCreateDate() == null) {
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
}
if (routeHeader.getDocVersion() == null) {
routeHeader.setDocVersion(Integer.valueOf(KewApiConstants.DocumentContentVersions.CURRENT));
}
if (routeHeader.getDocContent() == null) {
routeHeader.setDocContent(KewApiConstants.DEFAULT_DOCUMENT_CONTENT);
}
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
routeHeader = KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).initializeDocument(routeHeader);
routeHeader = KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
return routeHeader;
}
示例6: create
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
@Override
public Document create(String documentTypeName,
String initiatorPrincipalId, DocumentUpdate documentUpdate,
DocumentContentUpdate documentContentUpdate)
throws RiceIllegalArgumentException, IllegalDocumentTypeException, InvalidActionTakenException {
incomingParamCheck(documentTypeName, "documentTypeName");
incomingParamCheck(initiatorPrincipalId, "initiatorPrincipalId");
if (LOG.isDebugEnabled()) {
LOG.debug("Create Document [documentTypeName=" + documentTypeName + ", initiatorPrincipalId="
+ initiatorPrincipalId + "]");
}
String documentTypeId = documentTypeService.getIdByName(documentTypeName);
if (documentTypeId == null) {
throw new RiceIllegalArgumentException("Failed to locate a document type with the given name: "
+ documentTypeName);
}
DocumentRouteHeaderValue documentBo = new DocumentRouteHeaderValue();
documentBo.setDocumentTypeId(documentTypeId);
documentBo.setInitiatorWorkflowId(initiatorPrincipalId);
if (documentUpdate != null) {
documentBo.setDocTitle(documentUpdate.getTitle());
documentBo.setAppDocId(documentUpdate.getApplicationDocumentId());
}
if (documentContentUpdate != null) {
String newDocumentContent = DTOConverter.buildUpdatedDocumentContent(null, documentContentUpdate,
documentTypeName);
documentBo.setDocContent(newDocumentContent);
}
try {
documentBo = KEWServiceLocator.getWorkflowDocumentService()
.createDocument(initiatorPrincipalId, documentBo);
} catch (WorkflowException e) {
// TODO remove this once we stop throwing WorkflowException everywhere!
translateException(e);
}
return DocumentRouteHeaderValue.to(documentBo);
}
示例7: createDocument
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
public DocumentRouteHeaderValue createDocument(String principalId, DocumentRouteHeaderValue routeHeader) throws WorkflowException {
if (routeHeader.getDocumentId() != null) { // this is a debateable
// check - means the
// client is off
throw new InvalidActionTakenException("Document already has a Document id");
}
Principal principal = loadPrincipal(principalId);
boolean canInitiate = KEWServiceLocator.getDocumentTypePermissionService().canInitiate(principalId, routeHeader.getDocumentType());
if (!canInitiate) {
throw new InvalidActionTakenException("Principal with name '" + principal.getPrincipalName() + "' is not authorized to initiate documents of type '" + routeHeader.getDocumentType().getName());
}
if (!routeHeader.getDocumentType().isDocTypeActive()) {
// don't allow creation if document type is inactive
throw new IllegalDocumentTypeException("Document type '" + routeHeader.getDocumentType().getName() + "' is inactive");
}
routeHeader.setInitiatorWorkflowId(principalId);
if (routeHeader.getDocRouteStatus() == null) {
routeHeader.setDocRouteStatus(KewApiConstants.ROUTE_HEADER_INITIATED_CD);
}
if (routeHeader.getDocRouteLevel() == null) {
routeHeader.setDocRouteLevel(Integer.valueOf(KewApiConstants.ADHOC_ROUTE_LEVEL));
}
if (routeHeader.getCreateDate() == null) {
routeHeader.setCreateDate(new Timestamp(new Date().getTime()));
}
if (routeHeader.getDocVersion() == null) {
routeHeader.setDocVersion(Integer.valueOf(KewApiConstants.DocumentContentVersions.CURRENT));
}
if (routeHeader.getDocContent() == null) {
routeHeader.setDocContent(KewApiConstants.DEFAULT_DOCUMENT_CONTENT);
}
routeHeader.setDateModified(new Timestamp(new Date().getTime()));
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).initializeDocument(routeHeader);
KEWServiceLocator.getRouteHeaderService().saveRouteHeader(routeHeader);
return routeHeader;
}
示例8: create
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* Creates a new document instance from the given document type. The initiator of the resulting
* document will be the same as the initiator that is passed to this method. Optional
* {@link DocumentUpdate} and {@link DocumentContentUpdate} parameters can be supplied in order
* to create the document with these additional pieces of data already set.
*
* <p>
* By default, if neither the {@link DocumentUpdate} or {@link DocumentContentUpdate} is passed
* to this method, the document that is created and returned from this operation will have the
* following initial state:
*
* <ul>
* <ol>
* {@code status} set to {@link DocumentStatus#INITIATED}
* </ol>
* <ol>
* {@code createDate} and {@code dateLastModified} set to the current date and time
* </ol>
* <ol>
* {@code current} set to 'true'
* </ol>
* <ol>
* {@code documentContent} set to the default and empty content
* </ol>
* </ul>
*
* <p>
* Additionally, the initial {@link org.kuali.rice.kew.api.document.node.RouteNodeInstance} for the workflow process on the document
* will be created and linked to the document as it's initial node. Once the document is
* created, the {@link #route(DocumentActionParameters)} operation must be invoked in order to
* submit it to the workflow engine for initial processing.
*
* <p>
* In certain situations, the given principal may not be permitted to initiate documents of the
* given type. In these cases an {@link InvalidActionTakenException} will be thrown.
*
* @param documentTypeName the name of the document type from which to create this document
* @param initiatorPrincipalId the id of the principal who is initiating this document
* @param documentUpdate specifies additional document to set on the document upon creation,
* this is optional and if null is passed then the document will be created with the
* default document state
* @param documentContentUpdate defines what the initial document content for the document
* should be, this is optional if null is passed then the document will be created with
* the default empty document content
*
* @return the document that was created
*
* @throws RiceIllegalArgumentException if {@code principalId} is null or blank
* @throws RiceIllegalArgumentException if {@code principalId} does not identify a valid
* principal
* @throws RiceIllegalArgumentException if {@code documentTypeName} is null or blank
* @throws RiceIllegalArgumentException if {@code documentTypeName} does not identify an
* existing document type
* @throws IllegalDocumentTypeException if the specified document type is not active
* @throws IllegalDocumentTypeException if the specified document type does not support document
* creation (in other words, it's a document type that is only used as a parent)
* @throws InvalidActionTakenException if the supplied principal is not allowed to execute this
* action
*/
@WebMethod(operationName = "create")
@WebResult(name = "document")
@XmlElement(name = "document", required = true)
Document create(@WebParam(name = "documentTypeName") String documentTypeName,
@WebParam(name = "initiatorPrincipalId") String initiatorPrincipalId,
@WebParam(name = "documentUpdate") DocumentUpdate documentUpdate, @WebParam(
name = "documentContentUpdate") DocumentContentUpdate documentContentUpdate) throws RiceIllegalArgumentException, IllegalDocumentTypeException, InvalidActionTakenException;
示例9: create
import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; //导入依赖的package包/类
/**
* Creates a new document instance from the given document type. The initiator of the resulting
* document will be the same as the initiator that is passed to this method. Optional
* {@link DocumentUpdate} and {@link DocumentContentUpdate} parameters can be supplied in order
* to create the document with these additional pieces of data already set.
*
* <p>
* By default, if neither the {@link DocumentUpdate} or {@link DocumentContentUpdate} is passed
* to this method, the document that is created and returned from this operation will have the
* following initial state:
*
* <ul>
* <ol>
* {@code status} set to {@link DocumentStatus#INITIATED}
* </ol>
* <ol>
* {@code createDate} and {@code dateLastModified} set to the current date and time
* </ol>
* <ol>
* {@code current} set to 'true'
* </ol>
* <ol>
* {@code documentContent} set to the default and empty content
* </ol>
* </ul>
*
* <p>
* Additionally, the initial {@link org.kuali.rice.kew.api.document.node.RouteNodeInstance} for the workflow process on the document
* will be created and linked to the document as it's initial node. Once the document is
* created, the {@link #route(DocumentActionParameters)} operation must be invoked in order to
* submit it to the workflow engine for initial processing.
*
* <p>
* In certain situations, the given principal may not be permitted to initiate documents of the
* given type. In these cases an {@link InvalidActionTakenException} will be thrown.
*
* @param documentTypeName the name of the document type from which to create this document
* @param initiatorPrincipalId the id of the principal who is initiating this document
* @param documentUpdate specifies additional document to set on the document upon creation,
* this is optional and if null is passed then the document will be created with the
* default document state
* @param documentContentUpdate defines what the initial document content for the document
* should be, this is optional if null is passed then the document will be created with
* the default empty document content
*
* @return the document that was created
*
* @throws RiceIllegalArgumentException if {@code principalId} is null or blank
* @throws RiceIllegalArgumentException if {@code principalId} does not identify a valid
* principal
* @throws RiceIllegalArgumentException if {@code documentTypeName} is null or blank
* @throws RiceIllegalArgumentException if {@code documentTypeName} does not identify an
* existing document type
* @throws IllegalDocumentTypeException if the specified document type is not active
* @throws IllegalDocumentTypeException if the specified document type does not support document
* creation (in other words, it's a document type that is only used as a parent)
* @throws InvalidActionTakenException if the supplied principal is not allowed to execute this
* action
*/
@WebMethod(operationName = "create")
@WebResult(name = "document")
@XmlElement(name = "document", required = true)
Document create(
@WebParam(name = "documentTypeName") String documentTypeName,
@WebParam(name = "initiatorPrincipalId") String initiatorPrincipalId,
@WebParam(name = "documentUpdate") DocumentUpdate documentUpdate,
@WebParam(name = "documentContentUpdate") DocumentContentUpdate documentContentUpdate)
throws RiceIllegalArgumentException, IllegalDocumentTypeException, InvalidActionTakenException;