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);
}
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;
}
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);
}
}
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()));
}
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;
}
Aggregations