Use model reflection module Audit trail create log java

0
I have a requirement to show different/readable member names in Audit Trail overview instead of technical attribute name. For this I can maintain names for all fields in Model reflection.  But am unable to retrieve the entity from Model reflection in Audit trail create log java(added model reflection packages import). I have current audit log object with me and i want to retrieve same entity from model reflection module so that i can use the readable name set for technical attribute and put this in log member name field.  Any idea how to do this?
asked
2 answers
2

Hi Sowmya,

Do a cast activity on the AuditTrailSuperClass object. This will give you the entity, hence you can deduce the entity name (module + entity). Retrieve the MxObjectType from database by completename attribute.

answered
0

Hi Team ,

By using below code we able to retrieve  ModelObjectMember on the basis of Input Object.

Issues

1. When I try to cast IMendixObject into MxObjectMember it gives us error.

2. we  are creating a New list of members of the basis of log value(True) but we are not able to add by using Add method.

Please find Code snapshot I am using for same.

Request you all  to give me some way out from this issue. 

-------------------------------------------------------------------------------

try
        {
            String a =inputObject.getType().toString();
            List<IMendixObject> mxobj1list1=  Core.retrieveXPathQueryEscaped(sudoContext,"//%s[%s='%s']","MxModelReflection.MxObjectType","CompleteName",a);
            IMendixObject mxobj = mxobj1list1.get(0);
            //List<IMendixObject> mxobj1list12= Core.retrieveXPathQueryEscaped(sudoContext,"//%s[%s=%s]","MxModelReflection.MxObjectMember","MxModelReflection.MxObjectMember_MxObjectType",String.valueOf(mxobj.getId().toLong()));
            List<IMendixObject> mxobj1list12= Core.retrieveXPathQueryEscaped(sudoContext,"//%s[%s=%s][%s='%s']","MxModelReflection.MxObjectMember","MxModelReflection.MxObjectMember_MxObjectType",String.valueOf(mxobj.getId().toLong()),"Log","True");
            //System.out.println("mxobj1list1---"+mxobj1list12);
            //System.out.println("mxobj1list1---"+mxobj1list1);     
            Collection<? extends IMendixObjectMember<?>> members2 = inputObject.getMembers(sudoContext).values()  ;
            Collection<? extends IMendixObjectMember<?>> members = inputObject.getMembers(sudoContext).values()  ;
            
            for (int i = 0; i <=mxobj1list12.size(); i++) 
                {
                    
                    MxObjectMember obj1 = (MxObjectMember) mxobj1list12.get(i);
                    obj1.getAttributeName(sudoContext);
                    
                    for (IMendixObjectMember<?> member : members) 
                    {
                    if (obj1.getAttributeName(sudoContext).toString()==member.getName().toString())
                    {
                    members2.add(member);//giving error over here


                    
                
                    }
                    }
                }

answered