Workflow 人機簽核分流

Short Code:[SYSTEM]

Workflow 除了員工進行審核,確認. 許多結點(Node)也會配合自動化設備自動執待.等待系統完成工作後.自動推動Workflow.為了避免人員誤觸系統確認結點. 在結點名字定義一組 Short Code [SYSTEM], 人員簽核畫面會自動過濾, 避免誤觸.

	private String getWhereActivities() {
		final String where =
			"a.Processed='N' AND a.WFState='OS' "
			+ " AND (EXISTS (select * from AD_WF_Node wfn where "
					+ " a.AD_WF_Node_ID = wfn.AD_WF_Node_ID "
					+ " and  not ( substring(wfn.name,1,8) = '[SYSTEM]' and wfn.action = 'Z' ) ) )"
			
			+ " AND ("
			//	Owner of Activity
			+ " a.AD_User_ID=?"	//	#1
			//	Invoker (if no invoker = all)
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))"	//	#2
			//  Responsible User
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND r.AD_User_ID=?)"		//	#3
			//	Responsible Role
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)"
			+ " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType='R' AND ur.AD_User_ID=? AND ur.isActive = 'Y')"	//	#4
			///* Manual Responsible */ 
			+ " OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r "
			+ " WHERE a.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=? AND r.isActive = 'Y')" 
			+ ") AND a.AD_Client_ID=?";	//	#5
		return where;
	}
發表留言

MySQL Quickly set up in 4 step

Create Database

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

Create New User

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Set Permission

GRANT ALL PRIVILEGES ON mydatabase. * TO 'newuser'@'localhost';

Refresh Privileges

FLUSH PRIVILEGES;
發表留言

Raspberry Pi 使用DDNS應用

  1. 至Gandi申請APIKEY
  2. 將下述程式碼存成bash script 並設定排程即可
#!/bin/sh
ip=$(/sbin/ifconfig ppp0 | grep 'inet' | cut -d: -f2 | awk '{ print $2}')
APIKEY="你Gandi的API KEY"
DOMAIN="你的domain"
HOST="你要更新的主機名稱,不含domain"
echo "pppoe IP: $ip"
lastip=$(cat /home/pi/lastip)
if [ -z $lastip ]
then
   lastip="0.0.0.0"
fi

if [ "$ip" != "$lastip" ]
then
curl -X PUT -H "Content-Type: application/json"\
     -H "X-Api-Key:$APIKEY"\
     -d '{"rrset_name":"'$HOST'",
        "rrset_type":"A",
	"rrset_ttl":300,
	"rrset_values": ["'$ip'"]}'\
	https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records/$HOST/A
	echo "\n"
    
     echo $ip > /home/pi/lastip	
else
     echo "no change"

fi

發表留言