cancel
Showing results for 
Search instead for 
Did you mean: 

backup or clone to not loose the original

Former Member
0 Kudos

Hi!

I have the following problem:

//Assignment.

List konfig = c.getConfig_Tab();

In this section some operation

takes place.

List konfig = c.getConfig_Tab();

some lines are removed and konfig

has less values than before, this OK

But how can I save or backup the privous version

(before Operation)

regards

sas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I have within wdDoModify methode of my view one List variable. This List variable

contains some cofiguration data. All what I need is to clone (deep) this List

or make a copy which is not being modificated whether the original has been

changed. I have tried a lot of operations but I haven't had any success.

Please notice this List variable is (java.util.List)

regards

sas

Former Member
0 Kudos

Hi,

Can you post the code in wdDoModify().

In the wdDoModify() are you taking the copy inside

if(first){

}

or outside it?

I think the problem with your case is that wdDoModify() is getting called again and the backuplist is getting reassigned to the currently modified list.

Kindly tell me in which method you are modifying the List.

Regards,

Sudhir

Former Member
0 Kudos

Hi,

Create a context attribute of type List

store your list for later use

Ex:



List konfig = c.getConfig_Tab();
	  wdContext.currentContextElement().setListStore(konfig);
	  
	  //for later access use
	  List konfig = wdContext.currentContextElement().getListStore();

Regards

Ayyapparaj

Answers (14)

Answers (14)

Former Member
0 Kudos

Hello, I regret to say my problem isn't solved yet.

There is no hope to fix this problem.

People are able to make Mars Pathfinder Missions

they are able to bridge across a river, they are buildin computer etc. but not able to

backup a simple List variable.

I'm very confused.

Regards

sas

Former Member
0 Kudos

hi,

when I implement any variable or object inside I get in the below

section errors as "xxx can not be resolved". Maybe this variables

are not visible for others.

Regards

sas

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

Looks like a problem with your variable scope. Check out [this|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/variables.html] link.

Cheers-

Atul

Former Member
0 Kudos

Hi,

Is your problem solved.Otherwise i will look at it again.

Regards,

Sudhir

Former Member
0 Kudos

Hi,

I have already tried the option 3. But I dont know exactly if I did it correctly.

I haven't had success.

Pls can check if it was made correctly. I did it as follows:

I have created a context attribute of type List

stored the list for later use

//First

List konfig = battlebellConfig.getRes_Config_Tab();

wdContext.currentContextElement().setListStore(konfig);

//for later access use

List konfig = wdContext.currentContextElement().getListStore();

Thanks

sas

I didn' create elements ?

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

Again, this depends on your requirements. Do you want the backup to be present throughout the session?

I would not update the context in the wdDoModifyView() method. This hook method is only to dynamically create/modify UI elements. Instead it would be a better idea to create a backup once in the wdDoInit() method of your controller. To ensure that this copy is made only once and not overwritten on every round trip you could check for the size of the backup node and initialize it only if it's empty.


if(wdContext.currentContextElement().getBackup() == null || wdContext.currentContextElement().getBackup().isEmpty())
{
	// initialise the backup
}

Cheers-

Atul

Edited by: Atul Savur on Feb 21, 2008 12:58 PM

Former Member
0 Kudos

After not being successful I have removed this section.

But I can insert these lines once more.

Where should I place it?

I mean inside wdDoModify or else where?

bye

sas

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

I do not know your requirements so it's hard to say.

Also, the backup collection will always be re-initialized on every roundtrip. If you are expecting a backup to have a state, i.e to be present throughout the session then you have the following options:

1. Use a Stateful Session Bean

2. Persist the list in a database

3. Keep a copy in your controller context. Copy the config list to a back up node (create new elements). Before you copy check if the backup node is already populated so that you do not over write the contents.

I would choose option (3).

Cheers-

Atul

Former Member
0 Kudos

Sudhir Gorantla I'm still waiting for yout reply. You told me to post the code.

I have posted it.

bye

sas

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

I went through your code and noticed that although you have initialized your original list


List config = battlebellConfig.getRes_Config_Tab();

you have not made a backup


List backup = new ArrayList();
backup.addAll(config);

also remember that the above lines of code difer from


List config = battlebellConfig.getRes_Config_Tab();
List backup = battlebellConfig.getRes_Config_Tab();

as you have used in your last post. Over here both lists point to the same reference - you change one the other will also change. What you need is a copy/new reference.

Cheers-

Atul

Former Member
0 Kudos

I have followed your hints:

This is the result. It didn' t help too. The

size remains not 1689 . It changes to 1669.

List config = battlebellConfig.getRes_Config_Tab();

List backup = wdContext.currentContextElement().getListStore();

//before

"backup.size()"= 1689

"config.size()"= 1689

after Operation

//later

"backup.size()"= 1669

"config.size()"= 1669

If this provides true

str.equals("ZME_CHAR_10")

then

battlebellConfig.getRes_Config_Tab()

is modificated and both variables

config

konfig

have the current values and the values also don't remain the same

I have to place it to onother section

inside wdDoModifyView .....

List config = battlebellConfig.getRes_Config_Tab();

List konfig = battlebellConfig.getRes_Config_Tab();

wdContext.currentContextElement().setListStore(konfig);

List backup = wdContext.currentContextElement().getListStore();

if(afp.getAccident_Category().equals("THED"))

{

int chaConfTabSize = config.size();

for (int k = 0; k < chaConfTabSize; k++)

{

__Hdub__Is_Charactconfig fname = (__Hdub__Is_Charactconfig) config.get(k);

String str = fname.getFieldname();

if (str.equals("ZME_CHAR_10"))

{

config.remove(fname);

chaConfTabSize = chaConfTabSize - 1;

}

}

for (int k = 0; k < chaConfTabSize; k++)

{

__Hdub__Is_Charactconfig fname = (__Hdub__Is_Charactconfig) config.get(k);

String str = fname.getFieldname();

if (str.equals("ZME_CHAR_30_RA"))

{

config.remove(fname);

chaConfTabSize = chaConfTabSize - 1;

}

}

}

appl.createCharactConfigMapByGroupNames(

config,

afp.getAccident_Category(),

ialHeader.getStatus());

Former Member
0 Kudos

Hello Ayyapparay,

where must this code be placed ?

In the wdDoModify() inside

if(first){

}

or outside it?

regards

sas

Former Member
0 Kudos

Hi,

add the code where you first access c.getConfig_Tab();

Regards

Ayyapparaj

Former Member
0 Kudos

Hello Sudhir,

my problem isn' t still solved. Did you have any success

Regards

sas

Former Member
0 Kudos

Hello!

All what I intend to do is to clone config.

Plesase see:

List config = battlebellConfig.getRes_Config_Tab();

Because after call of "battlebellConfig.getRes_Config_Tab()"

config has 2000 entries

And later after the line

if(afp.getAccident_Category().equals("THED"))

the content of config will be changed

It has now only 1700 entries

and I need also the original config before this operation.

// Here is the code

public class SelectedPersonView

{

/**

  • Logging location.

*/

private static final com.sap.tc.logging.Location logger =

com.sap.tc.logging.Location.getLocation(SelectedPersonView.class);

static

{

//@@begin id

String id = "$Id$";

//@@end

com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);

}

/**

  • Private access to the generated Web Dynpro counterpart

  • for this controller class. </p>

*

  • Use <code>wdThis</code> to gain typed access to the context,

  • to trigger navigation via outbound plugs, to get and enable/disable

  • actions, fire declared events, and access used controllers and/or

  • component usages.

*

  • @see

*/

