
org.nuiton.topia.service.sql.model.AbstractTopiaEntitySqlTableAdapter Maven / Gradle / Ivy
The newest version!
package org.nuiton.topia.service.sql.model;
/*-
* #%L
* ToPIA Extension :: API
* %%
* Copyright (C) 2018 - 2022 Ultreia.io
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* .
* #L%
*/
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializer;
import io.ultreia.java4all.util.json.JsonHelper;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import static io.ultreia.java4all.util.json.JsonHelper.readObjectList;
/**
* Created on 01/03/2022.
*
* @author Tony Chemit - [email protected]
* @since 1.67
*/
public abstract class AbstractTopiaEntitySqlTableAdapter implements JsonDeserializer, JsonSerializer {
public static final String GAV = "gav";
public static final String AUTHORIZED_COLUMN_NAMES = "authorizedColumnNames";
public static final String SELECTORS = "selectors";
protected List getSelectors(JsonDeserializationContext context, JsonObject object) {
return readObjectList(context, SELECTORS, TopiaEntitySqlSelector.class, object);
}
protected Set getAuthorizedColumnNames(JsonObject object) {
String readString = JsonHelper.readString(AUTHORIZED_COLUMN_NAMES, object);
return new LinkedHashSet<>(List.of(readString.split("\\s*,\\s*")));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy