Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8411

Issues with SMP logon/logout on different environments, (DEV, QAS, PRD)

$
0
0

Hello guys, i'm facing a problem with SAP SMP 3.0, PL 04, logon and logout stuff, what is the problem:

 

My smp application is consuming ODATA services, which one consume some master data, and store these data inside my application as follows in Claudia Pacheco 's tutorials with everything right and configured in OnlineStore and OfflineStore stuff, MAFLogon...  and etc.


Everything is fine as the way of the tutorials, and i created my entire logic for what i need to do(which one are, create service orders) in my app storing in SQLiteDatabase, so i combine the master data from my ODATA service + the information that i need to create an order for example.

 

So, my problem is my SMP 3.0 is configured on 3 different and distincts enviroments as normally is the configuration in SAP world, (DEV, QAS, PRD).

 

And as solution to this I created a Logout option to change the enviroment but there is couple problems, for example if the user first do the logon on DEV enviroment, and download all the inital data (master data) in DEV enviroment,

 

And if the user do the logout and do logon again in QAS enviroment, the APP don't download de QAS data, the app continues with DEV database, and the same persistis in DEV to QAS and QAS to DEV as the same to PRD, how can i handle this ??

 

I imagine that i need to call, some delete method from Online and OfflineStore, or something close to that, I thought  that after implementing the MAFLogonActivity and created the doLogon and doLogout methods, all the old user data would be deleted including the database for the Offline and OnlineStore, but these methods don't that they just erase the credentials of an user right ?

 

Any helps on this ?

 

Here is my code:

 

public class MAFLogonActivity2 extends Activity implements LogonListener

{

private final String TAG = MAFLogonActivity2.class.getSimpleName();

 

final static int LOGON_SUCCESS = 101;

final static int LOGON_FAIL = 102;

final static int LOGON_SUCCESS_DEMO = 103;

final static int LOGON_FAIL_DEMO = 104;

 

private LogonUIFacade logonUIFacade;

 

@Override

public void onCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

 

doLogon();

}

 

private void doLogon()

{

 

// present MAF Logon Screen

// get an instance of the LogonUIFacade

if (logonUIFacade == null)

{

logonUIFacade = LogonUIFacade.getInstance();

 

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_ACTIVATIONCODE.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_AFARIASTATUS.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_APPID.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_CERT_PROVIDER.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_CHALLENGECODE.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_CHANNEL.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_GATEWAYCLIENT.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_GWONLY.name(), true);

// logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_HTTPSSTATUS.name(),

// true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_ISUSERREGISTERED.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_LOGONPROCESS.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_MCIMSTATUS.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_MOBILEPLACE.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_MOBILEUSER.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_PASSCODESTATUS.name(), true);

// logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_PASSWORD.name(),

// true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_PINGPATH.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_PREFERRED_CHANNEL.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SECCONFIG.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERDOMAIN.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERFARMID.name(), true);

// logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERPORT.name(),

// true);

// logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERURL.name(),

// true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_URLSUFFIX.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_USEAFARIA.name(), true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_USERCREATIONPOLICY.name(), true);

// logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_USERNAME.name(),

// true);

logonUIFacade.isFieldHidden(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_VAULTPOLICY.name(), true);

 

logonUIFacade.setDefaultValue(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_HTTPSSTATUS.name(), "true");

logonUIFacade.setDefaultValue(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERURL.name(), "mobile.stara.com.br");

logonUIFacade.setDefaultValue(LogonCore.SharedPreferenceKeys.PREFERENCE_ID_SUPSERVERPORT.name(), "8080");

}

 

// init LogonUIFacede

logonUIFacade.init(this, this, AppSettings.APP_ID);

System.err.println();

// ask LogonUIFacede to present the logon screen

// set the resulting view as the content view for this activity

setContentView(logonUIFacade.logon());

System.err.println();

}

 

public void doLogout()

{

// delete registered user

logonUIFacade.deleteUser();

 

 

doLogon();

}

 

@Override

public void objectFromSecureStoreForKey()

{

 

}

 

@Override

public void onApplicationSettingsUpdated()

{

 

}

 

@Override

public void onBackendPasswordChanged(boolean arg0)

{

 

}

 

@Override

public void onLogonFinished(String errorMessage, boolean isUserLoggedOn, LogonContext logonContext)

{

// hides MAFLogonUI when logon finished and returns to main activity

 

boolean isDemoMode = logonContext.getLogonConnection().isDemoMode();

 

if (!isDemoMode)

if (isUserLoggedOn)

{

Log.d(TAG, "LOGON SUCCESS");

Log.d(TAG, errorMessage);

 

Intent intent = new Intent();

 

intent.setClass(this, MainActivity.class);

 

startActivity(intent);

}

else

{

Log.d(TAG, "LOGON FAILED");

Log.d(TAG, errorMessage);

 

runOnUiThread(new Runnable()

{

@Override

public void run()

{

AlertDialog alertDialog = new AlertDialog.Builder(MAFLogonActivity2.this).create();

 

alertDialog.setTitle("Falha na autenticação");

alertDialog.setMessage("Verifique o usuário e senha e tente novamente.");

alertDialog.setCancelable(false);

alertDialog.setCanceledOnTouchOutside(false);

 

alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener()

{

@Override

public void onClick(DialogInterface dialog, int which)

{

}

});

 

alertDialog.show();

}

});

}

}

 

@Override

public void onSecureStorePasswordChanged(boolean arg0, String arg1)

{

 

}

 

@Override

public void onUserDeleted()

{

Log.d(TAG, "onUserDeleted");

 

setContentView(logonUIFacade.logon());

 

}

 

@Override

public void registrationInfo()

{

 

}

 

@Override

protected void onResume()

{

Log.d(TAG, "onResume");

 

super.onResume();

 

doLogon();

}

 

@Override

public void onRefreshCertificate(boolean arg0, String arg1)

{

}

}


Viewing all articles
Browse latest Browse all 8411

Trending Articles



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