cancel
Showing results for 
Search instead for 
Did you mean: 

populating customer fields in MTT

Former Member
0 Kudos

How can this be done? I have customer fields that I need to enter data into. I have created

public class ZTripBeanImpl extends TripBeanImpl {

// additional field for ZZGUID

private String ZZGUID = "";

public void setZZGUID(String guid) {

ZZGUID = guid;

}

public String getZZGUID(){

return ZZGUID;

}

}

Now I am lost. The end result needs to be that I set the ZZGUID, like I have set the default time,

public class ZTripProcessImpl extends TripProcessImpl {

public TripModel getNewTrip(SchemaModel forSchema) throws DBException{

TripModel mTrip = super.getNewTrip(forSchema);

mTrip.setARR_TIME("00:01");

return mTrip;

}

}

however I don't know how to get to the ZZGUID as it doesn't "belong" to anything.

The tripmodel is defined using a bean, which is why I decided to create the zbean, I could then create a zmodel but what am I accessing??? the changes above are not referenced my any object that I can interact with. I could just modify the bean and add my field but that seems to defeat the object.

The documentation for this is very light and does not offer any suggestions for doing this type of thing (other than make sure the repository is right!!)

Is there a way to do this or do I have to resort to modification?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Marina,

First of all, in MTT 2.0 the representation of the DB (in this case the bean) is separated from the logical representation (the model). Thus you can add a field to the bean to save it in DB, or you can add a field to the model to do processing on it. I suggest to create a new implementation of the TripModel also.

In anyway, you always redefine an implementation of an interface. The interface is the entity you are dealing with in the code, so to access your own implementation code, you have to force a typecast. Here is how you do that:

public TripModel getNewTrip(SchemaModel forSchema) throws DBException{

<b>ZTripModelImpl  mTrip = (ZTripModelImpl) super.getNewTrip(forSchema);</b>
 
mTrip.setARR_TIME("00:01");
mTrip.setZZGUID("PATATE");

return mTrip;
}

I hope this helps!

Thank you,

Julien.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thank you again!