当前位置: 首页>>代码示例>>Java>>正文


Java Task类代码示例

本文整理汇总了Java中org.eclipse.bpmn2.Task的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Task类属于org.eclipse.bpmn2包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTaskType

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
/**
 * Adds a constant in the TypesSection for a given Task. The subtype is
 * automatically detected.
 *
 * @param task
 *            task the constant should be generated for
 */
public void addTaskType(Task task) {

    boolean isHumanTask = false;

    if (task instanceof UserTask
            || PreferencesUtil
            .getBooleanPreference(Preferences.ALL_TASKS_AS_HUMANTASKS))
        isHumanTask = true;

    if (isHumanTask) {
        addType("humanTaskName", task.getId());
    } else {
        addType("automatedTaskName", task.getId());
    }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:AslanFileBuilder.java

示例2: canResizeShape

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
@Override
public boolean canResizeShape(IResizeShapeContext context) {
  boolean canResize = super.canResizeShape(context);

  // perform further check only if move allowed by default feature
  if (canResize == true) {
    // don't allow resize if the class name has the length of 1
    Shape shape = context.getShape();
    Object bo = getBusinessObjectForPictogramElement(shape);
    if (bo instanceof Task || bo instanceof CallActivity) {
      canResize = true;
    } else {
      canResize = false;
    }
  }
  return canResize;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:TaskResizeFeature.java

示例3: run

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
@Override
public void run() {

	for (VisualizationElement element : elements) {

		if (element.getbObject() instanceof Task) {
			highlightTask(element.getpElement(), element.getAction());
		} else if (element.getbObject() instanceof Gateway) {
			highlightGateway(element.getpElement(), element.getAction());
		} else if (element.getbObject() instanceof Event) {
			highlightEvent(element.getpElement(), element.getAction());
		} else if (element.getbObject() instanceof SeparationOfDuty
				|| element.getbObject() instanceof BindingOfDuty) {
			highlightTaskLikeElement(element.getpElement(),
					element.getAction(), false);
		}

	}

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:HighlightVisualizationElementsRunnable.java

示例4: getAccessedProcessVariableNames

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
/**
 * Finds the names of the process variables that are accessed in the
 * provided task. Only the HTML forms of a UserTask and the Java
 * implementation of a ServiceTask can be analyzed.
 *
 * @param task
 *            The task (UserTask or ServiceTask) that should be analyzed.
 * @return A List with the names of the accessed process variables as
 *         Strings.
 */
public static List<String> getAccessedProcessVariableNames(Task task) {

    List<String> result = new ArrayList<String>();

    List<ProcVarAccess> varAccesses = new ArrayList<ProcVarAccess>();

    if (task instanceof UserTask) {
        varAccesses = getAccessedProcessVariables((UserTask) task);
    } else if (task instanceof ServiceTask) {
        varAccesses = getAccessedProcessVariables((ServiceTask) task);
    }

    for (ProcVarAccess var : varAccesses) {
        final String varName = var.getName();
        if (!result.contains(varName))
            result.add(varName);
    }

    return result;

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:32,代码来源:NeedToKnowUtil.java

示例5: getMaxX

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
private int getMaxX(String id) {
  int maxX = 0;
  String sourceRef = null;
  for (SequenceFlowModel sequenceFlowModel : bpmnParser.sequenceFlowList) {
    if(sequenceFlowModel.targetRef.equals(id)) {
      if(yMap.containsKey(sequenceFlowModel.sourceRef)) {
        int sourceX = yMap.get(sequenceFlowModel.sourceRef).x;
        if(sourceX > maxX) {
          maxX = sourceX;
          sourceRef = sequenceFlowModel.sourceRef;
        }
      } else {
      	throw new FlowSourceNotFoundException();
      }
    }
  }
  if(sourceRef != null) {
    for (FlowElement flowElement : bpmnParser.bpmnList) {
      if(flowElement.getId().equals(sourceRef)) {
        if(flowElement instanceof Event) {
          maxX += EVENT_WIDTH;
        } else if(flowElement instanceof Gateway) {
          maxX += GATEWAY_WIDTH;
        } else if(flowElement instanceof Task) {
          maxX += TASK_WIDTH;
        }
      }
    }
  }
  maxX += SEQUENCEFLOW_WIDTH;
  return maxX;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:33,代码来源:BpmnFileReader.java

示例6: setTransparencyAndLineWidth

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
private void setTransparencyAndLineWidth(ContainerShape parent, Diagram diagram) {
	List<Shape> shapes = parent.getChildren();
	for (Shape shape : shapes) {
     if(shape instanceof ContainerShape) {
     	GraphicsAlgorithm graphics = ((ContainerShape) shape).getGraphicsAlgorithm();
     	graphics.setLineWidth(1);
     	graphics.setTransparency(0.0);
     	List<GraphicsAlgorithm> graphicsChildren = graphics.getGraphicsAlgorithmChildren();
     	for (GraphicsAlgorithm graphicsAlgorithm : graphicsChildren) {
         if(graphicsAlgorithm.getLineWidth() == null ||  graphicsAlgorithm.getLineWidth() <= 1) {
         	graphicsAlgorithm.setLineWidth(1);
         }
         graphicsAlgorithm.setTransparency(0.0);
       }
     	setTransparencyAndLineWidth((ContainerShape) shape, diagram);
     
     } else if(shape.getGraphicsAlgorithm() != null && shape.getGraphicsAlgorithm() instanceof Text) {
     	if(parent.getLink().getBusinessObjects() != null && parent.getLink().getBusinessObjects().size() > 0) {
     		EObject object = parent.getLink().getBusinessObjects().get(0);
     		if(object instanceof Task) {
     			Text text = (Text) shape.getGraphicsAlgorithm();
         	MultiText multiText = Graphiti.getGaService().createDefaultMultiText(diagram, shape, text.getValue());
         	multiText.setStyle(text.getStyle());
         	multiText.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
         	multiText.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
         	multiText.setFont(text.getFont());
         	multiText.setX(text.getX());
         	multiText.setY(text.getY());
         	multiText.setHeight(30);
         	multiText.setWidth(text.getWidth());
         	shape.setGraphicsAlgorithm(multiText);
     		}
     	}
     }
   }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:ActivitiDiagramEditor.java

示例7: canCreate

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
public boolean canCreate(ICreateContext context) {
  Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
   if (parentObject instanceof SubProcess == true ||
           parentObject instanceof Task == true) {
     
     return true;
   }
   return false;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:10,代码来源:CreateBoundaryTimerFeature.java

示例8: canAdd

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
@Override
public boolean canAdd(IAddContext context) {
  if (context.getNewObject() instanceof Task) {
    
    Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
    
    if (context.getTargetContainer() instanceof Diagram || parentObject instanceof SubProcess) {
      return true;
    }
  }
  return false;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:AddTaskFeature.java

示例9: setLocation

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
private void setLocation(BaseElement targetElement, CreateContext context) {
	if(context.getProperty(CONNECTION_ATTRIBUTE) != null) {
		
		CreateConnectionContext connectionContext = (CreateConnectionContext) 
			context.getProperty(CONNECTION_ATTRIBUTE);
		PictogramElement sourceElement = connectionContext.getSourcePictogramElement();
		EObject sourceObject = sourceElement.getLink().getBusinessObjects().get(0);
		if(sourceObject instanceof Event && (targetElement instanceof Task || targetElement instanceof CallActivity)) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 80, 
					sourceElement.getGraphicsAlgorithm().getY() - 10);
		
		} else if(sourceObject instanceof Event && targetElement instanceof Gateway) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 80, 
					sourceElement.getGraphicsAlgorithm().getY() - 3);
			
		} else if(sourceObject instanceof Gateway && targetElement instanceof Event) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 85, 
					sourceElement.getGraphicsAlgorithm().getY() + 3);
		
		} else if(sourceObject instanceof Gateway && (targetElement instanceof Task || targetElement instanceof CallActivity)) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 85, 
					sourceElement.getGraphicsAlgorithm().getY() - 7);
		
		} else if((sourceObject instanceof Task || sourceObject instanceof CallActivity) && targetElement instanceof Gateway) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 160, 
					sourceElement.getGraphicsAlgorithm().getY() + 7);
		
		} else if((sourceObject instanceof Task || sourceObject instanceof CallActivity) && targetElement instanceof Event) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 160, 
					sourceElement.getGraphicsAlgorithm().getY() + 10);
		
		} else if((sourceObject instanceof Task || sourceObject instanceof CallActivity) && (targetElement instanceof Task || targetElement instanceof CallActivity)) {
			context.setLocation(sourceElement.getGraphicsAlgorithm().getX() + 160, 
					sourceElement.getGraphicsAlgorithm().getY());
		}
	}
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:38,代码来源:AbstractCreateFastBPMNFeature.java

示例10: canAdd

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
@Override
public boolean canAdd(IAddContext context) {
  Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
  if (parentObject instanceof SubProcess == false && parentObject instanceof Task == false) {
    return false;
  }
  if (context.getNewObject() instanceof BoundaryEvent == false) {
    return false;
  }
  return true;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:12,代码来源:AddBoundaryTimerFeature.java

示例11: addTaskButtons

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
private void addTaskButtons(ContextButtonEntry otherElementButton, Task notTask, CustomContext customContext) {
	if(notTask == null || notTask instanceof ServiceTask == false) {
 	addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "servicetask"), customContext, 
   		"Change to service task", "Change to a service task", ActivitiImageProvider.IMG_SERVICETASK);
	}
	if(notTask == null || notTask instanceof ScriptTask == false) {
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "scripttask"), customContext, 
   		"Change to script task", "Change to a script task", ActivitiImageProvider.IMG_SCRIPTTASK);
	}
  if(notTask == null || notTask instanceof UserTask == false) {
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "usertask"), customContext, 
   		"Change to user task", "Change to a user task", ActivitiImageProvider.IMG_USERTASK);
  }
  if(notTask == null || notTask instanceof MailTask == false) {;
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "mailtask"), customContext, 
   		"Change to mail task", "Change to a mail task", ActivitiImageProvider.IMG_MAILTASK);
  }
  if(notTask == null || notTask instanceof BusinessRuleTask == false) {
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "businessruletask"), customContext, 
   		"Change to business rule task", "Change to a business rule task", ActivitiImageProvider.IMG_BUSINESSRULETASK);
  }
  if(notTask == null || notTask instanceof ManualTask == false) {
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "manualtask"), customContext, 
   		"Change to manual task", "Change to a manual task", ActivitiImageProvider.IMG_MANUALTASK);
  }
  if(notTask == null || notTask instanceof ReceiveTask == false) {
   addContextButton(otherElementButton, new ChangeElementTypeFeature(getFeatureProvider(), "receivetask"), customContext, 
   		"Change to receive task", "Change to a receive task", ActivitiImageProvider.IMG_RECEIVETASK);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:ActivitiToolBehaviorProvider.java

示例12: getResizeShapeFeature

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
@Override
public IResizeShapeFeature getResizeShapeFeature(IResizeShapeContext context) {
 Shape shape = context.getShape();
  Object bo = getBusinessObjectForPictogramElement(shape);
  if (bo instanceof SubProcess) {
  	return new SubProcessResizeFeature(this);
  } else if (bo instanceof Task || bo instanceof CallActivity) {
  	return new TaskResizeFeature(this);
  }
  return super.getResizeShapeFeature(context);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:12,代码来源:ActivitiBPMNFeatureProvider.java

示例13: getText

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String getText(Object object) {
	String label = ((Task) object).getName();
	return label == null || label.length() == 0 ? getString("_UI_Task_type")
			: getString("_UI_Task_type") + " " + label;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:TaskItemProvider.java

示例14: nodeHasPoint2StartEvent

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
/**
 * 判断连接线是否连回开始节点
 * 
 * @param flowElements
 */
public static void nodeHasPoint2StartEvent(List<FlowElement> flowElements,StringBuffer sb) {
	for (FlowElement flowElement : flowElements) {
		if (flowElement instanceof Task) {
			Task task = (Task) flowElement;
			for (SequenceFlow sequenceFlow : task.getOutgoing()) {
				if (sequenceFlow.getTargetRef() instanceof StartEvent) {
					sb.append("连接线不允许指向开始节点;");
				}
			}
		}
	}
}
 
开发者ID:fixteam,项目名称:fixflow,代码行数:18,代码来源:VerificationUtil.java

示例15: processSubDiagramInSequence

import org.eclipse.bpmn2.Task; //导入依赖的package包/类
private void processSubDiagramInSequence(FlowElement previousElement, SubProcess subProcess, 
		List<FlowElement> subFlowElementList, Map<String, GraphicInfo> subYMap, Set<BoundaryEvent> boundaryEventList) {
	
	for(SequenceFlowModel sequence : bpmnParser.sequenceFlowList) {
  	if(sequence.sourceRef != null && sequence.sourceRef.equals(previousElement.getId()) &&
  			sequence.targetRef != null && subYMap.containsKey(sequence.targetRef) == false) {
  		
  		for(FlowElement subFlowElement : subProcess.getFlowElements()) {
  			if(sequence.targetRef.equals(subFlowElement.getId())) {
  				FlowElement subSourceElement = sourceRef(subFlowElement.getId(), subYMap);
          GraphicInfo subGraphicInfo = getNextGraphicInfo(subSourceElement, subFlowElement, subYMap, boundaryEventList);
          if(subGraphicInfo.y < 0) {
            subGraphicInfo.y = 0;
          }
          
          subYMap.put(subFlowElement.getId(), subGraphicInfo);
          subFlowElementList.add(subFlowElement);
          
          processSubDiagramInSequence(subFlowElement, subProcess, subFlowElementList, subYMap, boundaryEventList);
          
          if(boundaryEventList.size() > 0 && 
	      		(subFlowElement instanceof CallActivity || subFlowElement instanceof Task)) {
	      	
	      	for (BoundaryEvent boundaryEvent : boundaryEventList) {
	      		if(boundaryEvent.getAttachedToRef() != null && boundaryEvent.getAttachedToRef().getId().equals(subFlowElement.getId())) {
	      			
	      			GraphicInfo boundaryGraphicInfo = getNextGraphicInfo(null, boundaryEvent, subYMap, boundaryEventList);
	      			subYMap.put(boundaryEvent.getId(), boundaryGraphicInfo);
	      			subFlowElementList.add(boundaryEvent);
	      			
				      processSubDiagramInSequence(boundaryEvent, subProcess, subFlowElementList, subYMap, boundaryEventList);
	      		}
            }
	      }
          
  				break;
  			}
  		}
  	}
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:42,代码来源:BpmnFileReader.java


注:本文中的org.eclipse.bpmn2.Task类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。