protected String getLockPath(
      PortletDataContext portletDataContext, String className, String key, Lock lock) {

    StringBundler sb = new StringBundler(8);

    sb.append(ExportImportPathUtil.getRootPath(portletDataContext));
    sb.append("/locks/");
    sb.append(PortalUtil.getClassNameId(className));
    sb.append(CharPool.FORWARD_SLASH);
    sb.append(key);
    sb.append(CharPool.FORWARD_SLASH);
    sb.append(lock.getLockId());
    sb.append(".xml");

    return sb.toString();
  }
  @Override
  public WorkflowTask completeWorkflowTask(
      long companyId,
      long userId,
      long workflowTaskInstanceId,
      String transitionName,
      String comment,
      Map<String, Serializable> workflowContext)
      throws WorkflowException {

    Lock lock = null;

    try {
      lock =
          LockManagerUtil.lock(
              userId,
              WorkflowTask.class.getName(),
              workflowTaskInstanceId,
              String.valueOf(userId),
              false,
              1000);
    } catch (PortalException pe) {
      if (pe instanceof DuplicateLockException) {
        throw new WorkflowException(
            "Workflow task " + workflowTaskInstanceId + " is locked by user " + userId, pe);
      }

      throw new WorkflowException("Unable to lock workflow task " + workflowTaskInstanceId, pe);
    }

    try {
      ServiceContext serviceContext = new ServiceContext();

      serviceContext.setCompanyId(companyId);
      serviceContext.setUserId(userId);

      WorkflowTask workflowTask =
          _taskManager.completeWorkflowTask(
              workflowTaskInstanceId, transitionName, comment, workflowContext, serviceContext);

      KaleoTaskInstanceToken kaleoTaskInstanceToken =
          KaleoTaskInstanceTokenLocalServiceUtil.getKaleoTaskInstanceToken(
              workflowTask.getWorkflowTaskId());

      KaleoInstanceToken kaleoInstanceToken = kaleoTaskInstanceToken.getKaleoInstanceToken();

      if (workflowContext == null) {
        workflowContext =
            WorkflowContextUtil.convert(kaleoInstanceToken.getKaleoInstance().getWorkflowContext());
      }

      workflowContext.put(WorkflowConstants.CONTEXT_TASK_COMMENTS, comment);
      workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName);

      ExecutionContext executionContext =
          new ExecutionContext(
              kaleoInstanceToken, kaleoTaskInstanceToken, workflowContext, serviceContext);

      _kaleoSignaler.signalExit(transitionName, executionContext);

      return workflowTask;
    } catch (Exception e) {
      throw new WorkflowException("Unable to complete task", e);
    } finally {
      LockManagerUtil.unlock(lock.getClassName(), lock.getKey());
    }
  }