當前位置: 首頁>>代碼示例>>Java>>正文


Java WorkflowException類代碼示例

本文整理匯總了Java中com.adobe.granite.workflow.WorkflowException的典型用法代碼示例。如果您正苦於以下問題:Java WorkflowException類的具體用法?Java WorkflowException怎麽用?Java WorkflowException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WorkflowException類屬於com.adobe.granite.workflow包,在下文中一共展示了WorkflowException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doGet

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response)
        throws ServletException, IOException {
    try {
        WorkflowSession workflowSession = request.getResourceResolver().adaptTo(WorkflowSession.class);
        ArrayList<Resource> resources = new ArrayList<>();
        if (workflowSession != null) {
            WorkflowModel[] models = workflowSession.getModels();
            for (WorkflowModel model : models) {
                resources.add(new WorkflowModelResource(model, request.getResourceResolver()));
            }
        }
        SimpleDataSource dataSource = new SimpleDataSource(resources.iterator());
        request.setAttribute(DataSource.class.getName(), dataSource);
    } catch (WorkflowException e) {
        throw new ServletException(e);
    }
}
 
開發者ID:Adobe-Marketing-Cloud,項目名稱:aem-core-wcm-components,代碼行數:19,代碼來源:WorkflowModelDataSourceServlet.java

