Search in sources :

Example 6 with UploadResource

use of com.qlangtech.tis.manage.biz.dal.pojo.UploadResource in project tis by qlangtech.

the class UploadResourceDAOImpl method deleteByPrimaryKey.

public int deleteByPrimaryKey(Long urId) {
    UploadResource key = new UploadResource();
    key.setUrId(urId);
    return this.deleteRecords("upload_resource.ibatorgenerated_deleteByPrimaryKey", key);
}
Also used : UploadResource(com.qlangtech.tis.manage.biz.dal.pojo.UploadResource)

Example 7 with UploadResource

use of com.qlangtech.tis.manage.biz.dal.pojo.UploadResource in project tis by qlangtech.

the class UploadResourceDAOImpl method loadFromWriteDB.

public UploadResource loadFromWriteDB(Long urId) {
    UploadResource key = new UploadResource();
    key.setUrId(urId);
    UploadResource record = this.loadFromWriterDB("upload_resource.ibatorgenerated_selectByPrimaryKey", key);
    return record;
}
Also used : UploadResource(com.qlangtech.tis.manage.biz.dal.pojo.UploadResource)

Example 8 with UploadResource

use of com.qlangtech.tis.manage.biz.dal.pojo.UploadResource in project tis by qlangtech.

the class TestGetAppconfig method testGetResource.

public void testGetResource() {
    try {
        SnapshotDomain domain = HttpConfigFileReader.getResource("search4punish", 0, RunEnvironment.DAILY, ConfigFileReader.FILE_SCHEMA);
        System.out.println(domain.getSnapshot());
        UploadResource resource = domain.getSolrSchema();
        Assert.assertNotNull(resource);
        Assert.assertNotNull(resource.getContent());
        System.out.println(new String(resource.getContent()));
        resource = domain.getSolrConfig();
        Assert.assertNotNull(resource);
        Assert.assertNull(resource.getContent());
    } catch (RepositoryException e) {
        Assert.assertFalse(e.getMessage(), true);
    }
}
Also used : SnapshotDomain(com.qlangtech.tis.manage.common.SnapshotDomain) UploadResource(com.qlangtech.tis.manage.biz.dal.pojo.UploadResource) RepositoryException(com.qlangtech.tis.manage.common.RepositoryException)

Example 9 with UploadResource

use of com.qlangtech.tis.manage.biz.dal.pojo.UploadResource in project tis by qlangtech.

the class SnapshotViewImplDAO method main.

public static void main(String[] args) {
    SnapshotViewImplDAO dao = new SnapshotViewImplDAO();
    UploadResource resource = new UploadResource();
    resource.setResourceType("test");
    String content = "${cfg.minGramSize}";
    resource.setContent(content.getBytes(TisUTF8.get()));
    dao.mergeSystemParameter(resource);
    System.out.println(new String(resource.getContent(), TisUTF8.get()));
}
Also used : UploadResource(com.qlangtech.tis.manage.biz.dal.pojo.UploadResource)

Example 10 with UploadResource

use of com.qlangtech.tis.manage.biz.dal.pojo.UploadResource in project tis by qlangtech.

the class SnapshotViewImplDAO method getView.

@Override
public SnapshotDomain getView(Integer snId, boolean mergeContextParams) {
    // 实现懒加载
    Assert.assertNotNull("param snId ", snId);
    final Snapshot snapshot = snapshotDAO.loadFromWriteDB(snId);
    if (snapshot == null) {
        throw new IllegalArgumentException("snid:" + snId + " relevant record is not exist");
    }
    SnapshotDomain domain = new SnapshotDomain() {

        UploadResource solrConfig;

        UploadResource schema;

        @Override
        public Snapshot getSnapshot() {
            return snapshot;
        }

        @Override
        public Integer getAppId() {
            return snapshot.getAppId();
        }

        @Override
        public UploadResource getSolrConfig() {
            try {
                if (this.solrConfig == null && snapshot.getResSolrId() != null) {
                    solrConfig = uploadResourceDao.loadFromWriteDB(snapshot.getResSolrId());
                    if (mergeContextParams) {
                        mergeSystemParameter(solrConfig);
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return solrConfig;
        }

        @Override
        public UploadResource getSolrSchema() {
            if (this.schema == null && snapshot.getResSchemaId() != null) {
                schema = uploadResourceDao.loadFromWriteDB(snapshot.getResSchemaId());
                if (mergeContextParams) {
                    mergeSystemParameter(schema);
                }
            }
            return schema;
        }
    };
    return domain;
}
Also used : Snapshot(com.qlangtech.tis.manage.biz.dal.pojo.Snapshot) SnapshotDomain(com.qlangtech.tis.manage.common.SnapshotDomain) UploadResource(com.qlangtech.tis.manage.biz.dal.pojo.UploadResource) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

UploadResource (com.qlangtech.tis.manage.biz.dal.pojo.UploadResource)13 SnapshotDomain (com.qlangtech.tis.manage.common.SnapshotDomain)4 RepositoryException (com.qlangtech.tis.manage.common.RepositoryException)2 InputStream (java.io.InputStream)2 ActionProxy (com.opensymphony.xwork2.ActionProxy)1 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)1 Department (com.qlangtech.tis.manage.biz.dal.pojo.Department)1 Snapshot (com.qlangtech.tis.manage.biz.dal.pojo.Snapshot)1 AjaxValve (com.qlangtech.tis.manage.common.valve.AjaxValve)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Date (java.util.Date)1 JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1 JSONTokener (org.json.JSONTokener)1