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

com.genexus.db.odata.CurrentOf Maven / Gradle / Ivy

Go to download

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

The newest version!
package com.genexus.db.odata;

import java.util.HashMap;
import java.util.Map;
import org.apache.olingo.client.api.domain.ClientEntity;

public class CurrentOf extends ComplexHashMap
{
    private final CurrentOfManager currentOfManager;
    private final String cursorName;
    public CurrentOf(CurrentOfManager currentOfManager, String cursorName, String entity)
    {
        super(entity);
        this.currentOfManager = currentOfManager;
        this.cursorName = cursorName;
        setCurrentOfEntry();
    }

    protected ClientEntity getUpdateEntity()
    {
        return currentOfManager.getQuery(cursorName).getCurrentEntity();
    }
    
    protected HashMap getCurrentOfEntry()
    {
        return currentOfEntry;
    }
    
    HashMap currentOfEntry;
    private void setCurrentOfEntry()
    {
        @SuppressWarnings("unchecked")
        HashMap map = (HashMap)currentOfManager.getQuery(cursorName).currentEntry.get(getEntity());
        putAll(map);
        currentOfEntry = cloneHashMaps(new HashMap<>(map));
//        putAll(new HashMap(currentOfEntry));
    }

    private HashMap cloneHashMaps(HashMap hashMap)
    {
        for(String key : hashMap.keySet())
        {
           Object value = hashMap.get(key);
           if(value instanceof Map)
           {
               @SuppressWarnings("unchecked")
               HashMap clonedMap = new HashMap<>((HashMap)hashMap.remove(key));
               hashMap.put(key, cloneHashMaps(clonedMap));
           }
        }
        return hashMap;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy