Need a Java Action that logs every attribute ( name, value and type)

Hi, I am looking for a java action that logs every attribute ( name, value and type ) to the console of the entity passed. The input would be the entity. Even an example would be very helpful. Thanks,
2 answers

I would recommend to take a look at the Java code from the Audit Trail module:

The commit action from the audit trail iterates over all attributes and references, the difference is that this module creates an entity for each member. But you can easily replace that with a log activity.

For reference the code is something like:

    Collection<? extends IMendixObjectMember<?>> members = inputObject.getMembers(sudoContext).values();
    for( IMendixObjectMember<?> member : members ) {
        if( member.isVirtual() ) {
            continue;   //Possible skip calculated attributes

        if (member instanceof MendixObjectReference){
            if( !member.getName().startsWith("System.") ) {

            } //If the association starts with system it is the owner or changedby association

        else if( member instanceof MendixObjectReferenceSet) {

            String attributeName = member.getName();
            String value = getValue( member, getContext() );

//you want to have a function to format the values nicely in the log, String.valueof doesn't always give you the right info
private static String getValue( IMendixObjectMember<?> member, IContext context ) {
    Object value = member.getValue(context);

    if( value != null ) {

        if( value instanceof Date )
            return parseDate( (Date)value, context );

        else if( value instanceof String)
            return parseString( (String)value );

        return String.valueOf( value ).trim();
        return "";

If you simply need to log entities then you don't actually need a java action. You could add a before commit event handler that simply uses the logging action to post everything to the console.