diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/JerseyCodeGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/JerseyCodeGenerator.java index 903c8f5..dfd8574 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/JerseyCodeGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/JerseyCodeGenerator.java @@ -103,10 +103,14 @@ param.addAnnotation(new Annotation("FormParam", "\"" + srcName + "\"")); vars.add(param); MethodDeclaration update = new MethodDeclaration("update" + srcResName, false, typeVoid, vars); - if (((StoreAttribute) rn.getAttribute()).isNeeded()) { - update.addAnnotation(new Annotation("POST")); - } else { - update.addAnnotation(new Annotation("PUT")); + for (ChannelMember cm: re.getChannelGenerator().getOutputChannelMembers()) { + if (cm.getIdentifierTemplate() == rn.getIdentifierTemplate()) { + if (cm.getStateTransition().isRightUnary()) { + update.addAnnotation(new Annotation("PUT")); + } else { + update.addAnnotation(new Annotation("POST")); + } + } } if (rn.getInEdges().size() > 1) { // For each source resource, a child resource is defined in the destination resource so that its state can be updated separately. @@ -139,10 +143,10 @@ MethodDeclaration input = new MethodDeclaration( ((Term) cm.getStateTransition().getMessageExpression()).getSymbol().getImplName(), false, typeVoid, params); - if (((StoreAttribute) rn.getAttribute()).isNeeded()) { - input.addAnnotation(new Annotation("POST")); - } else { + if (cm.getStateTransition().isRightUnary()) { input.addAnnotation(new Annotation("PUT")); + } else { + input.addAnnotation(new Annotation("POST")); } type.addMethod(input); }