Java Code Examples for org.eclipse.emf.ecore.util.FeatureMap.Entry#getValue()

The following examples show how to use org.eclipse.emf.ecore.util.FeatureMap.Entry#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VerificationUtil.java    From fixflow with Apache License 2.0 6 votes vote down vote up
/**
 * 判断表单是否空
 * 
 * @param flowElement
 */
private static void verifyFormIsNull(FlowElement flowElement,StringBuffer sb) {
	if (flowElement instanceof UserTask) {
		UserTask userTask = (UserTask) flowElement;

		for (ExtensionAttributeValue extensionAttributeValue : userTask.getExtensionValues()) {
			FeatureMap extensionElements = extensionAttributeValue.getValue();

			for (Entry entry : extensionElements) {
				if (entry.getValue() instanceof FormUri) {
					FormUri formUri = (FormUri) entry.getValue();
					if (formUri.getExpression().getValue() != null || !(formUri.getExpression().getValue().equals(""))) {
						return;
					}
				}

			}
		}
		sb.append(userTask.getId() + "节点没有设置表单;" + "");
	}
}
 
Example 2
Source File: VerificationUtil.java    From fixflow with Apache License 2.0 6 votes vote down vote up
/**
 * 验证所有人工节点含有处理命令
 * 
 * @param flowElement
 */
private static void allUserTaskNodeHaveTaskCommand(FlowElement flowElement,StringBuffer sb) {
	if (flowElement instanceof UserTask) {

		for (ExtensionAttributeValue extensionAttributeValue : ((UserTask) flowElement).getExtensionValues()) {
			FeatureMap extensionElements = extensionAttributeValue.getValue();

			for (Entry entry : extensionElements) {
				if (entry.getValue() instanceof TaskCommand) {
					TaskCommand taskCommand = (TaskCommand) entry.getValue();
					if (taskCommand != null) {
						return;
					}
				}
			}
		}

		sb.append(((UserTask) flowElement).getId() + "节点没有设置处理命令;" + "");
	}
}
 
Example 3
Source File: VerificationUtil.java    From fixflow with Apache License 2.0 5 votes vote down vote up
/**
 * 验证总方法
 * 
 * @return 通过返回异常信息,""表示通过
 */
public static String verifyAll(Process process) {
	StringBuffer sb = new StringBuffer();
	List<FlowElement> flowElements = process.getFlowElements();
	// 先验证主流程信息
	verificationProc(flowElements,sb);
	isSubmitNodeHasUserCommand(flowElements,sb);
	processDefaultTitleAndDefaultForm(process,sb);
	boolean yzForm = true;
	if (process.getExtensionValues().size() > 0) {
		for (ExtensionAttributeValue extensionAttributeValue : process.getExtensionValues()) {
			FeatureMap extensionElements = extensionAttributeValue.getValue();
			for (Entry entry : extensionElements) {
				if (entry.getValue() instanceof FormUri) {
					FormUri formUri = (FormUri) entry.getValue();
					if (formUri.getExpression().getValue() == null || formUri.getExpression().getValue().equals("")) {
						yzForm = true;
					} else {
						yzForm = false;
					}
					break;
				}
			}
		}
	}
	if (yzForm) {
		verifyFormIsNull(flowElements,sb);
	}
	// 循环主流程所有节点
	for (FlowElement flowElement :process.getFlowElements()) {
		// 如果发现是子流程则进行递归
		if (flowElement instanceof SubProcess) {
			getSubProcessElement((SubProcess) flowElement, yzForm,sb);
		}
	}
	if (sb.length() > 0 && !sb.toString().equals("子流程验证信息:")) {
		return sb.toString();
	}
	return "";
}
 
Example 4
Source File: VerificationUtil.java    From fixflow with Apache License 2.0 5 votes vote down vote up
private static void processDefaultTitleAndDefaultForm(Process process,StringBuffer sb) {
	boolean formUriYZ = false;
	boolean taskSubjectYZ = false;
	if (process.getExtensionValues().size() > 0) {
		for (ExtensionAttributeValue extensionAttributeValue : process.getExtensionValues()) {
			FeatureMap extensionElements = extensionAttributeValue.getValue();
			for (Entry entry : extensionElements) {
				if (entry.getValue() instanceof FormUri) {
					FormUri formUri = (FormUri) entry.getValue();
					if (formUri.getExpression().getValue() != null && !formUri.getExpression().getValue().equals("")) {
						formUriYZ = true;
					}
				}

				if (entry.getValue() instanceof TaskSubject) {
					TaskSubject taskSubject = (TaskSubject) entry.getValue();
					if (taskSubject.getExpression().getValue() != null && !taskSubject.getExpression().getValue().equals("")) {
						taskSubjectYZ = true;
					}
				}
			}
		}
	}
	if (formUriYZ && taskSubjectYZ) {
		return;
	} else {
		if (!formUriYZ) {
			sb.append("流程定义上默认表单不能为空;" + "");
		}
		if (!taskSubjectYZ) {
			sb.append("流程定义上默认任务主题不能为空;" + "");
		}
	}
	return;
}
 
Example 5
Source File: VerificationUtil.java    From fixflow with Apache License 2.0 5 votes vote down vote up
/**
 * 判断所有人工任务节点都有任务分配
 * 
 * @param flowElements
 */
public static void allUserTaskNodeHaveTaskAssignment(List<FlowElement> flowElements,StringBuffer sb) {
	for (FlowElement flowElement : flowElements) {
		if (flowElement instanceof UserTask) {
			UserTask userTask = (UserTask) flowElement;
			if (userTask.getResources().size() < 1) {
				sb.append(userTask.getId() + "节点没有设置任务分配;" + "");
			}
			LoopCharacteristics loopCharacteristics = userTask.getLoopCharacteristics();

			if (loopCharacteristics instanceof MultiInstanceLoopCharacteristics) {

				for (ExtensionAttributeValue extensionAttributeValue : userTask.getExtensionValues()) {
					FeatureMap extensionElements = extensionAttributeValue.getValue();

					for (Entry entry : extensionElements) {
						if (entry.getValue() instanceof TaskCommand) {
							TaskCommand taskCommand = (TaskCommand) entry.getValue();
							if (taskCommand.getCommandType().equals("rollBack")) {
								sb.append(((UserTask) flowElement).getId() + " 含有多实例的节点不能做退回处理;" + "");
							}

						}
					}
				}

			}
		}
	}
}
 
Example 6
Source File: BPMNToProc.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected String getAssignmentValue(final TExpression to) {
    if (to != null) {
        final FeatureMap mixed = to.getMixed();
        if (mixed != null && !mixed.isEmpty()) {
            final Entry entry = mixed.get(0);
            if (entry != null) {
                return (String) entry.getValue();
            }
        }
    }
    return "";
}
 
Example 7
Source File: BPMNToProc.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private String retrieveDefaultValueContent(final TExpression fromExpression) {
    String defaultValueContent = "";
    final FeatureMap fromMixed = fromExpression
            .getMixed();
    if (fromMixed != null && !fromMixed.isEmpty()) {
        final Entry fromEntry = fromMixed.get(0);
        if (fromEntry != null) {
            defaultValueContent = (String) fromEntry
                    .getValue();
        }
    }
    return defaultValueContent;
}
 
Example 8
Source File: ActivityImpl.java    From fixflow with Apache License 2.0 4 votes vote down vote up
private Expression getExtensionExpression(BaseElement baseElement) {

		if (baseElement.getExtensionValues().size() > 0) {

			for (ExtensionAttributeValue extensionAttributeValue : baseElement.getExtensionValues()) {

				FeatureMap extensionElements = extensionAttributeValue.getValue();

				for (Entry entry : extensionElements) {
					if (entry.getValue() instanceof Expression) {
						Expression expression= (Expression) entry.getValue();
						return expression;

					}

				}

			}

		}
		return null;

	}
 
Example 9
Source File: BPMNToProc.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createBonitaData(final TFlowElement flowElement,
        final boolean isMultiple, final QName itemDef, final boolean isTransient)
        throws ProcBuilderException {
    final TItemDefinition itemDefinition = getItemDefinition(itemDef);
    String id = null;
    DataType dataType = null;
    if (itemDefinition != null) {
        if (itemDefinition.getId() != null) {
            id = flowElement.getId();
        } else {
            id = "data" + dataNameByItemDefinition.size();
        }
        dataType = getDataType(itemDefinition);
    } else {
        if (flowElement.getId() != null) {
            id = flowElement.getId();
        } else {
            id = "data" + dataNameByItemDefinition.size();
        }
        dataType = DataType.STRING;
    }

    final String name = createBonitaDataName(flowElement, id);
    String defaultValueContent = "";
    String defaultValueReturnType = "";
    String defaultValueInterpreter = "";
    if (flowElement instanceof TActivity) {
        for (final TDataInputAssociation dataInputAssociation : ((TActivity) flowElement).getDataInputAssociation()) {
            for (final TAssignment assignment : dataInputAssociation.getAssignment()) {
                final TExpression to = assignment.getTo();
                if (to != null) {
                    final FeatureMap toMixed = to.getMixed();
                    if (toMixed != null && !toMixed.isEmpty()) {
                        final Entry entry = toMixed.get(0);
                        if (entry != null) {
                            final String entryValue = (String) entry.getValue();// .replaceFirst(Matcher.quoteReplacement("getDataInput('"),
                            // "").replace(Matcher.quoteReplacement("\')"),
                            // "");
                            final TDataInput dataInput = getDataInputById((TActivity) flowElement, entryValue);
                            if (dataInput != null) {
                                final TProperty property = getPropertyByItemSubjectRef((TActivity) flowElement,
                                        dataInput.getItemSubjectRef());
                                if (property != null) {
                                    final TExpression fromExpression = assignment.getFrom();
                                    defaultValueContent = retrieveDefaultValueContent(fromExpression);

                                    if (fromExpression instanceof TFormalExpression) {
                                        final TFormalExpression fromFormalExpression = (TFormalExpression) fromExpression;
                                        defaultValueInterpreter = retrieveDefaultValueInterpreter(fromFormalExpression);
                                        final QName evaluatesToTypeRef = fromFormalExpression.getEvaluatesToTypeRef();
                                        if (evaluatesToTypeRef != null) {
                                            defaultValueReturnType = evaluatesToTypeRef.getLocalPart();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    if (IProcBuilder.DataType.XML.equals(dataType)) {
        builder.addXMLData(id, name, defaultValueContent,
                defaultValueReturnType, defaultValueInterpreter,
                itemDefinition.getStructureRef().getLocalPart(),
                itemDefinition.getStructureRef().getNamespaceURI(),
                isMultiple, isTransient, ExpressionConstants.XPATH_TYPE);
    } else if (IProcBuilder.DataType.JAVA.equals(dataType)) {
        builder.addJavaData(id, name, defaultValueContent,
                defaultValueReturnType, defaultValueInterpreter,
                itemDefinition.getStructureRef().getLocalPart(),
                isMultiple, isTransient, ExpressionConstants.JAVA_TYPE);
    } else {
        String defaultValueExpressionType = null;
        if ("http://groovy.codehaus.org/".equals(defaultValueInterpreter)) {
            defaultValueExpressionType = ExpressionConstants.SCRIPT_TYPE;
        } else if ("http://www.w3.org/1999/XPath".equals(defaultValueInterpreter)) {
            defaultValueExpressionType = ExpressionConstants.CONSTANT_TYPE;
        }
        builder.addData(id, name, defaultValueContent,
                defaultValueReturnType, defaultValueInterpreter,
                isMultiple, isTransient, dataType,
                defaultValueExpressionType);// TODO how to define the real
        // type of the expression??
    }
    if (itemDefinition != null) {
        dataNameByItemDefinition.put(itemDefinition.getId(), name);
    }
}