当前位置: 首页>>代码示例>>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;未经允许,请勿转载。