package ext.huyx.integration.classification.test; import java.lang.reflect.InvocationTargetException; import java.rmi.RemoteException; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Set; import com.ptc.core.lwc.client.util.PropertyDefinitionHelper; import com.ptc.core.lwc.common.AttributeTemplateFlavor; import com.ptc.core.lwc.common.view.PropertyDefinitionReadView; import com.ptc.core.lwc.common.view.PropertyValueReadView; import com.ptc.core.lwc.common.view.PropertyValueWriteView; import com.ptc.core.lwc.common.view.TypeDefinitionReadView; import com.ptc.core.lwc.common.view.TypeDefinitionWriteView; import com.ptc.core.lwc.server.LWCStructEnumAttTemplate; import com.ptc.core.lwc.server.TypeDefinitionServiceHelper; import com.ptc.core.lwc.server.cache.TypeDefinitionManager; import ext.huyx.integration.classification.util.ClassificationUtil; import wt.fc.ObjectIdentifier; import wt.httpgw.GatewayAuthenticator; import wt.method.RemoteAccess; import wt.method.RemoteMethodServer; public class CTest implements RemoteAccess { public static void main(String[] args) throws RemoteException, InvocationTargetException { RemoteMethodServer rms = RemoteMethodServer.getDefault(); GatewayAuthenticator auth = new GatewayAuthenticator(); auth.setRemoteUser("wcadmin"); rms.setAuthenticator(auth); rms.invoke("test2", CTest.class.getName(), null, null, null); } public static void test2() throws Exception { String internalName = "relay11";// 节点内部值 Map<Locale, String> displayNameMap = new HashMap<Locale, String>(); displayNameMap.put(Locale.CHINA, "继电器"); displayNameMap.put(Locale.ENGLISH, "Relay"); displayNameMap.put(Locale.US, "Relay"); Map<String, Object> values = new HashMap<String, Object>(); values.put("keywords", "关键字"); values.put("displayName", displayNameMap); values.put("description", "说明"); values.put("instantiable", "true"); values.put("sort_order", "1"); LWCStructEnumAttTemplate lwc = ClassificationUtil.getClassificationByInternalName(internalName);//获取分类节点对象的api TypeDefinitionReadView typeDefReadView = null; if (lwc != null) { ObjectIdentifier lwcOid = lwc.getPersistInfo().getObjectIdentifier(); typeDefReadView = TypeDefinitionManager.getTypeDefinitionManagerInstance().getTypeDefView(AttributeTemplateFlavor.LWCSTRUCT, lwcOid.getId()); } TypeDefinitionWriteView typeDefWriteView = typeDefReadView.getWritableView(); Set<PropertyDefinitionReadView> propertyDefs = TypeDefinitionServiceHelper.service .getAllPropertyDefViews("com.ptc.core.lwc.server.LWCStructEnumAttTemplate", typeDefReadView.getReadViewIdentifier()); for (PropertyDefinitionReadView propertyDefView : propertyDefs) { if (propertyDefView.isHidden() || propertyDefView.isContentHolder()) { continue; } String propertyDefName = propertyDefView.getName(); PropertyValueReadView currentPropertyValue = typeDefReadView.getPropertyValueByName(propertyDefName); PropertyValueWriteView propValueWriteView = (currentPropertyValue == null) ? null : currentPropertyValue.getWritableView(); Object value = values.get(propertyDefName); String newPropertyValue = ""; Map<Locale, String> localMap = null; if (value == null) { newPropertyValue = ""; } else if (value instanceof String) { newPropertyValue = values.get(propertyDefName).toString(); } else if (value instanceof Map) { localMap = (Map<Locale, String>) value; newPropertyValue = localMap.get(Locale.CHINA); } boolean createNewValue = PropertyDefinitionHelper.updatePropertyValue(propertyDefView, null, propValueWriteView, newPropertyValue, localMap, false); if (createNewValue) { propValueWriteView = new PropertyValueWriteView(null, propertyDefView, newPropertyValue, localMap, null, false, null, false); } if (propValueWriteView != null && values.get(propertyDefName) != null) { typeDefWriteView.setProperty(propValueWriteView); } } typeDefReadView = TypeDefinitionServiceHelper.service.updateTypeDef(typeDefWriteView); } }
Android 哪些系统应用没法禁用(即哪些应用的禁用按钮是灰选)?
AJAX & AXIOS-2024/11/1
验证码处理在自动化测试中的应用
Java,启动!
2024/11/1日 日志 关于JavaScript简介&引入方式 以及基础语法的学习
android 13 更改手机信号调整
BFS(Breath First Search 广度优先搜索)
Angular 18 上手开发
单链表题+数组题(快慢指针和左右指针)
MySQL和Easy-Es语法对照表
DevOp相关
CSRF攻击与防御
华为云开源项目Sermant正式成为CNCF官方项目
spring-boot-configuration-processor无法生效
给网站添加春节灯笼效果:引入即用,附源码!
如何在鲲鹏平台上快速上手应用开发?鲲鹏DevKit给你答案
程序员的修炼之路
Java-中文官方教程-2022-版-一-
Java-中文官方教程-2022-版-五-
Java-中文官方教程-2022-版-四-
step7 V5.x上的SCL
yolo --- 核心思想
【游记】CCPC 济南 2024 游记
一些学科笑话
NOIP2024模拟赛20 & 11.1 小记
20241101 数据结构与算法期中机试收获
什么是IT技术
即将到来!
舍得-时间-工作是人的一生最重要的事情-自己要有私房钱-人的一生最重要的事情是书写自己的人生
2.TiUP 部署 DM 集群
原型模式的C++实现
python bytecode解析
09-XSS键盘监听、cookie窃取&文件上传绕过
ubuntu 24.04 部署 mysql 8.4.3 LTS
国标GB28181公网平台LiteGBS国标GB28181视频平台建筑工地无线视频联网监控系统方案
imes完工下线
Ethernaut Level 11: Elevator Attack and Blockchain Interaction
快速部署开源spug运维平台的Docker安装指南
驱动调试之printk的原理与使用
计算机思维模型及其应用
华为云发布代码大模型PanGu-Coder2,实现高效代码生成
Linux多硬盘数据存储和分区操作
构建高可用架构: 分层冗余与自动故障转移
LoRA:高效调参的大语言模型适应方法
《分布式系统的基本原理及互联网分层架构的本质》
Hadoop写流程解析
Java架构师的系统架构设计方法论中的规范要点
使用observeDOM解决BetterScroll插件在移动端无法滑动的问题
互联网一致性架构设计实践
高并发系统架构与水平扩展
混合应用的崛起:跨平台开发取代原生应用