Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 81227

Some weird changes in the Java code

$
0
0

I am workin in a model and when trying to run the model I suddenly get a java error code that a compilation failed. So I started Eclipse and this is what I found.

It complained about not finding __TokenObject in ReplaceToken.java. This is the code I found:

// This file was generated by Mendix Business Modeler 4.0.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.

package mxmodelreflection.actions;

import mxmodelreflection.TokenReplacer;
import com.mendix.systemwideinterfaces.core.IMendixObject;
import com.mendix.systemwideinterfaces.core.UserAction;

/**
 * Search the parameter text for the token fromt the parameter TokenObject, replace the value with a value from the parameter ValueObject.
 */
public class ReplaceToken extends UserAction<String>
{
    private IMendixObject __TokenObjectParameter1;
    private mxmodelreflection.proxies.Token TokenObjectParameter1;
    private IMendixObject ValueObject;
    private String Text;

    public ReplaceToken(IMendixObject TokenObjectParameter1, IMendixObject ValueObject, String Text)
    {
        super();
        this.__TokenObjectParameter1 = TokenObjectParameter1;
        this.ValueObject = ValueObject;
        this.Text = Text;
    }

    @Override
    public String executeAction() throws Exception
    {
        this.TokenObjectParameter1 = __TokenObjectParameter1 == null ? null : mxmodelreflection.proxies.Token.initialize(getContext(), __TokenObjectParameter1);

        // BEGIN USER CODE
        return TokenReplacer.replaceToken(this.getContext(), this.Text, this.__TokenObject, this.ValueObject);
        // END USER CODE
    }

    /**
     * Returns a string representation of this action
     */
    @Override
    public String toString()
    {
        return "ReplaceToken";
    }

    // BEGIN EXTRA CODE
    // END EXTRA CODE
}

Now I had a very recent branch from this same model. There the code was this:

// This file was generated by Mendix Business Modeler 4.0.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.

package mxmodelreflection.actions;

import mxmodelreflection.TokenReplacer;
import com.mendix.systemwideinterfaces.core.IMendixObject;
import com.mendix.systemwideinterfaces.core.UserAction;

/**
 * Search the parameter text for the token fromt the parameter TokenObject, replace the value with a value from the parameter ValueObject.
 */
public class ReplaceToken extends UserAction<String>
{
    private IMendixObject __TokenObject;
    private mxmodelreflection.proxies.Token TokenObject;
    private IMendixObject ValueObject;
    private String Text;

    public ReplaceToken(IMendixObject TokenObject, IMendixObject ValueObject, String Text)
    {
        super();
        this.__TokenObject = TokenObject;
        this.ValueObject = ValueObject;
        this.Text = Text;
    }

    @Override
    public String executeAction() throws Exception
    {
        this.TokenObject = __TokenObject == null ? null : mxmodelreflection.proxies.Token.initialize(getContext(), __TokenObject);

        // BEGIN USER CODE
        return TokenReplacer.replaceToken(this.getContext(), this.Text, this.__TokenObject, this.ValueObject);
        // END USER CODE
    }

    /**
     * Returns a string representation of this action
     */
    @Override
    public String toString()
    {
        return "ReplaceToken";
    }

    // BEGIN EXTRA CODE
    // END EXTRA CODE
}

Now can somebody explain to me why _TokenObject is suddenly replaced by _TokenObjectParameter1? I looked in the model and the name of the parameters in de MxModelreflection module was not changed. And why did it only change the name OUTSIDE the //BEGIN USER CODE but not inside and thus resulting in a compilation error? What is causing the trigger for the name change?

Regards,

Ronald


Viewing all articles
Browse latest Browse all 81227

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>