public OJSimpleStatement(String expression) { super(); this.setExpression(expression); }
public void addToStatements(String str){ if(str.length() == 0) return; OJSimpleStatement stat = new OJSimpleStatement(); stat.setExpression(str); this.addToStatements(stat); } public void addToStatements(int index,OJStatement statement){
public void addToStatements(int indexOfRemoveVertex,String expression){ if(expression.length() == 0) return; OJSimpleStatement stat = new OJSimpleStatement(); stat.setExpression(expression); this.addToStatements(indexOfRemoveVertex, stat); } public String toJavaString(){
/** Copies all attributes and associations of this instance into 'copy'. True parts, i.e. associations marked 'aggregate' or 'composite', and attributes, are copied as well. References to other objects, i.e. associations not marked 'aggregate' or 'composite', will not be copied. The 'copy' will refer to the same objects as the original (this) instance. * * @param copy */ public void copyInfoInto(OJSimpleStatement copy) { super.copyInfoInto(copy); copy.setExpression(getExpression()); }
/********************************************************************* * The operations from the model ********************************************************************/ public OJSimpleStatement getCopy() { OJSimpleStatement result = new OJSimpleStatement(); result.setExpression(this.getExpression()); return result; } public String toJavaString() {
public void copyDeepInfoInto(OJSimpleStatement copy) { super.copyDeepInfoInto(copy); copy.setExpression(this.getExpression()); }
public void renameAll(Set<OJPathName> renamePathNames, String newName) { setExpression(replaceAll(getExpression(), renamePathNames, newName)); } /*********************************************************************
public void addToStatements(String name, String str){ if(str.length() == 0) return; OJSimpleStatement stat = new OJSimpleStatement(); stat.setName(name); stat.setExpression(str); this.addToStatements(stat); }
private void addUriToObject(Model model, OJEnum ojEnum) { OJAnnotatedOperation asJson = ojEnum.findOperation("asJson"); OJSimpleStatement s = (OJSimpleStatement) asJson.getBody().findStatement("uri"); s.setExpression("sb.append(\"\\\"uri\\\": \\\"/" + model.getName() + "\\\", \")"); }
private static OJSimpleStatement getDefaultTinkerCollectionInitalisation(Property p, Classifier propertyConcreteOwner, OJPathName collectionPathName) { OJSimpleStatement ojSimpleStatement = new OJSimpleStatement(" new " + collectionPathName.getCollectionTypeName() + "(this"); ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + ", " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).fieldname() + "), " + "loaded"); if (new PropertyWrapper(p).isMemberOfAssociationClass() && !(propertyConcreteOwner instanceof AssociationClass)) { //The constructor for an UmlgPropertyAssociationClassSet takes 2 runtime properties, one to the property end and one to the fake property end to the association class ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + ", " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).getAssociationClassFakePropertyName() + "), loaded"); } ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + ")"); return ojSimpleStatement; }
private void add_getUriToObject(Class clazz, OJEnum ojEnum) { OJAnnotatedOperation getUriToObject = new OJAnnotatedOperation("getUriToObject", new OJPathName("String")); getUriToObject.setStatic(true); getUriToObject.getBody().addToStatements( "return " + "\"/" + this.workspace.getModel().getName() + "/" + UmlgClassOperations.getPathName(clazz).getLast().toLowerCase() + "s/{" + UmlgClassOperations.getPathName(clazz).getLast().toLowerCase() + "Id}\""); ojEnum.addToOperations(getUriToObject); OJAnnotatedOperation asJson = ojEnum.findOperation("asJson"); OJSimpleStatement s = (OJSimpleStatement) asJson.getBody().findStatement("uri"); s.setExpression("sb.append(\"\\\"uri\\\": \\\"\" + getUriToObject() + \"\\\", \")"); }
private void add_getUriToObject_to_ToJson(Class clazz, OJAnnotatedClass annotatedClass) { if (clazz.getGeneralizations().isEmpty()) { OJAnnotatedOperation toJson = annotatedClass.findOperation("toJson", new OJPathName("Boolean")); OJSimpleStatement s = (OJSimpleStatement) toJson.getBody().findStatement(ToFromJsonCreator.URI_FOR_RESTFULL); s.setExpression("sb.append(\"\\\"uri\\\": \" + getUri())"); OJAnnotatedOperation toJsonWithoutCompositeParent = annotatedClass.findOperation("toJsonWithoutCompositeParent", new OJPathName("Boolean")); s = (OJSimpleStatement) toJsonWithoutCompositeParent.getBody().findStatement("uri"); s.setExpression("sb.append(\"\\\"uri\\\": \" + getUri())"); } if (!clazz.isAbstract()) { OJAnnotatedOperation getUri = new OJAnnotatedOperation("getUri"); UmlgGenerationUtil.addOverrideAnnotation(getUri); getUri.setReturnType(new OJPathName("String")); getUri.setVisibility(OJVisibilityKind.PUBLIC); getUri.getBody().addToStatements("return (\"\\\"\" + " + UmlgClassOperations.propertyEnumName(clazz) + ".getUriToObject() + \"\\\"\")"); annotatedClass.addToOperations(getUri); } }
private static OJSimpleStatement getDefaultTinkerCollectionInitalisationForAssociationClass(Property p, Classifier propertyConcreteOwner, OJPathName collectionPathName, boolean withLoaded) { OJSimpleStatement ojSimpleStatement = new OJSimpleStatement(" new " + collectionPathName.getCollectionTypeName() + "(this"); if (withLoaded) { ojSimpleStatement.setExpression( ojSimpleStatement.getExpression() + ", " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).fieldname() + "), " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).getAssociationClassFakePropertyName() + "), loaded" ); } else { ojSimpleStatement.setExpression( ojSimpleStatement.getExpression() + ", " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).fieldname() + "), " + UmlgGenerationUtil.PropertyTree.getLast() + ".from(" + UmlgClassOperations.propertyEnumName(propertyConcreteOwner) + "." + new PropertyWrapper(p).getAssociationClassFakePropertyName() + ")" ); } ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + ")"); return ojSimpleStatement; }
ojSimpleStatement = new OJSimpleStatement("return new " + qualified.javaClosableIteratorTypePath().getCopy().getLast()); ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + "(graphTraversal, " + qualified.getTumlRuntimePropertyEnum() + ")"); ojClass.addToImports(qualified.javaClosableIteratorTypePath()); ifHasNext.addToThenPart(ojSimpleStatement);
ojSimpleStatement = new OJSimpleStatement(qualified.javaTypePath().getLast() + " " + qualified.getName() + "_" + qualifiedToSearchOnPW.getName() + "_" + concrete.getName() + " = new " + qualified.javaClosableIteratorTypePath().getCopy().getLast()); ojSimpleStatement.setExpression(ojSimpleStatement.getExpression() + "(graphTraversal" + qualifiedToSearchOnPW.getName() + "_" + concrete.getName() + ", " + qualified.getTumlRuntimePropertyEnum() + ")"); refinedQualifierValue.getBody().addToStatements(ojSimpleStatement);
ojSimpleStatement.setExpression("super." + ClassBuilder.INTERNAL_MARK_TO_COLLECTION_LOADED + "(umlgRuntimeProperty, loaded)"); z_addToInternalMarkCollectionLoaded.getBody().addToStatements(ojSimpleStatement); ojSimpleStatement.setExpression("runtimeProperty = " + "(" + UmlgClassOperations.propertyEnumName(clazz) + ".fromQualifiedName(umlgRuntimeProperty.getQualifiedName()))"); z_addToInternalMarkCollectionLoaded.getBody().addToStatements(ojSimpleStatement);
ojSimpleStatement.setExpression("super." + ClassBuilder.INTERNAL_ADD_TO_COLLECTION + "(umlgRuntimeProperty, umlgNode)"); z_addToInternalCollection.getBody().addToStatements(ojSimpleStatement); ojSimpleStatement.setExpression("runtimeProperty = " + "(" + UmlgClassOperations.propertyEnumName(clazz) + ".fromQualifiedName(umlgRuntimeProperty.getQualifiedName()))"); z_addToInternalCollection.getBody().addToStatements(ojSimpleStatement);
ojSimpleStatement.setExpression("super." + ClassBuilder.INTERNAL_ADD_PERSISTENT_VALUE_TO_COLLECTION + "(umlgRuntimeProperty, umlgNode)"); z_addToInternalCollection.getBody().addToStatements(ojSimpleStatement); ojSimpleStatement.setExpression("runtimeProperty = " + "(" + UmlgClassOperations.propertyEnumName(clazz) + ".fromQualifiedName(umlgRuntimeProperty.getQualifiedName()))"); z_addToInternalCollection.getBody().addToStatements(ojSimpleStatement);