private final IPrivateSelectedPersonView wdThis;

/**

  • Root node of this controller's context. </p>

*

  • Provides typed access not only to the elements of the root node

  • but also to all nodes in the context (methods nodeXYZ())

  • and their currently selected element (methods currentXYZElement()).

  • It also facilitates the creation of new elements for all nodes

  • (methods createXYZElement()). </p>

*

  • @see de.personmainwdp.IPrivateSelectedPersonView.IContextNode for more details.

*/

private final IPrivateSelectedPersonView.IContextNode wdContext;

/**

  • A shortcut for <code>wdThis.wdGetAPI()</code>. </p>

  • Represents the generic API of the generic Web Dynpro counterpart

  • for this controller. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDViewController wdControllerAPI;

/**

  • A shortcut for <code>wdThis.wdGetAPI().getComponent()</code>. </p>

  • Represents the generic API of the Web Dynpro component this controller

  • belongs to. Can be used to access the message manager, the window manager,

  • to add/remove event handlers and so on. </p>

*/

private final com.sap.tc.webdynpro.progmodel.api.IWDComponent wdComponentAPI;

public SelectedPersonView(IPrivateSelectedPersonView wdThis)

{

this.wdThis = wdThis;

this.wdContext = wdThis.wdGetContext();

this.wdControllerAPI = wdThis.wdGetAPI();

this.wdComponentAPI = wdThis.wdGetAPI().getComponent();

}

//@@begin javadoc:wdDoInit()

/** Hook method called to initialize controller. */

//@@end

public void wdDoInit()

{

//@@begin wdDoInit()

// subscribe portal navigation event for affected person

WDPortalEventing.subscribe( "urn:de.ittechnic.navigation",

"NavigationSelected",

wdThis.wdGetNavigateAction() );

// reference model to used components

wdThis.wdGetIncidentMainController().referenceModelComponent("AFP");

// get interfaces

//mHeaderIF = wdThis.wdGetAccidentHeadInterface();

//mEnlistsIF = wdThis.wdGetEnlistsPersonInterface();

//mActionIF = wdThis.wdGetCorrectiveActionsInterface();

//mDocumentIF = wdThis.wdGetDocumentsInterface();

//mAffectedIF = wdThis.wdGetAffectedPersonInterface();

//mInjuryIF = wdThis.wdGetInjuriesInterface();

//mModelIF = wdThis.wdGetAccidentModelInterface();

// init Message Manager

mMsgMgr = wdComponentAPI.getMessageManager();

// wdContext.currentContextElement().setbattlebellappl(new battlebellAppl());

wdContext.currentContextElement().setAffected(mAffected);

wdContext.currentContextElement().setRecreate(true);

wdContext.currentContextElement().setFromNavigation(true);

wdContext.currentContextElement().setEstCat("");

wdContext.currentContextElement().setCanceledAffPers(false);

wdContext.currentContextElement().setNewAccCat(null);

//@@end

}

//@@begin javadoc:wdDoExit()

/** Hook method called to clean up controller. */

//@@end

public void wdDoExit()

{

//@@begin wdDoExit()

//@@end

}

//@@begin javadoc:wdDoModifyView

/**

  • Hook method called to modify a view just before rendering.

  • This method conceptually belongs to the view itself, not to the

  • controller (cf. MVC pattern).

  • It is made static to discourage a way of programming that

  • routinely stores references to UI elements in instance fields

  • for access by the view controller's event handlers, and so on.

  • The Web Dynpro programming model recommends that UI elements can

  • only be accessed by code executed within the call to this hook method.

*

  • @param wdThis Generated private interface of the view's controller, as

  • provided by Web Dynpro. Provides access to the view controller's

  • outgoing controller usages, etc.

  • @param wdContext Generated interface of the view's context, as provided

  • by Web Dynpro. Provides access to the view's data.

  • @param view The view's generic API, as provided by Web Dynpro.

  • Provides access to UI elements.

  • @param firstTime Indicates whether the hook is called for the first time

  • during the lifetime of the view.

*/

//@@end

public static void wdDoModifyView(IPrivateSelectedPersonView wdThis, IPrivateSelectedPersonView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime){

// create instance for user defined fields

wdContext.currentContextElement().setbattlebellappl(

new battlebellAppl(view,

(IWDTransparentContainer) view.getElement("TransparentContainer"),

wdContext,

wdContext.nodeDynamicNode(),

wdThis.wdGetAccidentModelInterface().getConfigReadData()

));

}

if (wdContext.currentContextElement().getSkipWdDoModify()) {

wdContext.currentContextElement().setSkipWdDoModify(false);

return;

}

int invpersonLead =

wdThis.wdGetEnlistsPersonInterface().getLeadSelection();

__Hdub__Is_Rfc_Ip ip =

wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

__Hdub__Is_Rfc_Ipeva afp =

wdThis.wdGetAffectedPersonInterface().getCurrentAffected();

__Hdub__Is_Rfc_Ipevinj inj =

wdThis.wdGetInjuriesInterface().getCurrentInjury();

// create each value assignment of corresponding accident category

boolean battlebellValCreated = false;

boolean needUpdatebattlebell = true;

if (!IIMConstants.ACTYPE_DISPLAY

.equalsIgnoreCase(wdContext.currentContextElement().getActype())

&& (wdContext.currentContextElement().getEnterAffectedView()

wdContext.currentContextElement().getCanceledAffPers())) {

wdThis.updateValuesOfJavaBuffer();

}

/*

  • BEGIN block

  • this block was inside following IF statement. Since old Accident data

  • might have not been created correct and some valuations might still be missing

  • we need to check creation every time.

*/

//if actype not display, create value assignments

if (!IIMConstants.ACTYPE_DISPLAY.equalsIgnoreCase(wdContext.currentContextElement().getActype())) {

wdThis.updateAffected();

battlebellValCreated = wdThis.wdGetAccidentModelInterface().createbattlebellValueAssignments(

IIMConstants.REF_OBJ_TYPE_AFP,

//wdContext.currentContextElement().getNewAccCat()

afp.getAccident_Category(),

wdThis.wdGetAffectedPersonInterface()

.getCurrentAffected()

.getRecord_No());

}

/*

  • END block

*/

if (!StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getNewAccCat())

battlebellValCreated)

{

wdContext.currentContextElement().setNewAccCat(null);

needUpdatebattlebell = false;

//wdContext.currentContextElement().setUpdatebattlebellsNeccessary(false);

// if (battlebellValCreated) {

wdThis.wdGetAccidentModelInterface().readAccident(

wdThis.wdGetAccidentModelInterface().getCurrentHeader().getAccident(),

wdThis

.wdGetAccidentMainController()

.wdGetContext()

.currentContextElement()

.getActype(),

wdThis.wdGetAccidentModelInterface().getTHEKeyDate());

invpersonLead = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonIndex(ip.getRecord_No());

wdThis.readAffected(invpersonLead);

wdThis.wdGetAffectedPersonInterface().setCurrentAffected(afp);

wdThis.wdGetInjuriesInterface().setCurrentInjury(inj);

//clear Buffer of old Customizing Classes when Classes have been changed

wdContext.currentContextElement().getbattlebellappl().mFieldsByEstCatMap.clear();

//configuration was just cleared, recreate!

wdContext.currentContextElement().setRecreate(true);

wdThis.updateValuesOfJavaBuffer();

}

