Search in sources :

Example 1 with CopyEntity

use of com.rebuild.core.metadata.impl.CopyEntity in project rebuild by getrebuild.

the class MetaEntityController method entityCopy.

@PostMapping("entity/entity-copy")
public RespBody entityCopy(HttpServletRequest request) {
    final JSONObject reqJson = (JSONObject) ServletUtils.getRequestJson(request);
    Entity sourceEntity = MetadataHelper.getEntity(reqJson.getString("sourceEntity"));
    String entityName = reqJson.getString("entityName");
    String detailEntityName = reqJson.getString("detailEntityName");
    try {
        entityName = new CopyEntity(sourceEntity).copy(entityName, detailEntityName);
        return RespBody.ok(entityName);
    } catch (Exception ex) {
        log.error("entity-copy", ex);
        return RespBody.error(ex.getLocalizedMessage());
    }
}
Also used : EasyEntity(com.rebuild.core.metadata.easymeta.EasyEntity) CopyEntity(com.rebuild.core.metadata.impl.CopyEntity) Entity(cn.devezhao.persist4j.Entity) JSONObject(com.alibaba.fastjson.JSONObject) CopyEntity(com.rebuild.core.metadata.impl.CopyEntity) IOException(java.io.IOException)

Aggregations

Entity (cn.devezhao.persist4j.Entity)1 JSONObject (com.alibaba.fastjson.JSONObject)1 EasyEntity (com.rebuild.core.metadata.easymeta.EasyEntity)1 CopyEntity (com.rebuild.core.metadata.impl.CopyEntity)1 IOException (java.io.IOException)1