Search in sources :

Example 51 with EzyArray

use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.

the class EzySocketClient method processReceivedMessage.

protected void processReceivedMessage(EzyArray message) {
    int cmdId = message.get(0, int.class);
    EzyArray data = message.get(1, EzyArray.class, null);
    EzyCommand cmd = EzyCommand.valueOf(cmdId);
    printReceivedData(cmd, data);
    if (cmd == EzyCommand.DISCONNECT) {
        int reasonId = data.get(0, int.class);
        disconnectReason = reasonId;
        socketStatuses.push(EzySocketStatus.DISCONNECTING);
    } else {
        dataHandlers.handle(cmd, data);
    }
}
Also used : EzyCommand(com.tvd12.ezyfoxserver.client.constant.EzyCommand) EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray)

Example 52 with EzyArray

use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.

the class EzyObjectToMap method toMap.

@SuppressWarnings({ "rawtypes", "unchecked" })
public Map toMap(EzyObject object) {
    Map answer = new HashMap<>();
    for (Object key : object.keySet()) {
        Object value = object.get(key);
        Object skey = key;
        EzyArrayToList arrayToList = EzyArrayToList.getInstance();
        if (key instanceof EzyArray)
            skey = arrayToList.toList((EzyArray) key);
        else if (key instanceof EzyObject)
            skey = toMap((EzyObject) key);
        Object svalue = value;
        if (value != null) {
            if (value instanceof EzyArray)
                svalue = arrayToList.toList((EzyArray) value);
            if (value instanceof EzyObject)
                svalue = toMap((EzyObject) value);
        }
        answer.put(skey, svalue);
    }
    return answer;
}
Also used : HashMap(java.util.HashMap) EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject) EzyObject(com.tvd12.ezyfoxserver.client.entity.EzyObject) Map(java.util.Map) HashMap(java.util.HashMap)

Example 53 with EzyArray

use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.

the class EzyEntityArrays method newArray.

public static EzyArray newArray(Object... args) {
    EzyArray array = EzyEntityFactory.newArray();
    array.add(args);
    return array;
}
Also used : EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray)

Example 54 with EzyArray

use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.

the class EzyEntityArrays method newArray.

public static EzyArray newArray(List list) {
    EzyArray array = EzyEntityFactory.newArray();
    array.add(list);
    return array;
}
Also used : EzyArray(com.tvd12.ezyfoxserver.client.entity.EzyArray)

Example 55 with EzyArray

use of com.tvd12.ezyfox.entity.EzyArray in project dahlia by youngmonkeys.

the class LocalCollection method find.

@Override
public EzyArray find(EzyObject query, FindOptions options) {
    CommandFind command = new CommandFind(store.getId(), query, options.toObject());
    EzyArray result = commandExecutor.execute(command);
    return result;
}
Also used : EzyArray(com.tvd12.ezyfox.entity.EzyArray) CommandFind(com.tvd12.dahlia.core.command.CommandFind)

Aggregations

EzyArray (com.tvd12.ezyfox.entity.EzyArray)80 Test (org.testng.annotations.Test)45 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)30 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)17 EzyResponseApi (com.tvd12.ezyfoxserver.api.EzyResponseApi)15 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)14 EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)13 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)13 EzySimpleLoginRequest (com.tvd12.ezyfoxserver.request.EzySimpleLoginRequest)13 FieldSetting (com.tvd12.dahlia.core.setting.FieldSetting)12 EzyObject (com.tvd12.ezyfox.entity.EzyObject)12 EzyLoginController (com.tvd12.ezyfoxserver.controller.EzyLoginController)12 EzySimpleUser (com.tvd12.ezyfoxserver.entity.EzySimpleUser)11 EzySimpleServerContext (com.tvd12.ezyfoxserver.context.EzySimpleServerContext)9 CollectionSetting (com.tvd12.dahlia.core.setting.CollectionSetting)8 BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)8 Collection (com.tvd12.dahlia.core.entity.Collection)7 EzyArray (com.tvd12.ezyfoxserver.client.entity.EzyArray)7 EzySessionManager (com.tvd12.ezyfoxserver.wrapper.EzySessionManager)7 Record (com.tvd12.dahlia.core.entity.Record)5