if ((!wdContext.currentContextElement().getEnterAffectedView() ) //update battlebells is not neccassary if afp view is entered the first time

&& IIMConstants.ACTYPE_EDIT.equalsIgnoreCase(wdContext.currentContextElement().getActype())

&& !wdContext.currentContextElement().getCanceledAffPers() //if not canceled

&& wdContext.currentContextElement().getUpdatebattlebellsNeccessary()

&& needUpdatebattlebell == true ){

wdThis.updatebattlebells();

}

wdContext.currentContextElement().setEnterAffectedView(false);

battlebellAppl appl = wdContext.currentContextElement().getbattlebellappl();

IExternalAffectedPersonInterface affectedIF = wdThis.wdGetAffectedPersonInterface();

afp = affectedIF.getCurrentAffected();

if(wdContext.currentContextElement().getRecreate()){

//read field settings

__Hdub__Is_Rfc_Ialh ialHeader = wdThis.wdGetAccidentModelInterface().getCurrentHeader();

__Hdub__I_Rf01_Config_Read_Output battlebellConfig = wdThis.wdGetAccidentModelInterface().getConfigReadData();

//End of read field settings

List config = battlebellConfig.getRes_Config_Tab();

if(afp.getAccident_Category().equals("THED"))

{

int chaConfTabSize = config.size();

for (int k = 0; k < chaConfTabSize; k++)

{

__Hdub__Is_Charactconfig fname = (__Hdub__Is_Charactconfig) config.get(k);

String str = fname.getFieldname();

if (str.equals("ZME_CHAR_10"))

{

config.remove(fname);

chaConfTabSize = chaConfTabSize - 1;

}

}

for (int k = 0; k < chaConfTabSize; k++)

{

__Hdub__Is_Charactconfig fname = (__Hdub__Is_Charactconfig) config.get(k);

String str = fname.getFieldname();

if (str.equals("ZME_CHAR_30_RA"))

{

config.remove(fname);

chaConfTabSize = chaConfTabSize - 1;

}

}

}

appl.createCharactConfigMapByGroupNames(

config,

afp.getAccident_Category(),

ialHeader.getStatus());

//Call battlebell Tool

if(battlebellConfig != null

&& battlebellConfig.getRes_Config_Tab().size() > 0

&& wdContext.currentContextElement().getbattlebellappl().checkValidityOfbattlebells(wdContext)){

wdContext.getChildNode("DynamicNode", 0).invalidate();

appl.createbattlebells( affectedIF.getCurrentAffected().getAccident_Category(),

IIMConstants.REF_OBJ_TYPE_AFP,

afp.getRecord_No(),

ialHeader.getRecord_No(),

wdContext,

ialHeader,

wdThis.getIhvalsBuffer(),

wdThis.getIhpropsBuffer(),

null, null,

wdThis.getIhpropLtxtBuffer()

);

wdContext.currentContextElement().setDisplayedTrays(appl.mEstCatTabList);

}

}

//expand tray: get EstCat List from somewhere

if ( wdContext.currentContextElement().getFromNavigation()) {

resetExpanded(wdContext.currentContextElement().getDisplayedTrays(), wdContext, view);

setExpanded(wdContext.currentContextElement().getEstCat(), wdContext, view);

wdContext.currentContextElement().setFromNavigation(false);

}

wdContext.currentContextElement().setRecreate(true);

wdContext.currentContextElement().setCanceledAffPers(false);

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(true);

//@@end

}

//@@begin javadoc:resetExpanded()

/** Declared method. */

//@@end

public void resetExpanded( )

{

//@@begin resetExpanded()

wdThis.wdGetAffectedPersonInterface().expandTray(false);

wdThis.wdGetInjuriesInterface().expandTray(false);

//@@end

}

//@@begin javadoc:setExpanded()

/** Declared method. */

//@@end

public void setExpanded( java.lang.String dataObject )

{

//@@begin setExpanded()

if (dataObject.equalsIgnoreCase(IIMConstants.NAV_AFP))

{

// open affected tray

wdThis.wdGetAffectedPersonInterface().expandTray(true);

}

else if (dataObject.equalsIgnoreCase(IIMConstants.NAV_INJ))

{

// open injury tray

wdThis.wdGetInjuriesInterface().expandTray(true);

}

//@@end

}

//@@begin javadoc:isAffectedChanged()

/** Declared method. */

//@@end

public boolean isAffectedChanged( )

{

//@@begin isAffectedChanged()

boolean ret = true;

if ( wdThis.wdGetAffectedPersonInterface().isFormChanged()

wdThis.wdGetInjuriesInterface().isFormChanged() ||

mChanged ) {

ret = true;

} else {

ret = false;

}

return ret;

//@@end

}

//@@begin javadoc:setAffectedNavigation()

/** Declared method. */

//@@end

public void setAffectedNavigation( )

{

//@@begin setAffectedNavigation()

WDPortalEventing.fire( "urn:de.ittechnic.com.z.sims.im.navigation",

"ShowAffectedNavigation",

mAffected.getAccident_Category());

//@@end

}

//@@begin javadoc:setView()

/** Declared method. */

//@@end

public void setView( java.lang.String actype )

{

//@@begin setView()

// set button enabling of affected view

if (actype.equals(IIMConstants.ACTYPE_EDIT)){

wdContext.currentEnablingElement().setMenuEdit(true);

//Multivalue Button battlebell

wdContext.currentVisibilityElement().setButtonEnabled(true);

wdContext.currentVisibilityElement().setReadOnly(false);

} else {

wdContext.currentEnablingElement().setMenuEdit(false);

//Multivalue Button battlebell

wdContext.currentVisibilityElement().setButtonEnabled(true);

wdContext.currentVisibilityElement().setReadOnly(true);

}

//@@end

}

//@@begin javadoc:callConfirmDialog()

/** Declared method. */

//@@end

public void callConfirmDialog( java.lang.String eventHandlerYes, java.lang.String eventHandlerNo, java.lang.String pBtnTxtYes, java.lang.String pBtnTxtNo, java.lang.String title, java.lang.String txt )

{

//@@begin callConfirmDialog()

// call confirmation dialog

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

IWDConfirmationDialog dialog = wdComponentAPI.getWindowManager().createConfirmationWindow(

wdComponentAPI.getTextAccessor().getText(txt),

controllerInfo.findInEventHandlers(eventHandlerYes),

pBtnTxtYes);

dialog.setTitle(title);

dialog.setIcon("~sapicons/s_n_ques.gif");

dialog.addChoice(controllerInfo.findInEventHandlers(eventHandlerNo), pBtnTxtNo);

dialog.show();

//@@end

}

//@@begin javadoc:saveAccident()

/** Declared method. */

//@@end

public boolean saveAccident( boolean msg )

{

//@@begin saveAccident()

boolean ret = true;

boolean ialSaved = true;

__Hdub__Is_Rfc_Ip ip = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

__Hdub__Is_Rfc_Ipeva afp = wdThis.wdGetAffectedPersonInterface().getCurrentAffected();

__Hdub__Is_Rfc_Ipevinj inj = wdThis.wdGetInjuriesInterface().getCurrentInjury();

if ( (mActype.equals(IIMConstants.ACTYPE_EDIT)) ||

(mActype.equals(IIMConstants.ACTYPE_DISPLAY)

&& wdThis.wdGetAccidentMainController()

.wdGetContext()

.currentContextElement()

.getEditActions() == true ) ){

// save Accident data

ialSaved = wdThis.wdGetAccidentModelInterface().saveAccident();

if (ialSaved){

if (msg){

// call success message

mMsgMgr.reportSuccess(wdComponentAPI.getTextAccessor().getText("MSG_Accident_SAVED"));

}

// reset change flags

wdThis.resetAccidentChanged();

// re-read data of Accident and selected affected person

readAccident();

wdThis.wdGetAccidentMainController().initViews(mActype,IIMConstants.REF_OBJ_TYPE_IAL);

int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonIndex(ip.getRecord_No());

readAffected(invpersonLead);

wdThis.wdGetAffectedPersonInterface().setCurrentAffected(afp);

wdThis.wdGetInjuriesInterface().setCurrentInjury(inj);

TDModelCopyService.copy(wdThis.wdGetAffectedPersonInterface().getCurrentAffected(),mAffected);

TDModelCopyService.copy(wdThis.wdGetInjuriesInterface().getCurrentInjury(),mInjury);

wdThis.updateValuesOfJavaBuffer();

ret = true;

} else ret = false;

}

return ret;

//@@end

}

//@@begin javadoc:resetAccidentChanged()

/** Declared method. */

//@@end

public void resetAccidentChanged( )

{

//@@begin resetAccidentChanged()

wdThis.wdGetAccidentHeadInterface().resetChanged();

wdThis.wdGetEnlistsPersonInterface().resetChanged();

//wdThis.wdGetCorrectiveActionsInterface().resetChanged();

wdThis.wdGetDocumentsInterface().resetChanged();

//@@end

}

//@@begin javadoc:isAccidentFormChanged()

/** Declared method. */

//@@end

public boolean isAccidentFormChanged( )

{

//@@begin isAccidentFormChanged()

boolean ret = true;

if ( wdThis.wdGetEnlistsPersonInterface().isFormChanged() ||

//wdThis.wdGetCorrectiveActionsInterface().isFormChanged() ||

wdThis.wdGetDocumentsInterface().isFormChanged() )

{

ret = true;

}

else ret = false;

return ret;

//@@end

}

//@@begin javadoc:checkInput()

/** Declared method. */

//@@end

public boolean checkInput( )

{

//@@begin checkInput()

boolean ret = true;

__Hdub__Is_Rfc_Ipeva affected = wdThis.wdGetAffectedPersonInterface().getCurrentAffected();

__Hdub__Is_Rfc_Ipevinj injury = wdThis.wdGetInjuriesInterface().getCurrentInjury();

hlpDebug(mCache);

try

{

if (wdThis.wdGetInjuriesInterface().isFormChanged()){

// check data

if ( null == affected.getAccident_Category() ||

null == injury.getInj_Illn()){

mMsgMgr.reportException(wdComponentAPI.getTextAccessor().getText("MSG_REQUIRED_FIELDS"),false);

ret = false;

}

}

else if (wdThis.wdGetAffectedPersonInterface().isFormChanged())

{

// check data of affected

if ( ( null != affected.getAcc_Notification_No() &&

affected.getAcc_Notification_No().equals("") ) ||

( affected.getFlag_Fatality() == false ) ||

( null != affected.getDeath_Date() &&

affected.getDeath_Date().toString().equals("")) ||

( affected.getFlag_Reportable() == false )

)

{

if (null == affected.getAccident_Category() ||

affected.getAccident_Category().equals(""))

{

mMsgMgr.reportException(wdComponentAPI.getTextAccessor().getText("MSG_REQUIRED_FIELDS"),false);

ret = false;

}

}

if (affected.getFlag_Fatality() &&

null == affected.getDeath_Date())

{

mMsgMgr.reportMessage(IMessageAccidentMain.WARNING__NO__DATE__OF__DEATH, null, false);

}

if (!affected.getFlag_Fatality() &&

null != affected.getDeath_Date())

{

affected.setFlag_Fatality(true);

wdThis.wdGetAffectedPersonInterface().setCurrentAffected(affected);

}

}

}

catch (NullPointerException e)

{

mMsgMgr.reportException(e.getMessage(), false);

ret = false;

}

hlpDebug(mCache);

return ret;

//@@end

}

//@@begin javadoc:updateHeader()

/** Declared method. */

//@@end

public boolean updateHeader( )

{

//@@begin updateHeader()

boolean ret = true;

boolean headUpdated = true;

wdThis.wdGetAccidentHeadInterface().setHeaderChanges();

headUpdated = wdThis.wdGetAccidentModelInterface().changeHeader(wdThis.wdGetAccidentHeadInterface().getCurrentAccident());

if (!headUpdated)

{

// re-read data of Accident (not supported by model DC)

wdThis.wdGetAccidentModelInterface().readAccident( mIalid,

mActype,

wdThis.wdGetAccidentModelInterface().getTHEKeyDate());

wdThis.updateValuesOfJavaBuffer();

ret = false;

}

return ret;

//@@end

}

//@@begin javadoc:updateAffected()

/** Declared method. */

//@@end

public boolean updateAffected( )

{

//@@begin updateAffected()

boolean ret = true;

if (checkInput()) {

//int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getLeadSelection();

__Hdub__Is_Rfc_Ip ip = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

boolean afpChanged = false;

boolean afpCreated = true;

boolean updateAffected = wdThis.wdGetAffectedPersonInterface().isFormChanged();

boolean updateInjury = wdThis.wdGetInjuriesInterface().isFormChanged();

if (IIMConstants.LINEMODE_I.equalsIgnoreCase(mAffected.getLinemode())) {

afpCreated = createAffected();

}

if(afpCreated) {

afpChanged = wdThis.wdGetAccidentModelInterface().updateAffectedAndInjury(updateAffected,

updateInjury);

if (!afpChanged) {

ret = false;

}

int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonIndex(ip.getRecord_No());

wdThis.wdGetEnlistsPersonInterface().setLeadSelection(invpersonLead);

wdThis.readAffected(invpersonLead);

TDModelCopyService.copy(wdThis.wdGetAffectedPersonInterface().getCurrentAffected(),mAffected);

TDModelCopyService.copy(wdThis.wdGetInjuriesInterface().getCurrentInjury(),mInjury);

}

} else {

ret = false;

}

return ret;

//@@end

}

//@@begin javadoc:setNoNavigation()

/** Declared method. */

//@@end

public void setNoNavigation( )

{

//@@begin setNoNavigation()

WDPortalEventing.fire( "urn:de.ittechnic.com.im.navigation",

"ShowNoNavigation",

"");

//@@end

}

//@@begin javadoc:readAffected()

/** Declared method. */

//@@end

public void readAffected( int pLeadSel )

{

//@@begin readAffected()

// set lead selection and get data of lead selection

wdThis.wdGetEnlistsPersonInterface().setLeadSelection(pLeadSel);

wdThis.wdGetAccidentModelInterface().selchangeInvperson();

wdThis.wdGetAccidentModelInterface().readAffectedPerson(wdThis.wdGetEnlistsPersonInterface().getCurrentEnlists().getRecord_No());

//@@end

}

//@@begin javadoc:readAccident()

/** Declared method. */

//@@end

public void readAccident( )

{

//@@begin readAccident()

wdThis.wdGetAccidentModelInterface().readAccident( mIalid,

mActype,

wdThis.wdGetAccidentModelInterface().getTHEKeyDate());

//@@end

}

//@@begin javadoc:updatebattlebells()

/** Declared method. */

//@@end

public boolean updatebattlebells( )

{

//@@begin updatebattlebells()

// Check n Write für battlebellData

if (IIMConstants.ACTYPE_DISPLAY.equalsIgnoreCase(wdContext.currentContextElement().getActype())) {

return true;

}

List errorList = new ArrayList();

boolean ret = true;

HashMap estcatMap = wdContext.currentContextElement().getbattlebellappl().mFieldsByEstCatMap;

__Hdub__Is_Ihprop_Ltxt.__Hdub__Is_Ihprop_Ltxt_List ltList = new __Hdub__Is_Ihprop_Ltxt.__Hdub__Is_Ihprop_Ltxt_List();

if (estcatMap != null && estcatMap.size() > 0) {

Iterator iterator = estcatMap.entrySet().iterator();

while (iterator.hasNext()) {

Map.Entry entry = (Map.Entry) iterator.next();

String key = (String) entry.getKey();

List confList = (List) entry.getValue();

wdContext.currentContextElement().getbattlebellappl().prepareSavebattlebellValueForGroup(

wdContext.nodeDynamicNode(),

wdThis.wdGetAccidentModelInterface().getCurrentHeader(),

mIpvaBuffer,

mIppropsBuffer,

confList,

Constants.REF_OBJ_TYPE_AFP,

mAffected.getRecord_No(), errorList,

mIppropLtxtBufferMap,

ltList);

}

if (isbattlebellDataChanged(mIpvaBuffer, mIppropsBuffer, mIppropLtxtBufferMap)) {

mChanged = true;

}

// write battlebell data changes of Accident to buffer

ret = wdThis.wdGetAccidentModelInterface().changebattlebellProperties(

IIMConstants.REF_OBJ_TYPE_AFP,

mIpvaBuffer,

mIppropsBuffer,

ltList);

}

return ret;

//end Check n write for battlebelldata

//@@end

}

//@@begin javadoc:createValueAssignments()

/** Declared method. */

//@@end

public boolean createValueAssignments( )

{

//@@begin createValueAssignments()

int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getLeadSelection();

__Hdub__Is_Rfc_Ipeva afp = wdThis.wdGetAffectedPersonInterface().getCurrentAffected();

__Hdub__Is_Rfc_Ipevinj inj = wdThis.wdGetInjuriesInterface().getCurrentInjury();

// create each value assignment of corresponding accident category

boolean ret = wdThis.wdGetAccidentModelInterface().createbattlebellValueAssignments(

IIMConstants.REF_OBJ_TYPE_AFP,

wdThis.wdGetAffectedPersonInterface().getCurrentAffected().getAccident_Category(),

wdThis.wdGetAffectedPersonInterface().getCurrentAffected().getRecord_No());

readAffected(invpersonLead);

wdThis.wdGetAffectedPersonInterface().setCurrentAffected(afp);

wdThis.wdGetInjuriesInterface().setCurrentInjury(inj);

return ret;

//@@end

}

//@@begin javadoc:createAffected()

/** Declared method. */

//@@end

public boolean createAffected( )

{

//@@begin createAffected()

//int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getLeadSelection();

__Hdub__Is_Rfc_Ip ip = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

__Hdub__Is_Rfc_Ipevinj inj = wdThis.wdGetInjuriesInterface().getCurrentInjury();

// create new affected

boolean ret = wdThis.wdGetAccidentModelInterface().createAffected();

int invpersonLead = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonIndex(ip.getRecord_No());

readAffected(invpersonLead);

wdThis.wdGetInjuriesInterface().setCurrentInjury(inj);

return ret;

//@@end

}

//@@begin javadoc:getIhvalsBuffer()

/** Declared method. */

//@@end

public de.ittechnic.com.i.Accidentrfcmodel.__Hdub__Is_Rfc_Ihval.__Hdub__Is_Rfc_Ihval_List getIhvalsBuffer( )

{

//@@begin getIhvalsBuffer()

return mIpvaBuffer;

//@@end

}

//@@begin javadoc:getIhpropsBuffer()

/** Declared method. */

//@@end

public de.ittechnic.com.i.Accidentrfcmodel.__Hdub__Is_Rfc_Ihpr.__Hdub__Is_Rfc_Ihpr_List getIhpropsBuffer( )

{

//@@begin getIhpropsBuffer()

return mIppropsBuffer;

//@@end

}

//@@begin javadoc:getIhpropLtxtBuffer()

/** Declared method. */

//@@end

public java.util.Map getIhpropLtxtBuffer( )

{

//@@begin getIhpropLtxtBuffer()

return mIppropLtxtBufferMap;

//@@end

}

//@@begin javadoc:updateValuesOfJavaBuffer()

/** Declared method. */

//@@end

public void updateValuesOfJavaBuffer( )

{

//@@begin updateValuesOfJavaBuffer()

mIppropsBuffer.clear();

mIpvaBuffer.clear();

mIppropLtxtBuffer.clear();

if (null != wdThis.wdGetAffectedPersonInterface().getCurrentAffected()){

TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getIpva_Data(), mIpvaBuffer);

TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getIpprop_Data(), mIppropsBuffer);

TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getIhpropLtxtList(IIMConstants.REF_OBJ_TYPE_AFP), mIppropLtxtBuffer);

TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getCharactLongtext(), mIppropLtxtBufferMap);

}

//@@end

}

//@@begin javadoc:onActionSaveAccident(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSaveAccident(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionSaveAccident(ServerEvent)

String method = "onActionSaveAccident(ServerEvent)";

getLocation().entering(method);

__Hdub__Is_Rfc_Ip ip = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

hlpDebug(mCache);

updatebattlebells();

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(false);

if (isAccidentFormChanged()){

callConfirmDialog("onActionConfirmDialogFormChangedSaveYes",

"onActionConfirmDialogNo",

"OK",

"Cancel",

"Change Accident",

"TXT_Accident_CHANGED");

} else {

// update affected/ injury

if (!updateAffected())

{

return;

}

// save Accident

boolean ialSaved = saveAccident(true);

if (ialSaved)

{

// initialize views

wdThis.wdGetAccidentMainController().initViews(mActype, IIMConstants.REF_OBJ_TYPE_AFP);

wdContext.currentContextElement().setEnterAffectedView(false);

mChanged = false;

}

}

wdContext.currentContextElement().setRecreate(false);

hlpDebug(mCache);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionBackToAccident(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionBackToAccident(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionBackToAccident(ServerEvent)

String method = "onActionBackToAccident(ServerEvent)";

getLocation().entering(method);

hlpDebug(mCache);

if ( IIMConstants.ACTYPE_DISPLAY.equalsIgnoreCase(wdContext.currentContextElement().getActype()) )

{

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(false);

wdThis.wdFirePlugBackToAccident_Out(

wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),

mActype,

"",

mIalid,

true );

}

// update affected person data

if (isAffectedChanged()

|| wdContext.currentContextElement().getbattlebellappl().isbattlebellFormChangedByClient(wdContext)){

boolean afpUpdated = updateAffected();

hlpDebug(mCache);

if (afpUpdated) {

wdContext.currentContextElement().setAffectedPersonViewSavePending(true);

// go back to Accident header view

if ((!wdContext.currentContextElement().getEnterAffectedView() ) //update battlebells is not neccassary if afp view is entered the first time

&& IIMConstants.ACTYPE_EDIT.equalsIgnoreCase(wdContext.currentContextElement().getActype())

&& !wdContext.currentContextElement().getCanceledAffPers() //if not canceled

&& StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getNewAccCat())

&& !StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getAffected().getAccident_Category())){

if (updatebattlebells())

{

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(false);

__Hdub__Is_Rfc_Ip ip = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonSelected();

readAccident();

int ipLeadSel = wdThis.wdGetEnlistsPersonInterface().getEnlistsPersonIndex(ip.getRecord_No());

readAffected(ipLeadSel);

wdThis.wdFirePlugBackToAccident_Out(

wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),

mActype,

"" ,

mIalid,

true);

}

} else if(StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getAffected().getAccident_Category())){

wdThis.wdFirePlugBackToAccident_Out(

wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),

mActype,

"",

mIalid,

true );

}

}

} else {

// go back to Accident header view

if ((!wdContext.currentContextElement().getEnterAffectedView() ) //update battlebells is not neccassary if afp view is entered the first time

&& IIMConstants.ACTYPE_EDIT.equalsIgnoreCase(wdContext.currentContextElement().getActype())

&& !wdContext.currentContextElement().getCanceledAffPers() //if not canceled

&& StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getNewAccCat())

&& !StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getAffected().getAccident_Category())){ //accCat may not be empty

if (updatebattlebells())

{

//updatebattlebells will set the flag if there are changes

if (mChanged) {

wdContext.currentContextElement().setAffectedPersonViewSavePending(true);

}

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(false);

wdThis.wdFirePlugBackToAccident_Out(

wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),

mActype,

"",

mIalid,

true );

}

} else if(StaticHelper.isEmptyOrNull(wdContext.currentContextElement().getAffected().getAccident_Category())){

wdThis.wdFirePlugBackToAccident_Out(

wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),

mActype,

"",

mIalid,

true );

}

}

hlpDebug(mCache);

updateValuesOfJavaBuffer();

wdContext.currentContextElement().setCanceledAffPers(false);

hlpDebug(mCache);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onPlugEnterAffectedPerson_In(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onPlugEnterAffectedPerson_In(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String actype, java.sql.Date keydate, java.lang.String objcat )

{

//@@begin onPlugEnterAffectedPerson_In(ServerEvent)

String method = "onPlugEnterAffectedPerson_In";

getLocation().entering(method);

// get current affected person data

TDModelCopyService.copy(wdThis.wdGetAffectedPersonInterface().getCurrentAffected(),mAffected);

TDModelCopyService.copy(wdThis.wdGetInjuriesInterface().getCurrentInjury(),mInjury);

mActype = actype;

wdContext.currentContextElement().setActype(actype);

// wdContext.currentContextElement().setbattlebellappl(new battlebellAppl());

// set visibility of trays

wdThis.wdGetAccidentMainController().setVisibility(actype, objcat, wdContext.currentContextElement().getbattlebellappl());

wdContext.currentVisibilityElement().setReadOnly(actype.equals(IIMConstants.ACTYPE_DISPLAY));

// show portal navigation for affected person

setAffectedNavigation();

mChanged = false;

// open just tray for affected header

resetExpanded();

setExpanded(IIMConstants.NAV_AFP);

// set keydate and actype

// if (!actype.equals(IIMConstants.ACTYPE_DISPLAY))

// {

// if ( mAffected.getStatus().length() != 0 &&

// mModelIF.getNextStatus(mAffected.getStatus(),IIMConstants.REF_OBJ_TYPE_AFP).length() == 0)

// {

// actype = IIMConstants.ACTYPE_DISPLAY;

// }

// }

// set buttons enabling

setView(actype);

// initialize views

wdThis.wdGetAccidentMainController().initViews(actype, IIMConstants.REF_OBJ_TYPE_AFP);

// set visibility of trays

wdThis.wdGetAccidentMainController().setVisibility( actype,

IIMConstants.REF_OBJ_TYPE_AFP,

wdContext.currentContextElement().getbattlebellappl() );

//get current Accident

mIalid=wdThis.wdGetAccidentModelInterface().getCurrentHeader().getAccident();

// set header

wdContext.currentHeaderElement().setAccident_ID(mIalid);

wdContext.currentHeaderElement().setAccident_Status(

getStatusCode(wdThis.wdGetAccidentHeadInterface().getCurrentAccident().getStatus()));

wdContext.currentHeaderElement().setEnlists_Fullname(wdThis.wdGetEnlistsPersonInterface().getCurrentEnlists()

.getEnlists_Fullname());

wdContext.currentContextElement().setAffected(mAffected);

updateValuesOfJavaBuffer();

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionNavigate(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionNavigate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String dataObject )

{

//@@begin onActionNavigate(ServerEvent)

String method = "onActionNavigate(ServerEvent)";

getLocation().entering(method);

resetExpanded();

setExpanded(dataObject);

wdContext.currentContextElement().setEstCat(dataObject);

wdContext.currentContextElement().setFromNavigation(true);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionChangeStatus(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionChangeStatus(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionChangeStatus(ServerEvent)

String method = "onActionChangeStatus(ServerEvent)";

getLocation().entering(method);

wdContext.currentContextElement().setRecreate(false);

wdThis.wdGetAccidentModelInterface().changeStatusAffectedPerson(false);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionConfirmDialogNo(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionConfirmDialogNo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionConfirmDialogNo(ServerEvent)

String method = "onActionConfirmDialogNo(ServerEvent)";

getLocation().entering(method);

wdContext.currentContextElement().setRecreate(false);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionConfirmDialogFormChangedSaveYes(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionConfirmDialogFormChangedSaveYes(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionConfirmDialogFormChangedSaveYes(ServerEvent)

String method = "onActionConfirmDialogFormChangedSaveYes(ServerEvent)";

getLocation().entering(method);

wdContext.currentContextElement().setRecreate(false);

// update affected/ injury if needed

if (isAffectedChanged())

{

if (!updateAffected())

{

return;

}

}

if (updatebattlebells())

{

updateValuesOfJavaBuffer();

saveAccident(true);

}

wdContext.currentContextElement().setCanceledAffPers(false);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionConfirmDialogResetYes(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionConfirmDialogResetYes(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionConfirmDialogResetYes(ServerEvent)

String method = "onActionConfirmDialogResetYes(ServerEvent)";

getLocation().entering(method);

wdContext.currentContextElement().setAffectedPersonViewSavePending(false);

// reset affected data

wdThis.wdGetAccidentModelInterface().readAffectedPerson(wdThis.wdGetEnlistsPersonInterface().getCurrentEnlists().getRecord_No());

wdThis.wdGetAffectedPersonInterface().setCurrentAffected(mAffected);

wdThis.wdGetInjuriesInterface().setCurrentInjury(mInjury);

// reset battlebell data

resetValuesOFABAPBuffer();

wdContext.currentContextElement().setRecreate(true);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionCloseView(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionCloseView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCloseView(ServerEvent)

String method = "onActionCloseView(ServerEvent)";

getLocation().entering(method);

// show no portal navigation

setNoNavigation();

// show empty view

wdThis.wdFirePlugCloseView_Out();

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onActionSetMultiValues(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionSetMultiValues(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String pAttribute, java.lang.String pType, java.lang.String pEstcat )

{

//@@begin onActionSetMultiValues(ServerEvent)

String method = "onActionSetMultiValues(ServerEvent)";

getLocation().entering(method);

wdContext.currentContextElement().setFromNavigation(false);

wdContext.currentContextElement().setRecreate(false);

// set multi values

MultiValueContainer values =

(MultiValueContainer) wdContext

.nodeDynamicNode()

.getChildNode(pEstcat, IWDNode.LEAD_SELECTION)

.getCurrentElement()

.getAttributeValue(pAttribute + "mv");

wdContext.currentContextElement().setValues(values);

// open multi value popup

wdThis.wdGetbattlebellInterface().createMultiValueWindow(

pAttribute,

pType,

pEstcat,

wdContext,

wdContext.currentContextElement().getbattlebellappl());

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onEventMultiValueSelect(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onEventMultiValueSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, de.ittechnic.com.i.battlebell.multivalue.MultiValueContainer pValues, java.lang.String pText, java.lang.String pTarget, boolean pAccept )

{

//@@begin onEventMultiValueSelect(ServerEvent)

String method = "onEventMultiValueSelect";

getLocation().entering(method);

if(pAccept){

wdContext.currentContextElement().getbattlebellappl().multiValueSelect(pValues, pText, wdContext, pTarget);

}

wdContext.currentContextElement().setFromNavigation(false);

wdContext.currentContextElement().setRecreate(false);

getLocation().exiting(method);

//@@end

}

//@@begin javadoc:onInjuryCategoryChanged(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onInjuryCategoryChanged(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String pNewCategory )

{

//@@begin onInjuryCategoryChanged(ServerEvent)

if (pNewCategory == null) {

//work around - popup to confirm inj cat change is visible, we do not need to process battlebells

wdContext.currentContextElement().setSkipWdDoModify(true);

return;

}

wdContext.currentContextElement().setNewAccCat(pNewCategory);

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(true);

wdContext.currentContextElement().setRecreate(true);

mChanged = true;

//@@end

}

//@@begin javadoc:onEventEnterAffected(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onEventEnterAffected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onEventEnterAffected(ServerEvent)

//IExternalAffectedPersonInterface affectedIF = wdThis.wdGetAffectedPersonInterface();

//wdContext.currentContextElement().setNewAccCat(affectedIF.getCurrentAffected().getAccident_Category());

wdContext.currentContextElement().setEnterAffectedView(true);

wdContext.currentContextElement().setUpdatebattlebellsNeccessary(true);

mChanged = false;

//@@end

}

//@@begin javadoc:onActionbattlebellTimeDrpDwnSelected(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionbattlebellTimeDrpDwnSelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String pAttribute, java.lang.String pEstCat )

{

//@@begin onActionbattlebellTimeDrpDwnSelected(ServerEvent)

//Don't need to execute wdDoModifyView() -> set SkipWdDoModify Flag

wdContext.currentContextElement().setSkipWdDoModify(true);

wdContext.currentContextElement().getbattlebellappl().setTimeFieldFromDropDownBoxes( pAttribute, pEstCat, wdContext );

//@@end

}

//@@begin javadoc:onActionCancelAffected(ServerEvent)

/** Declared validating event handler. */

//@@end

public void onActionCancelAffected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCancelAffected(ServerEvent)

String method = "onActionCancelAffected(ServerEvent)";

getLocation().entering(method);

// if (isAffectedChanged()

// || wdContext.currentContextElement().getbattlebellappl().isbattlebellFormChangedByClient(wdContext)){

callConfirmDialog("onActionConfirmDialogResetYes",

"onActionConfirmDialogNo",

"Yes",

"No",

"Reset Changes",

"TXT_Accident_RESET");

wdContext.currentContextElement().setSkipWdDoModify(true);

// } else {

// // just reset affected person data which is not written to buffer

// wdThis.wdGetAccidentModelInterface().readAffectedPerson(wdThis.wdGetEnlistsPersonInterface().getCurrentEnlists().getRecord_No());

// wdThis.wdGetAffectedPersonInterface().setCurrentAffected(mAffected);

// wdThis.wdGetInjuriesInterface().setCurrentInjury(mInjury);

// wdContext.currentContextElement().setAffectedPersonViewSavePending(false);

// wdThis.wdFirePlugEnterAffectedPerson_Out(wdThis.wdGetAccidentModelInterface().getTHEKeyDate(),mActype,IIMConstants.REF_OBJ_TYPE_IAL);

// }

getLocation().exiting(method);

//@@end

}

/*

  • The following code section can be used for any Java code that is

  • not to be visible to other controllers/views or that contains constructs

  • currently not supported directly by Web Dynpro (such as inner classes or

  • member variables etc.). </p>

*

  • Note: The content of this section is in no way managed/controlled

  • by the Web Dynpro Designtime or the Web Dynpro Runtime.

*/

//@@begin others

String mActype = new String();

IWDMessageManager mMsgMgr = null;

public String mIalid = new String();

private Map mStatusMap = null;

private boolean mChanged = false;

private Location mLocation = null;

__Hdub__Is_Rfc_Ipevinj mInjury = new __Hdub__Is_Rfc_Ipevinj();

__Hdub__Is_Rfc_Ipeva mAffected = new __Hdub__Is_Rfc_Ipeva();

__Hdub__Is_Rfc_Ihpr.__Hdub__Is_Rfc_Ihpr_List mIppropsBuffer = new __Hdub__Is_Rfc_Ihpr.__Hdub__Is_Rfc_Ihpr_List();

__Hdub__Is_Rfc_Ihval.__Hdub__Is_Rfc_Ihval_List mIpvaBuffer = new __Hdub__Is_Rfc_Ihval.__Hdub__Is_Rfc_Ihval_List();

__Hdub__Is_Ihprop_Ltxt.__Hdub__Is_Ihprop_Ltxt_List mIppropLtxtBuffer = new __Hdub__Is_Ihprop_Ltxt.__Hdub__Is_Ihprop_Ltxt_List();

Map mIppropLtxtBufferMap = new HashMap();

public static void resetExpanded(List pDisplayedTrays,

IPrivateSelectedPersonView.IContextNode context, com.sap.tc.webdynpro.progmodel.api.IWDView view )

{

// close expanded battlebell Trays

if(pDisplayedTrays != null){

for(int i = 0; pDisplayedTrays.size() > i ; i++){

if(pDisplayedTrays.get(i) != null && pDisplayedTrays.get(i).toString() != null)

context.currentContextElement().getbattlebellappl().expandTray(pDisplayedTrays.get(i).toString(), view, false);

}

}

}

public static void setExpanded( java.lang.String pEstCat,

IPrivateSelectedPersonView.IContextNode context, com.sap.tc.webdynpro.progmodel.api.IWDView pView )

{

if (!pEstCat.equalsIgnoreCase(""))

context.currentContextElement().getbattlebellappl().expandTray(pEstCat, pView, true);

}

public void resetValuesOFABAPBuffer( )

{

wdThis.wdGetAccidentModelInterface().changebattlebellProperties(

IIMConstants.REF_OBJ_TYPE_AFP,

mIpvaBuffer,

mIppropsBuffer,

mIppropLtxtBuffer );

wdContext.currentContextElement().setCanceledAffPers(true);

}

public com.sap.tc.logging.Location getLocation( )

{

if (null == mLocation) {

mLocation =

Location.getLocation(

wdThis.wdGetAccidentMainController().getLocation(),

"im.SelectedPersonView");

return getLocation();

}

return mLocation;

}

//for having access of latest affected while debugging

public static String mDbgHlp = null;

private Cacher mCache = new Cacher("Enlists and Affected not changed from last time.");

private synchronized void hlpDebug(Cacher cache) {

__Hdub__Is_Rfc_Ipeva affected =

wdThis.wdGetAffectedPersonInterface().getCurrentAffected();

__Hdub__Is_Rfc_Ipevinj injury =

wdThis.wdGetInjuriesInterface().getCurrentInjury();

String str =

ModelObj2String.getString(injury)

+ "

"

+ ModelObj2String.getString(affected);

String cached = cache.toStringCached(str);

String stack = StaticHelper.getStackTop(5);

getLocation().pathT("hlpDebug", stack);

getLocation().pathT("hlpDebug", cached);

mDbgHlp = str;

}

private boolean isbattlebellDataChanged(__Hdub__Is_Rfc_Ihval.__Hdub__Is_Rfc_Ihval_List pIhvalsBuffer,

__Hdub__Is_Rfc_Ihpr.__Hdub__Is_Rfc_Ihpr_List pIhpropsBuffer,

Map pLongTextMap) {

if (wdThis.wdGetAffectedPersonInterface().getCurrentAffected() == null) return false;

String afpRecn = wdThis.wdGetAffectedPersonInterface().getCurrentAffected().getRecord_No();

//TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getIpva_Data(), mIhvalsBuffer);

__Hdub__Is_Rfc_Ihval.__Hdub__Is_Rfc_Ihval_List ihvalList = wdThis.wdGetAccidentModelInterface().getIpva_Data();

__Hdub__Is_Rfc_Ihpr.__Hdub__Is_Rfc_Ihpr_List ihpropsList = wdThis.wdGetAccidentModelInterface().getIpprop_Data();

//build ihval map for faster search

Map ihvalMap = new HashMap();

for (int i = 0; i < ihvalList.size(); i++) {
__Hdub__Is_Rfc_Ihval ihval = (__Hdub__Is_Rfc_Ihval) ihvalList.get(i);
if (
IIMConstants.REF_OBJ_TYPE_AFP.equals(ihval.getRef_Object())
&& ( afpRecn != null && afpRecn.equals(ihval.getRef_Recno_Object())
|| afpRecn == null && ihval.getRef_Recno_Object() == null
) ) {

if (ihval.getRecord_No() != null) {
ihvalMap.put(ihval.getRecord_No(), ihval);
}

}
}

//build ipprops map for faster search
Map ippropsMap = new HashMap();
for (int i = 0; i < ihpropsList.size(); i++) {
__Hdub__Is_Rfc_Ihpr ihprop = (__Hdub__Is_Rfc_Ihpr) ihpropsList.get(i);

__Hdub__Is_Rfc_Ihval ihval = (__Hdub__Is_Rfc_Ihval) ihvalMap.get(ihprop.getRecno_Root());
if (ihval != null) {
String key = ihprop.getRecno_Root() + ihprop.getInt_Char() + ihprop.getSort_Field();
ippropsMap.put(key, ihprop);
}

}

for (int i = 0; i < pIhpropsBuffer.size(); i++) {
__Hdub__Is_Rfc_Ihpr ihpropCurrent = (__Hdub__Is_Rfc_Ihpr) pIhpropsBuffer.get(i);

if (ihvalMap.get(ihpropCurrent.getRecno_Root()) == null) {
continue;
}

String key = ihpropCurrent.getRecno_Root()
+ ihpropCurrent.getInt_Char()
+ ihpropCurrent.getSort_Field();

__Hdub__Is_Rfc_Ihpr ihpropOld = (__Hdub__Is_Rfc_Ihpr) ippropsMap.get(key);
if (ihpropOld == null ) {
//new value, there is a change
return true;
} else {
//compare values
if (!StaticHelper.isEqualSpecial(ihpropCurrent.getChar_Value(), ihpropOld.getChar_Value())
|| ihpropCurrent.getNum_Val_Fm() != ihpropOld.getNum_Val_Fm()) {
return true;
}
}
}

// TDModelCopyService.copy(wdThis.wdGetAccidentModelInterface().getCharactLongtext(), mIhpropLtxtBuffer);
Map ltMap = wdThis.wdGetAccidentModelInterface().getCharactLongtext();
Iterator it = pLongTextMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
String valueOld = (String) ltMap.get(key);
if (!StaticHelper.isEqualSpecial(value, valueOld)) {
return true;
}
}
return false;
}


private String getStatusCode(String pStatus) {
if (mStatusMap == null) {
mStatusMap = new HashMap();

//read status data
__Hdub__Is_Allowedval[] allowedVal =
wdThis.wdGetAccidentModelInterface().getCustomizingIalAllowedValues(false);

for (int i = 0; i < allowedVal.length; i++) {
if ("CCIHC_TJ04".equals(allowedVal.getTabname_Estcat())
&& "IASTATUS".equals(allowedVal
.getFieldname())) {

mStatusMap.put(allowedVal.getTec_Key(), allowedVal.getCode());

}

}

}

return (String) mStatusMap.get(pStatus);

}

//@@end

}

Former Member
0 Kudos

Hi ok thank you.

Nevertheless can I post my code ?

Regards

sas

Former Member
0 Kudos

Hi,

If your problem is not solved ,please post the code.

Regards

Sudhir

Former Member
0 Kudos

Hi yes I can post the code.

I'm taking the copy outside of

if(first){

}

regards

sas

Former Member
0 Kudos

Hi,

Then every time when wddoModify() view is getting called,your backup list will be replaced by the modified list.

Try to do it inside

if(first){

}

or in the doInit() method.

Regards,

Sudhir

Former Member
0 Kudos

Hello!

This is exactly the way I have tried it to do. This phenomenon occurs inside

wdDoModify. Does it make any difference ?

I'm sorry to say the result has been performed not successfully

Regards

sas

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

The logic/code definitely works - you can see the results in my previous post. It's difficult to say why it isnt working in your controller without seeing your code.

Are you dynamically creating/modifying UI elements based on the "konfig" list? If no then there is no need for it to be in the wdDoModifyView() method.

Cheers-

Atul

Former Member
0 Kudos

Hello,

I'm sorry but I have the following info insiede debugging

"backUpList.size()"= 0

Regards

sas

ThatSAPGuy
Advisor
Advisor
0 Kudos

Sas-

Have a look at this method:


	public static void main(String[] args)
	{
		List original = new ArrayList();
		original.add("One");
		original.add("Two");
		original.add("Three");
		
		List backup = new ArrayList();
		backup.addAll(original);
		
		original.remove(2);
		original.remove(1);
		
		System.out.println("original list size is " + original.size());
		System.out.println("original list contents : " + original.toString());
		System.out.println("backup list size is " + backup.size());
		System.out.println("backup list contents : " + backup.toString());
	}
	

The output is


original list size is 1
original list contents : [One]
backup list size is 3
backup list contents : [One, Two, Three]

Cheers-

Atul

Former Member
0 Kudos

Hi,

Can you tell me what is your exact need.

Regards,

Sudhir

Former Member
0 Kudos

Hi,

You can take some backup list ex

List backUpList=new ArrayList();

now add the Konfig list elements to backUpList

konfig.addAll(0,backUpList);

Now you can modify Konfig List as you have the backup in the form of

backUpList.

xxxxxxxxxxxxxxxxx

Regards,

Sudhir

Edited by: Armin Reichert on Feb 20, 2008 7:56 PM