Search in sources :

Example 11 with FieldSetting

use of com.tvd12.dahlia.core.setting.FieldSetting in project dahlia by youngmonkeys.

the class SettingObjectToFields method toSetting.

public FieldSetting toSetting(EzyObject object) {
    DataType type = DataType.valueOf(object.get(SettingFields.TYPE));
    SettingObjectToField mapper = mappers.get(type);
    FieldSetting answer = mapper.toSetting(this, object);
    return answer;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) DataType(com.tvd12.dahlia.core.data.DataType)

Example 12 with FieldSetting

use of com.tvd12.dahlia.core.setting.FieldSetting in project dahlia by youngmonkeys.

the class SettingObjectToFields method toFieldSettings.

public Map<String, FieldSetting> toFieldSettings(EzyArray array) {
    Map<String, FieldSetting> fields = new HashMap<>();
    for (int i = 0; i < array.size(); ++i) {
        EzyObject object = array.get(i);
        String name = object.get(SettingFields.NAME);
        FieldSetting field = toSetting(object);
        fields.put(name, field);
    }
    return fields;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) HashMap(java.util.HashMap) EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 13 with FieldSetting

use of com.tvd12.dahlia.core.setting.FieldSetting in project dahlia by youngmonkeys.

the class SettingObjectToObjectField method newSetting.

@Override
protected FieldObjectSetting newSetting(SettingObjectToFields mappers, EzyObject object) {
    FieldObjectSetting setting = new FieldObjectSetting();
    EzyArray fieldSettings = object.get(SettingFields.FIELDS, EzyArray.class);
    Map<String, FieldSetting> fields = mappers.toFieldSettings(fieldSettings);
    setting.setFields(fields);
    return setting;
}
Also used : FieldSetting(com.tvd12.dahlia.core.setting.FieldSetting) FieldObjectSetting(com.tvd12.dahlia.core.setting.FieldObjectSetting) EzyArray(com.tvd12.ezyfox.entity.EzyArray)

Example 14 with FieldSetting

use of com.tvd12.dahlia.core.setting.FieldSetting in project dahlia by youngmonkeys.

the class SettingFieldToObjects method toObject.

public EzyObject toObject(FieldSetting setting) {
    SettingFieldToObject mapper = mappers.get(setting.getType());
    EzyObject answer = mapper.toObject(this, setting);
    return answer;
}
Also used : EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Example 15 with FieldSetting

use of com.tvd12.dahlia.core.setting.FieldSetting in project dahlia by youngmonkeys.

the class SettingFieldToObjects method toObject.

public EzyObject toObject(String name, FieldSetting setting) {
    EzyObject answer = toObject(setting);
    answer.put(SettingFields.NAME, name);
    return answer;
}
Also used : EzyObject(com.tvd12.ezyfox.entity.EzyObject)

Aggregations

FieldSetting (com.tvd12.dahlia.core.setting.FieldSetting)25 EzyObject (com.tvd12.ezyfox.entity.EzyObject)20 CollectionSetting (com.tvd12.dahlia.core.setting.CollectionSetting)11 EzyArray (com.tvd12.ezyfox.entity.EzyArray)10 Collection (com.tvd12.dahlia.core.entity.Collection)9 Record (com.tvd12.dahlia.core.entity.Record)9 CollectionStorage (com.tvd12.dahlia.core.storage.CollectionStorage)7 RecordConsumer (com.tvd12.dahlia.core.function.RecordConsumer)5 CollectionNotFoundException (com.tvd12.dahlia.exception.CollectionNotFoundException)5 FieldArraySetting (com.tvd12.dahlia.core.setting.FieldArraySetting)4 FieldObjectSetting (com.tvd12.dahlia.core.setting.FieldObjectSetting)4 HashMap (java.util.HashMap)4 DataType (com.tvd12.dahlia.core.data.DataType)3 ArrayList (java.util.ArrayList)3 JSONObject (org.json.JSONObject)3 DahliaCore (com.tvd12.dahlia.core.DahliaCore)2 DahliaCoreLoader (com.tvd12.dahlia.core.DahliaCoreLoader)2 CommandCount (com.tvd12.dahlia.core.command.CommandCount)2 CommandCreateCollection (com.tvd12.dahlia.core.command.CommandCreateCollection)2 CommandCreateDatabase (com.tvd12.dahlia.core.command.CommandCreateDatabase)2