org.opencastproject.workflow.api.WorkflowInstance.getId()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.opencastproject.workflow.api.WorkflowInstance.getId()方法的一些代码示例,展示了WorkflowInstance.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowInstance.getId()方法的具体详情如下:
包路径:org.opencastproject.workflow.api.WorkflowInstance
类名称:WorkflowInstance
方法名:getId

WorkflowInstance.getId介绍

[英]The unique ID of this WorkflowInstance.
[中]此WorkflowInstance的唯一ID。

代码示例

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override
public boolean equals(Object obj) {
 if (obj instanceof WorkflowInstance) {
  WorkflowInstance other = (WorkflowInstance) obj;
  return id == other.getId();
 }
 return false;
}

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see org.opencastproject.workflow.api.WorkflowListener#stateChanged(org.opencastproject.workflow.api.WorkflowInstance)
 */
@Override
public void stateChanged(WorkflowInstance workflow) {
 synchronized (this) {
  if (!workflowInstanceIds.isEmpty() && !workflowInstanceIds.contains(workflow.getId()))
   return;
  WorkflowState currentState = workflow.getState();
  if (!notifyStates.isEmpty() && !notifyStates.containsKey(currentState))
   return;
  if (notifyStates.containsKey(currentState)) {
   notifyStates.get(currentState).incrementAndGet();
  }
  total.incrementAndGet();
  logger.debug("Workflow {} state updated to {}", workflow.getId(), workflow.getState());
  notifyAll();
 }
}

代码示例来源:origin: opencast/opencast

/**
 * {@inheritDoc}
 *
 * @see org.opencastproject.workflow.api.WorkflowService#update(org.opencastproject.workflow.api.WorkflowInstance)
 */
@Override
public void update(WorkflowInstance workflowInstance) throws WorkflowDatabaseException {
 HttpPost post = new HttpPost("/update");
 try {
  List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
  params.add(new BasicNameValuePair("workflow", WorkflowParser.toXml(workflowInstance)));
  post.setEntity(new UrlEncodedFormEntity(params));
 } catch (UnsupportedEncodingException e) {
  throw new IllegalStateException("Unable to assemble a remote workflow service request", e);
 } catch (Exception e) {
  throw new IllegalStateException("unable to serialize workflow instance to xml");
 }
 HttpResponse response = getResponse(post, SC_NO_CONTENT);
 try {
  if (response != null) {
   logger.info("Workflow '{}' updated", workflowInstance);
   return;
  }
 } finally {
  closeConnection(response);
 }
 throw new WorkflowDatabaseException("Unable to update workflow instance " + workflowInstance.getId());
}

代码示例来源:origin: opencast/opencast

public WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context)
    throws WorkflowOperationException {
 logger.debug("Running HTTP notification workflow operation on workflow {}", workflowInstance.getId());
 int maxRetry = DEFAULT_MAX_RETRY;
 int timeout = DEFAULT_TIMEOUT;

代码示例来源: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

String filename = String.format("workflow-%d-%d-mediapackage-%s.json", workflowInstance.getId(),
                operation.getId(), mediaPackage.getIdentifier());
saveOrLog(MediaPackageParser.getAsJSON(mediaPackage), directory, filename);
String filename = String.format("workflow-%d-%d-mediapackage-%s.xml", workflowInstance.getId(),
    operation.getId(), mediaPackage.getIdentifier());
saveOrLog(MediaPackageParser.getAsXml(mediaPackage), directory, filename);
String filename = String.format("workflow-%d-%d.xml", workflowInstance.getId(), operation.getId());
try {
 saveOrLog(WorkflowParser.toXml(workflowInstance), directory, filename);

相关文章