All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.genexus.specific.android.Connect Maven / Gradle / Ivy

Go to download

Core classes for the runtime used by Java and Android apps generated with GeneXus

There is a newer version: 4.7.0
Show newest version
package com.genexus.specific.android;

import java.util.Date;

import com.genexus.common.interfaces.SpecificImplementation;
import com.genexus.db.UserInformation;

import json.org.json.IExtensionJSONObject;
import json.org.json.JSONException;
import json.org.json.JSONObject;

public final class Connect {

	public static void init()
	{
	
		SpecificImplementation.FileUtils = new FileUtils();
		SpecificImplementation.Application = new Application();
		SpecificImplementation.ModelContext = new AndroidModelContextExtension();
		SpecificImplementation.LogManager = new LogManager();
		SpecificImplementation.UserLog = new UserLog();
		SpecificImplementation.HttpClient = new HttpClient();
		SpecificImplementation.GXDirectory = new GXDirectory();
		SpecificImplementation.GXExternalFileInfo = new GXExternalFileInfo();
		SpecificImplementation.GXSmartCacheProvider = new GXSmartCacheProvider();
		SpecificImplementation.GXutil = new GXutil();
		SpecificImplementation.HttpClient = new HttpClient();
		SpecificImplementation.ImagesPath = new ImagesPath();
		SpecificImplementation.LocalUtil = new LocalUtil();
		SpecificImplementation.Messages = new Messages();
		SpecificImplementation.NativeFunctions = new NativeFunctions();
		SpecificImplementation.PictureFormatter = new PictureFormatter();
		SpecificImplementation.Algorithms = new CryptoAlghorithms();
		// connect GXSilentTrn
		SpecificImplementation.GXSilentTrnSdt = new GXSilentTrnSdt();
		SpecificImplementation.SdtMessages_Message = new SdtMessages_Message();

		SpecificImplementation.KeepDecimals = true;
		SpecificImplementation.MillisecondMask = "SSS";
		SpecificImplementation.SupportPending = true;
		SpecificImplementation.cdowMask = "EEEE";
		SpecificImplementation.Base64Encode = "8859_1";
		SpecificImplementation.UseUnicodeCharacterClass = false;
		JSONObject.extension = new JSONObjectExtension();
		
	}
	
	 static class JSONObjectExtension implements IExtensionJSONObject {

			@Override
			public String dateToString(Date d) throws JSONException {
				if (d == null) {
			        throw new JSONException("Null pointer");
			    }
			    UserInformation ui = (UserInformation) com.genexus.GXObjectHelper.getUserInformation(new com.genexus.ModelContext(com.genexus.ModelContext.getModelContextPackageClass()), -1);
			    com.genexus.LocalUtil localUtil = ui.getLocalUtil();
			    String dateString = localUtil.format(d, localUtil.getDateFormat() + " " + localUtil.getTimeFormat());
			    try
			    {
			    	com.genexus.db.DBConnectionManager.getInstance().disconnect(ui.getHandle());
			    }
			    catch (Throwable e)
			    {}
			    return dateString;
			}
			
		}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy