Search in sources :

Example 1 with SharedobjectTag

use of beans.dbaccess.SharedobjectTag in project MSEC by Tencent.

the class DelSharedobject method deleteAll.

public static String deleteAll(String flsn, String slsn) {
    DBUtil util = new DBUtil();
    if (util.getConnection() == null) {
        return "DB connect failed.";
    }
    try {
        String sql = "select tag_name from t_sharedobject_tag where  first_level_service_name=? and second_level_service_name=?";
        List<Object> params = new ArrayList<Object>();
        params.add(flsn);
        params.add(slsn);
        ArrayList<SharedobjectTag> result = util.findMoreRefResult(sql, params, SharedobjectTag.class);
        for (int i = 0; i < result.size(); i++) {
            String tag_name = result.get(i).getTag_name();
            sql = "delete from t_sharedobject_tag where tag_name=? and first_level_service_name=? and second_level_service_name=?";
            params = new ArrayList<Object>();
            params.add(tag_name);
            params.add(flsn);
            params.add(slsn);
            //删除数据库记录
            int delNum = util.updateByPreparedStatement(sql, params);
            String filename = SharedobjectTag.getSharedobjectName(flsn, slsn, tag_name, "so");
            RemoveFile(filename);
        }
        return "success";
    } catch (Exception e) {
        e.printStackTrace();
        return e.getMessage();
    } finally {
        util.releaseConn();
    }
}
Also used : DBUtil(ngse.org.DBUtil) ArrayList(java.util.ArrayList) SharedobjectTag(beans.dbaccess.SharedobjectTag) SQLException(java.sql.SQLException)

Aggregations

SharedobjectTag (beans.dbaccess.SharedobjectTag)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 DBUtil (ngse.org.DBUtil)1