private String getOperationType(UMLElement element, String typeId) throws ContractException { if ("List".equals(element.getName())) { String setId = JDHelper.getNewId(); this.insertSet(setId, element.getName(), CommonElementsPackage.JAVAVOID); return setId; } else { String operationType = queryType(element.getName()); if (operationType == null || "null".equals(operationType)) { operationType = typeId; } return operationType; } }
private void insertMethodOperations(UMLClass classInst, List<UMLOperation> operationArray) throws ContractException { for (UMLOperation operation : operationArray) { // Return String typeId = processID(operation.getType()); UMLElement element = (UMLElement) parser.getDataTypes().get(typeId); String operationType = getOperationType(element, typeId); this.insertOperation( operation.getId(), operation.getName(), operation.getVisibility(), operationType, classInst.getId()); // Parameters for (UMLElement parameter : operation.getParameters()) { String parameterType = getParameterType(operation, parameter); this.insertParameter( parameter.getId(), parameter.getName(), parameterType, operation.getId()); } } }
private String getParameterType(UMLOperation operation, UMLElement parameter) throws ContractException { try { String parameterType = operation.getParameterType(parameter.getId()); UMLElement pElement = (UMLElement) parser.getDataTypes().get(processID(parameterType)); if (pElement != null) { // Eh um DataType if ("List".equals(pElement.getName())) { String setId = JDHelper.getNewId(); this.insertSet(setId, pElement.getName(), CommonElementsPackage.JAVAVOID); parameterType = setId; } else { parameterType = queryType(pElement.getName()); if (parameterType != null) { return parameterType; } } } return processID(operation.getParameterType(parameter.getId())); } catch (Exception ex) { throw new ContractException("Can't recover parameter type", ex); } }