x7.repository.transform.SqlDataTransform Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package x7.repository.transform;
import x7.core.bean.Criteria;
import x7.core.bean.condition.InCondition;
import x7.core.bean.condition.RefreshCondition;
import x7.core.web.Page;
import x7.repository.KeyOne;
import x7.repository.dao.Dao;
import java.util.List;
import java.util.Map;
public class SqlDataTransform implements DataTransform {
private Dao dao;
public void setDao(Dao dao) {
this.dao = dao;
}
@Deprecated
@Override
public void refreshCache(Class clz) {
throw new RuntimeException("Wrong Code");
}
@Override
public long create(Object obj) {
// if (SchemaConfig.isNormal(obj.getClass()))
return this.dao.create(obj);
// Transformed transformed = Parser.transform(obj);
//
// createId(obj, transformed);
//
// return this.dao.create(transformed);
}
@Override
public boolean createBatch(List> objList) {
// Object first = objList.get(0);
// if (SchemaConfig.isNormal(first.getClass()))
return this.dao.createBatch(objList);
// List list = new ArrayList<>();
// for (Object obj : objList) {
// Transformed tf = Parser.transform(obj);
// createId(obj, tf);
// list.add(tf);
// }
//
// return this.dao.createBatch(list);
}
@Override
public boolean refresh(RefreshCondition refreshCondition) {
// if (SchemaConfig.isNormal(refreshCondition.getClz()))
return this.dao.refreshByCondition(refreshCondition);
// RefreshCondition refreshConditionTransformed = new RefreshCondition();
// refreshConditionTransformed.setClz(refreshCondition.getClz());
// refreshConditionTransformed.setRefreshList(refreshCondition.getRefreshList());
// refreshConditionTransformed.setCondition(refreshCondition.getCondition());
// refreshConditionTransformed.setSourceStript(refreshCondition.getSourceStript());
//
// Object obj = refreshCondition.getObj();
// if (Objects.nonNull(obj)) {
// Transformed transformed = Parser.transform(obj);
// refreshConditionTransformed.setObj(transformed);
// }
//
// return this.dao.refreshByCondition(refreshConditionTransformed);
}
@Override
public boolean remove(KeyOne keyOne) {
// if (SchemaConfig.isNormal(obj.getClass()))
return this.dao.remove(keyOne);
// Transformed transformed = Parser.transformForRemove(obj);
// return this.dao.remove(transformed);
}
@Override
public boolean execute(T obj, String sql) {
// if (SchemaConfig.isNormal(obj.getClass()))
return this.dao.execute(obj, sql);
// Transformed transformed = Parser.transform(obj);
// return this.dao.execute(transformed, sql);
}
@Override
public List list(Object obj) {
// if (SchemaConfig.isNormal(obj.getClass()))
return this.dao.list(obj);
// Transformed transformed = Parser.transform(obj);
//
// List transformedList = this.dao.list(transformed);
//
// Class clzz = (Class) obj.getClass();
// List list = new ArrayList<>();
// for (Transformed tf : transformedList) {
// T t = Parser.toLogic(tf, clzz);
// list.add(t);
// }
//
// return list;
}
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy