当前位置: 首页 > news >正文

Polarion工作流插件(自定义)

  1. 创建插件
  2. 命名插件

  3. 配置插件



  4. Condition&Function
    package com.polarion.capital.example.conditions;import com.polarion.alm.tracker.model.IWorkItem;
    import com.polarion.alm.tracker.workflow.IArguments;
    import com.polarion.alm.tracker.workflow.ICallContext;
    import com.polarion.alm.tracker.workflow.ICondition;/*** Each implementation of workflow condition has to implement ICondition class.* This condition will simply count number of comments. The workflow condition* will be successful if the method 'passesCondition' will return true.* * @return true if WI has at least 1 comment, or false otherwise* * @author Michal Antolik*/
    public class ConditionExample implements ICondition {public boolean passesCondition(ICallContext context, IArguments arguments) {IWorkItem wi = context.getWorkItem();return !wi.getApprovals().isEmpty();}}
    public class FunctionExample implements IFunction {static final private long day = 24 * 3600 * 1000L;static final private long hour = 3600 * 1000L;/** (non-Javadoc)* * @see com.polarion.alm.tracker.workflow.IFunction#execute(com.polarion.alm.tracker.workflow.ICallContext,*      com.polarion.alm.tracker.workflow.IArguments)*/public void execute(ICallContext context, IArguments arguments) {String field = arguments.getAsString("field");IWorkItem wi = context.getWorkItem();ICustomField cf = wi.getCustomFieldPrototype(field);if (cf == null) {throw new UserFriendlyRuntimeException("Invalid action parameter: Specified field doesn't exist.");}IType type = cf.getType();if (!(type instanceof IPrimitiveType)|| !(((IPrimitiveType) type).getTypeName().equals("java.lang.String"))) {throw new UserFriendlyRuntimeException("Invalid action parameter: Incorrect field type - expected 'string'");}long creationDate = wi.getCreated().getTime();long now = Calendar.getInstance().getTimeInMillis();long diff = now - creationDate;long days = diff / day;long hours = (diff - days * day) / hour;StringBuffer time = new StringBuffer();if (days > 0) {time.append(days).append(" days ");}if (hours > 0) {time.append(hours).append(" hours");}if (time.length() == 0) {time.append("less than 1 hour");}wi.setCustomField(field, time.toString());}}

    特别注意:<module id="com.polarion.capital.example" version="1.0.0">
    id设置为项目名称,此处如果不设置会导致插件无法正常使用。

  5. 部署插件

    部署地址目录结构参考:E:\programs\Polarion_2304\polarion\extensions\README.txt


  6. 插件使用

    插件部署后,重启Polarion服务才可以使用。

http://www.lryc.cn/news/92588.html

相关文章:

  • JavaScript库:jQuery,简化编程
  • [springboot]菜鸟学习- JdbcTemplate用法浅尝
  • 11.无监督学习之主成分分析
  • 「HTML和CSS入门指南」figcaption 标签详解
  • 电子企业实施数字化工厂建设之前,需要注意哪些
  • 迅捷pdf实现多页插入
  • 调用阿里云API实现证件照生成
  • PHP 转换 excel中读取的时间
  • Cmake工具的简单使用
  • html选择器
  • Leetcode 剑指 Offer II 030. 插入、删除和随机访问都是 O(1) 的容器
  • django实现读取数据导出生成excel表格
  • DevOps系列文章之 Docker-compose
  • Vue Router入门:轻松构建单页应用程序
  • ITSM 如何帮助制造业企业
  • leecode
  • 2023-06-09 LeetCode每日一题(修改图中的边权)<未来补全>
  • Linux 应用程序信号量使用实战
  • 【Java多线程进阶】synchronized工作原理
  • C语言经典题目(三)
  • 九、(补充文章四)Arcgis实现深度学习训练样本数据的批量制作——只靠原图+shp如何批量制作样本图片
  • MKS SERVO4257D 闭环步进电机_系列8 CAN通讯示例
  • UnityVR--组件9--视频组件VideoPlayer
  • Java 深拷贝和浅拷贝
  • [ruby on rails] docker
  • 网络协议——STP协议是什么?是如何实现的?
  • 【C++】智能指针 学习总结 |std::shared_ptr |std::unique_ptr | std::weak_ptr
  • iptables防火墙
  • properties、yaml作为配置文件的特点
  • JavaSE-03 【流程控制语句】