示例2: getDelegateWorkflowModel

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
private WorkflowModel getDelegateWorkflowModel(WorkflowSession workflowSession,
                                               String foundWorkflowModelId,
                                               String defaultWorkflowModelId) throws WorkflowException {
    WorkflowModel workflowModel = null;
    if (StringUtils.isNotBlank(foundWorkflowModelId)) {
        workflowModel = getWorkflowModel(workflowSession, foundWorkflowModelId);

        if (workflowModel != null) {
            log.debug("Using configured delegate Workflow Model [ {} ]", workflowModel.getId());
        } else {
            throw new WorkflowException(String.format("Could not find configured Workflow Model at [ %s ]", foundWorkflowModelId));
        }
    } else if (StringUtils.isNotBlank(defaultWorkflowModelId)) {
        workflowModel = getWorkflowModel(workflowSession, defaultWorkflowModelId);

        if (workflowModel != null) {
            log.debug("Using default delegate Workflow Model [ {} ]", workflowModel.getId());
        } else {
            throw new WorkflowException(String.format("Could not find default Workflow Model at [ %s ]", defaultWorkflowModelId));
        }
    }

    return workflowModel;
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:25,代碼來源:WorkflowDelegationStep.java

示例3: getWorkflowModel

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
private WorkflowModel getWorkflowModel(WorkflowSession workflowSession, String workflowModelId) {
    workflowModelId = StringUtils.stripToEmpty(workflowModelId);
    WorkflowModel workflowModel = null;

    if (StringUtils.isNotBlank(workflowModelId)) {
        if (!workflowModelId.endsWith("/jcr:content/model")) {
            ResourceResolver resourceResolver = workflowHelper.getResourceResolver(workflowSession);
            Resource resource = resourceResolver.getResource(workflowModelId + "/jcr:content/model");
            if (resource != null
                    && StringUtils.equals(resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class),"cq:WorkflowModel")) {
                workflowModelId = resource.getPath();
            }
        }

        try {
            workflowModel = workflowSession.getModel(workflowModelId);
        } catch (WorkflowException e) {
            log.warn("Could not find Workflow Model for [ {} ]", workflowModelId);
        }
    }

    return workflowModel;
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:24,代碼來源:WorkflowDelegationStep.java

示例4: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public Serializable execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    ResourceResolver resolver = workflowSession.adaptTo(ResourceResolver.class);
    Asset asset = getAssetFromPayload(workItem, resolver);
    if (asset == null) {
        return null;
    }

    String mimeType = asset.getMimeType();
    if (!mimeType.startsWith("video/") && !mimeType.startsWith("audio/")) {
        return null;
    }

    try {
        Serializable jobId = audioHelper.process(asset, resolver, metaDataMap, this);

        if (jobId != null) {
            return jobId;
        } else {
            return null;
        }
    } catch (AudioException e) {
        throw new WorkflowException("Unable to start transcription process.", e);
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:26,代碼來源:TranscriptionProcess.java

示例5: terminateWorkflow

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
@SuppressWarnings("squid:S1192")
public final void terminateWorkflow(final Workflow workflow) throws WorkflowException {
    if (workflow instanceof  SyntheticWorkflow) {
        throw new SyntheticTerminateWorkflowException("Synthetic workflow [ " + workflow.getId() + " ] terminated");
    } else {
        throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:10,代碼來源:SyntheticWorkflowSession.java

示例6: complete

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
@SuppressWarnings("squid:S1192")
public final void complete(final WorkItem workItem, final Route route) throws WorkflowException {
    if (workItem instanceof SyntheticWorkItem) {
        throw new SyntheticCompleteWorkflowException("Synthetic workflow [ "
                + workItem.getWorkflow().getId() + " : " + workItem.getId() + " ] completed");
    } else {
        throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:11,代碼來源:SyntheticWorkflowSession.java

示例7: restartWorkflow

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
@SuppressWarnings("squid:S1192")
public final void restartWorkflow(final Workflow workflow) throws WorkflowException {
    if (workflow instanceof SyntheticWorkflow) {
        throw new SyntheticRestartWorkflowException("Synthetic workflow [ " + workflow.getId() + " ] restarted");
   } else {
        throw new UnsupportedOperationException(UNSUPPORTED_OPERATION_MESSAGE);
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:10,代碼來源:SyntheticWorkflowSession.java

示例8: getModel

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public final WorkflowModel getModel(final String modelId) throws WorkflowException {
    final WorkflowSession workflowSession;
    try {
        workflowSession = this.workflowService.getResourceResolver(this.session).adaptTo(WorkflowSession.class);
        return workflowSession.getModel(modelId);
    } catch (LoginException e) {
        throw new WorkflowException("Could not obtain a Granite Workflow Session");
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:11,代碼來源:SyntheticWorkflowSession.java

示例9: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    ResourceResolver resourceResolver = null;
    final List<String> assetPaths = new ArrayList<String>();

    final ReplicationActionType replicationActionType = getReplicationActionType(metaDataMap);

    try {
        resourceResolver = workflowHelper.getResourceResolver(workflowSession);

        final List<String> payloads = workflowPackageManager.getPaths(resourceResolver, (String) workItem.getWorkflowData().getPayload());

        for (final String payload : payloads) {
            // Convert the payloads to Assets, in preparation for Brand Portal publication
            // Note that this only supports Assets as payloads and NOT Asset Folders
            final Asset asset = DamUtil.resolveToAsset(resourceResolver.getResource(payload));

            if (asset == null) {
                log.debug("Payload path [ {} ] does not resolve to an asset", payload);
            } else {
                assetPaths.add(asset.getPath());
            }
        }

        // Based on the WF Process activation/deactivation directive; leverage the DamSyncService to publish the the Asset
        if (ReplicationActionType.ACTIVATE.equals(replicationActionType)) {
            damSyncService.publishResourcesToMP(assetPaths, resourceResolver);
        } else if (ReplicationActionType.DEACTIVATE.equals(replicationActionType)) {
            damSyncService.unpublishResourcesFromMP(assetPaths, resourceResolver);
        } else {
            log.warn("Unknown replication action type [ {} ] for AEM Assets Brand Portal Sync", replicationActionType);
        }
    } catch (RepositoryException e) {
        log.error("Could not find the payload", e);
        throw new WorkflowException("Could not find the payload");
    } finally {
        if (resourceResolver != null) {
            resourceResolver.close();
        }
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:41,代碼來源:BrandPortalSyncProcess.java

示例10: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    log.debug("Terminate Workflow Process");

    workflowSession.terminateWorkflow(workItem.getWorkflow());
    Assert.assertTrue(false);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:8,代碼來源:TerminateDataWorkflowProcess.java

示例11: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    // Workflow Data
    Assert.assertEquals("JCR_PATH", workItem.getWorkflowData().getPayloadType());
    Assert.assertEquals("/content/test", workItem.getWorkflowData().getPayload());

    // Workitem
    Assert.assertTrue(workItem.getId().matches("[a-z0-9]{8}-([a-z0-9]{4}-){3}[a-z0-9]{12}_.+"));
    Assert.assertEquals(null, workItem.getNode());
    Assert.assertTrue(workItem.getTimeStarted() != null);
    Assert.assertTrue(workItem.getTimeEnded() == null);
    Assert.assertTrue(workItem.getWorkflow() != null);
    Assert.assertEquals("Synthetic Workflow", workItem.getCurrentAssignee());

}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:16,代碼來源:WFDataWorkflowProcess.java

示例12: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    workItem.getWorkflowData().getMetaDataMap().put("workflowdata", "set on workflowdata");
    workItem.getWorkflow().getMetaDataMap().put("workflow", "set on workflow");
    workItem.getMetaDataMap().put("workitem", "local to work item");

    workflowSession.updateWorkflowData(workItem.getWorkflow(), workItem.getWorkflowData());

    // WorkItem map is scoped only to this WorkItem step
    String actual = workItem.getMetaDataMap().get("workitem", String.class);
    Assert.assertEquals("local to work item", actual);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:13,代碼來源:UpdateWorkflowDataWorkflowProcess.java

示例13: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    // Workflow Data
    for (final Map.Entry<String, Object> entry : expected.entrySet()) {
        Assert.assertEquals(entry.getValue(),
                metaDataMap.get(entry.getKey(), String.class));
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:9,代碼來源:WFArgsWorkflowProcess.java

示例14: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {
    workItem.getWorkflowData().getMetaDataMap().put("workflowdata", "set on workflowdata");
    workItem.getWorkflow().getMetaDataMap().put("workflow", "set on workflow");
    workItem.getMetaDataMap().put("workitem", "local to work item");

    // WorkItem map is scoped only to this WorkItem step
    String actual = workItem.getMetaDataMap().get("workitem", String.class);
    Assert.assertEquals("local to work item", actual);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:11,代碼來源:SetDataWorkflowProcess.java

示例15: execute

import com.adobe.granite.workflow.WorkflowException; //導入依賴的package包/類
@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException {

    // Test Workflow Data Map
    String actual = workItem.getWorkflowData().getMetaDataMap().get("workflowdata", String.class);
    Assert.assertEquals("set on workflowdata", actual);

    actual = workItem.getWorkflowData().getMetaDataMap().get("workflow", String.class);
    Assert.assertEquals("set on workflow", actual);

    actual = workItem.getWorkflowData().getMetaDataMap().get("workitem", String.class);
    Assert.assertNull(actual);

    // Test Workflow Map
    actual = workItem.getWorkflow().getMetaDataMap().get("workflowdata", String.class);
    Assert.assertEquals("set on workflowdata", actual);

    actual = workItem.getWorkflow().getMetaDataMap().get("workflow", String.class);
    Assert.assertEquals("set on workflow", actual);

    actual = workItem.getWorkflow().getMetaDataMap().get("workitem", String.class);
    Assert.assertNull(actual);


    // Test WorkItem
    actual = workItem.getMetaDataMap().get("workflowdata", String.class);
    Assert.assertNull(actual);

    actual = workItem.getMetaDataMap().get("workflow", String.class);
    Assert.assertNull(actual);

    actual = workItem.getMetaDataMap().get("workitem", String.class);
    Assert.assertNull(actual);
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:35,代碼來源:ReadDataWorkflowProcess.java


注:本文中的com.adobe.granite.workflow.WorkflowException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。