本文整理了Java中org.opencastproject.workflow.api.WorkflowInstance.getCurrentOperation()
方法的一些代码示例,展示了WorkflowInstance.getCurrentOperation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowInstance.getCurrentOperation()
方法的具体详情如下:
包路径:org.opencastproject.workflow.api.WorkflowInstance
类名称:WorkflowInstance
方法名:getCurrentOperation
[英]Returns the WorkflowOperationInstance that is currently either in WorkflowState#RUNNING or WorkflowState#PAUSED.
[中]返回当前处于WorkflowState#运行或WorkflowState#暂停状态的WorkflowOperationInstance。
代码示例来源:origin: opencast/opencast
/**
* Get an optional configuration key. Values are returned trimmed.
*/
protected Opt<String> getOptConfig(WorkflowInstance wi, String key) {
return getOptConfig(wi.getCurrentOperation(), key);
}
代码示例来源:origin: opencast/opencast
/**
* Get a mandatory configuration key. Values are returned trimmed.
*
* @throws WorkflowOperationException
* if the configuration key is either missing or empty
*/
protected String getConfig(WorkflowInstance wi, String key) throws WorkflowOperationException {
return getConfig(wi.getCurrentOperation(), key);
}
代码示例来源:origin: opencast/opencast
/**
* Get a configuration key. Values are returned trimmed.
*
* @param w
* WorkflowInstance with current operation
* @param key
* Configuration key to check for
* @param defaultValue
* Value to return if key does not exists
*/
protected String getConfig(WorkflowInstance w, String key, String defaultValue) {
for (final String cfg : getOptConfig(w.getCurrentOperation(), key)) {
return cfg;
}
return defaultValue;
}
代码示例来源:origin: opencast/opencast
/**
* Get a configuration option.
*
* @deprecated use {@link #getConfig(WorkflowInstance, String)} or {@link #getOptConfig(org.opencastproject.workflow.api.WorkflowInstance, String)}
*/
protected Option<String> getCfg(WorkflowInstance wi, String key) {
return option(wi.getCurrentOperation().getConfiguration(key));
}
代码示例来源:origin: opencast/opencast
@Override
public WorkflowOperationResult start(WorkflowInstance wi, JobContext ctx) throws WorkflowOperationException {
final WorkflowOperationInstance woi = wi.getCurrentOperation();
final int code = option(woi.getConfiguration(OPT_CODE)).bind(Strings.toInt).getOrElse(1);
final Severity severity = option(woi.getConfiguration(OPT_SEVERITY)).bind(parseEnum(Severity.FAILURE)).getOrElse(Severity.INFO);
final List<Tuple<String, String>> details = Arrays.stream(ArrayUtils.nullToEmpty(
StringUtils.split(woi.getConfiguration(OPT_DETAILS), ";")))
.map((opt) -> opt.split("="))
.filter((t) -> t.length == 2)
.map((x) -> Tuple.tuple(x[0], x[1]))
.collect(Collectors.toList());
final Map<String, String> params = Arrays.stream(ArrayUtils.nullToEmpty(
StringUtils.split(woi.getConfiguration(OPT_PARAMS), ";")))
.map((opt) -> opt.split("="))
.filter((t) -> t.length == 2)
.collect(Collectors.toMap(x -> x[0], x -> x[1]));
log.info("Create nop job");
final Job job = nopService.nop();
log.info("Log a dummy incident with code %d", code);
serviceRegistry.incident().record(job, severity, code, params, details);
if (!waitForStatus(job).isSuccess()) {
throw new WorkflowOperationException("Job did not complete successfully");
} else {
return createResult(WorkflowOperationResult.Action.CONTINUE);
}
}
代码示例来源:origin: opencast/opencast
/**
* Gets a notification message with placeholders and substitute them with corresponding meta-data of workflowInstance.
* The resulting String is transformed to a Json-String
*
* @param s The notification message to transform to Json-String
* @param workflowInstance The workflowInstance which getting metadata from
* @return JSON-String containing the information of the workflowInstance
*/
private String makeJson(String s, WorkflowInstance workflowInstance) {
s = s.replace("%t", checkIfNull(workflowInstance.getTitle(), "Title"));
s = s.replace("%i", String.valueOf(workflowInstance.getId()));
s = s.replace("%s", String.valueOf(workflowInstance.getState()));
s = s.replace("%o", String.valueOf(workflowInstance.getCurrentOperation().getId()));
s = s.replace("%I", checkIfNull(workflowInstance.getMediaPackage().getIdentifier(), "Mediapackage-ID"));
s = s.replace("%T", checkIfNull(workflowInstance.getMediaPackage().getTitle(), "Mediapackage-Title"));
s = s.replace("%c", checkIfNull(workflowInstance.getMediaPackage().getContributors(), "Contributors"));
s = s.replace("%C", checkIfNull(workflowInstance.getMediaPackage().getCreators(), "Creators"));
s = s.replace("%D", checkIfNull(workflowInstance.getMediaPackage().getDate(), "Date"));
s = s.replace("%d", checkIfNull(workflowInstance.getMediaPackage().getDuration(), "Duration"));
s = s.replace("%l", checkIfNull(workflowInstance.getMediaPackage().getLanguage(), "Language"));
s = s.replace("%L", checkIfNull(workflowInstance.getMediaPackage().getLicense(), "License"));
s = s.replace("%S", checkIfNull(workflowInstance.getMediaPackage().getSeriesTitle(), "Series-Title"));
JsonObject json = new JsonObject();
json.addProperty("text", s);
return gson.toJson(json);
}
代码示例来源:origin: opencast/opencast
logger.info("Start waveform workflow operation for mediapackage {}", mediaPackage);
String sourceFlavorProperty = StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(SOURCE_FLAVOR_PROPERTY));
String sourceTagsProperty = StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(SOURCE_TAGS_PROPERTY));
if (StringUtils.isEmpty(sourceFlavorProperty) && StringUtils.isEmpty(sourceTagsProperty)) {
throw new WorkflowOperationException(
String targetFlavorProperty = StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(TARGET_FLAVOR_PROPERTY));
if (targetFlavorProperty == null) {
throw new WorkflowOperationException(String.format("Required property %s not set", TARGET_FLAVOR_PROPERTY));
String targetTagsProperty = StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(TARGET_TAGS_PROPERTY));
StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(PIXELS_PER_MINUTE_PROPERTY)),
DEFAULT_PIXELS_PER_MINUTE
);
StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(MIN_WIDTH_PROPERTY)),
DEFAULT_MIN_WIDTH
);
StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(MAX_WIDTH_PROPERTY)),
DEFAULT_MAX_WIDTH
);
StringUtils.trimToNull(workflowInstance.getCurrentOperation().getConfiguration(HEIGHT_PROPERTY)),
DEFAULT_HEIGHT
);
代码示例来源:origin: opencast/opencast
throws WorkflowOperationException {
MediaPackage mediaPackage = workflowInstance.getMediaPackage();
WorkflowOperationInstance operation = workflowInstance.getCurrentOperation();
代码示例来源:origin: opencast/opencast
workflowInstance.getCurrentOperation().getConfiguration(SOURCE_FLAVOR_PROPERTY));
String sourceTagsProperty = StringUtils.trimToNull(
workflowInstance.getCurrentOperation().getConfiguration(SOURCE_TAGS_PROPERTY));
if (StringUtils.isEmpty(sourceFlavorProperty) && StringUtils.isEmpty(sourceTagsProperty)) {
throw new WorkflowOperationException(String.format("Required property %s or %s not set",
workflowInstance.getCurrentOperation().getConfiguration(TARGET_FLAVOR_PROPERTY));
if (targetFlavorProperty == null) {
throw new WorkflowOperationException(String.format("Required property %s not set", TARGET_FLAVOR_PROPERTY));
workflowInstance.getCurrentOperation().getConfiguration(TARGET_TAGS_PROPERTY));
workflowInstance.getCurrentOperation().getConfiguration(IMAGE_SIZE_PROPERTY));
int imageSize;
if (imageSizeArg != null) {
代码示例来源:origin: opencast/opencast
public WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context)
throws WorkflowOperationException {
WorkflowOperationInstance operation = workflowInstance.getCurrentOperation();
代码示例来源:origin: opencast/opencast
throws WorkflowOperationException {
MediaPackage mediaPackage = workflowInstance.getMediaPackage();
WorkflowOperationInstance operation = workflowInstance.getCurrentOperation();
内容来源于网络,如有侵权,请联系作者删除!