首页 > 其他分享 >Teamcenter AWC 全文检索 运行生成索引命令无效,处理方法1

Teamcenter AWC 全文检索 运行生成索引命令无效,处理方法1

时间:2024-09-19 23:02:16浏览次数:1  
标签:java util 全文检索 Teamcenter static new import AWC public

方法:获取当前时间  执行索引命令 执行成功,写到properties文件中,下次执行,从上次执行的时间开始


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import cn.hutool.setting.dialect.Props;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.StrUtil;


import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class RunSolrIndex {

public static String proPath="/teamcenter/Siemens/Teamcenter14/TcFTSIndexer/conf/TcFtsIndexer_objdata.properties";
public static int runClount=0;
public static Log log = LogFactory.get();
public static int divMinutes=5;
public static String command = "/teamcenter/Siemens/Teamcenter14/TcFTSIndexer/bin/runTcFTSIndexer.sh -task=objdata:index";
public static void main(String[] args) {
try {
cycle1();
} catch (Exception e) {
e.printStackTrace();
}
}

public static void cycle1() throws Exception {
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
runClount++;
System.out.println("runClount: " + runClount);
try {
// 假设你的shell脚本路径是 /path/to/your/script.sh
Date startDate=new Date();
// 使用Runtime执行命令
Process process = Runtime.getRuntime().exec(command);
// 读取脚本输出
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
// 等待脚本执行完成
process.waitFor();
// 获取退出值
int exitValue = process.exitValue();
setTime(startDate);
System.out.println("Exit value: " + exitValue);
} catch (Exception e) {
e.printStackTrace();
log.error(e);
}
}
}, 0, 1000*divMinutes*60);//5分钟
}

public static void setTime(Date date) {
Properties props = new Properties();

try {
// 读取属性文件
props.load(new FileInputStream(proPath));

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");

String formattedDate = sdf.format(date);

props.setProperty("querytimesslicestep.startTime", formattedDate);

// 保存属性到文件
props.store(new FileOutputStream(proPath), null);

} catch (IOException ex) {
ex.printStackTrace();
log.error(ex);
}
}
}

标签:java,util,全文检索,Teamcenter,static,new,import,AWC,public
From: https://www.cnblogs.com/PLM-Teamcenter/p/18421546

相关文章

  • Python的configparser模块中,ConfigParser和RawConfigParser的区别
    在Python的configparser模块中,ConfigParser()和RawConfigParser()是两个不同的类,用于解析配置文件。它们之间的主要区别在于对配置文件中的值进行处理的方式。一、区别1、ConfigParser()类是configparser模块的旧版本,它提供了一些额外的特性,如对配置文件中的值进行插值替换。......
  • SpringBoot+Neo4j+Vue+Es集成ES全文检索、Neo4J知识图谱、Activiti工作流的知识库管理
    在数字化高度普及的时代,企事业机关单位在日常工作中会产生大量的文档,例如医院制度汇编,企业知识共享库等。针对这些文档性的东西,手工纸质化去管理是非常消耗工作量的,并且纸质化查阅难,易损耗,所以电子化管理显得尤为重要。【springboot+elasticsearch+neo4j+vue+activiti】实现数......
  • SpringBoot+Neo4j+Vue+Es集成ES全文检索、Neo4J知识图谱、Activiti工作流的知识库管理
     在数字化高度普及的时代,企事业机关单位在日常工作中会产生大量的文档,例如医院制度汇编,企业知识共享库等。针对这些文档性的东西,手工纸质化去管理是非常消耗工作量的,并且纸质化查阅难,易损耗,所以电子化管理显得尤为重要。【springboot+elasticsearch+neo4j+vue+activiti】实现......
  • OpenCV(cv::drawContours())
    目录1.函数原型2.示例1.函数原型cv::drawContours()用于在图像上绘制轮廓。函数原型:voidcv::drawContours(cv::InputOutputArrayimage,conststd::vector<std::vector<cv::Point>>&contours,intcontourIdx,constc......
  • SpringBoot+Neo4j+Vue+Es集成ES全文检索、Neo4J知识图谱、Activiti工作流的知识库管理
    在数字化高度普及的时代,企事业机关单位在日常工作中会产生大量的文档,例如医院制度汇编,企业知识共享库等。针对这些文档性的东西,手工纸质化去管理是非常消耗工作量的,并且纸质化查阅难,易损耗,所以电子化管理显得尤为重要。【springboot+elasticsearch+neo4j+vue+activiti】实现数......
  • AWC 批量查询使用关系的最新版本并导出Excel
    1.查询使用关系的方法:*调用查询返回数据 *@param{Object}data *@returns{Promise} **/exportletqueryItemRevisionById=function(data){  if(!data.item_id){    messagingService.showInfo("请输入查询条件");    return;  ......
  • AWC通过条件控制 菜单可见
    1.定义条件:"conditions":{    "objectIsSelectedFolder":{      "expression":{        "$source":{          "$adapt":"ctx.selected"        },       ......
  • Teamcenter根据子项ID查询父项的查询配置
    1.选择【ItemRevision】,设置查询的规则:2.点击【提示】3.可以参照说明,一步步配置,也可以直接点击【在树中查找】 4.添加ID到查询条件中5.执行查看结果: ......
  • AWC 添加自定义的页面
    module.json{  "name":"C9PDFQueryList",  "description":"ThisistheC9PDFQueryListmodule"} 2.states.json {  "C9PDFQueryLoc":{    "data":{      "browserTitle&......
  • 谷粒商城实战笔记-115-全文检索-ElasticSearch-进阶-bool复合查询
    文章目录1,must2,mustnot3,should1,must{"query":{"bool":{"must":[{"match":{"gender":"M"}},{"matc......