Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Thai

คำถามและขั้นตอนต่อไปนี้เพื่อช่วยคุณวางแผนและพัฒนาปลั๊กอินเพื่อตอบสนองความต้องการที่กำหนดเอง

Table of Contents

1. What is the problem?

Thai

อะไรคือปัญหา?

English
You have a custom requirement and you found that none of the built-in plugins provided by Joget Workflow nor plugins available in Marketplace are able to fulfill your requirement. 
Thai

คุณมีข้อกำหนดที่กำหนดเองและคุณพบว่าไม่มีปลั๊กอินในตัวที่หาให้โดย Joget Workflow หรือปลั๊กอินที่มีอยู่ใน Marketplace สามารถตอบสนองความต้องการของคุณได้

...

Thai

ตัวอย่างที่ 3: ตัวแปรแฮชใช้งานได้สะดวก แต่ไม่สามารถตรวจสอบสภาพได้

2. How to solve the problem?

Thai

วิธีแก้ปัญหา

Refer to the Plugin Types that are supported by Joget Workflow, find the most appropriate plugin type that can help you to fulfill the custom requirement.

...

Thai

ตัวอย่างที่ 3: พัฒนาปลั๊กอิน Hash Variable ที่สามารถเขียนสคริปต์ Bean Shell ได้

3. What is the input needed for your plugin?

Thai

สิ่งที่จำเป็นในการป้อนข้อมูลสำหรับปลั๊กอินของคุณ?

Find out what information are needed by your plugin to function/work. Look at it from the user's perspective; how are you going to use the plugin. Then, look at it from a developer's perspective; to make the plugin reusable in more use cases.

...

E.g. #beanshell.EnvironmentVariableKey[name=Joget&email=info@joget.org&message={form.sample.message?url}]#

4. What is the output and expected outcome of your plugin?

Thai

ผลลัพธ์และผลลัพธ์ที่คาดหวังของปลั๊กอินของคุณคืออะไร?

How and what a normal user (Not the admin user who use the plugin to provide functionality) will use and see your plugin result.

...

Thai

ตัวอย่างที่ 3: ปลั๊กอิน Bean Shell Hash สำหรับผู้ดูแลระบบ เมื่อมีการใช้งานตัวแปรแฮชจะถูกแทนที่ด้วยการส่งคืนผลลัพธ์จาก Bean Shell

5. Are there any resources/API that can be reused?

Thai

มีทรัพยากร / API ที่สามารถนำกลับมาใช้ใหม่ได้หรือไม่?

Always refer to existing plugins and tutorials to look for a similar plugin/plugin type that you can refer to whenever possible.  The Joget team will try their best to enrich the contents in the tutorials section.

...

Thai

Example 3: การพัฒนาปลั๊กอิน Bean Shell Hash Variable เราสามารถอ้างอิง source code ของปลั๊กอิน Hash Variable และปลั๊กอิน Bean Shell ทั้งหมด โดยเฉพาะอย่างยิ่งเราสามารถอ้างถึงปลั๊กอินตัวแปรสภาพแวดล้อมของแฮชตัวแปรในการเรียกข้อมูลตัวแปรสภาพแวดล้อมโดยใช้คีย์ตัวแปร นอกจากนี้เรายังสามารถอ้างอิงถึง Bean Shell Tool หรือปลั๊กอิน Bean Binder ของ Form Shell เกี่ยวกับสิ่งที่เรียกใช้งานสคริปต์ด้วยล่าม Bean Shell

6. Prepare your development environment

Thai

เตรียมสภาพแวดล้อมการพัฒนาของคุณ

a. You will need to have the Joget Open Source ready and built. We will use the "wflow-plugin-archetype" module to generate a maven project for our plugin.

...

c. Open/Import the maven project with your favorite IDE. Joget team recommends NetBeans IDE.  

7. Just code it!

Thai

เพียงแค่รหัส!

a. Extending the abstract class of a plugin type

Thai

การขยายคลาสนามธรรมของประเภทปลั๊กอิน

Refer to the document of the plugin type listed in Plugin Types. Find the abstract class and interface that need to be extended and implemented by your plugin.

...

Thai

อ้างถึงเอกสารประเภทปลั๊กอินที่ระบุไว้ใน Plugin Types ค้นหาคลาสนามธรรมและอินเทอร์เฟซที่ต้องขยายและนำไปใช้โดยปลั๊กอิน

ตัวอย่าง: ในการพัฒนา Userview Menu plugin คลาสปลั๊กอินจำเป็นต้องขยายคลาสนามธรรม org.joget.apps.userview.model.UserviewMenu

b. Implement all the abstract methods

Thai

ใช้วิธีนามธรรมทั้งหมด

A plugin will have to implements the abstract method of Plugin Base Abstract Class and Interface and also the abstract method of the individual abstract class and interface for the plugin type. 

...

  • getCategory
  • getClassName
  • getDecoratedMenu
  • getDescription
  • getIcon
  • getLabel
  • getName
  • getPropertyOptions
  • getRenderPage
  • getVersion
  • isHomePageSupported

c. Manage the dependency libraries of your plugin

Thai

จัดการไลบรารีการพึ่งพาของปลั๊กอินของคุณ

The generated plugin folder by "wflow-plugin-archetype" module is a maven project. So, we will using the Dependency Mechanism provided by Maven.

Thai

โฟลเดอร์ปลั๊กอินที่สร้างขึ้นโดยโมดูล "wflow-plugin-archetype" เป็นโครงการ maven ดังนั้นเราจะใช้ Dependency Mechanism ที่ Maven จัดหาให้

d. Make your plugin internationalization (i18n) ready

Thai

เตรียมปลั๊กอินสากลให้พร้อม (i18n)

To make the plugin i18n ready, we need to create a message resource bundle property file for the plugin.

...

Code Block
languagejava
public void start(BundleContext context) {
    registrationList = new ArrayList<ServiceRegistration>();

    //Register plugin here
    registrationList.add(context.registerService(MyPlugin.class.getName(), new MyPlugin(), null));
}

f. Build it and testing

Thai

สร้างและทดสอบ

Once you are done with all the steps above, you can build your project with your IDE using Maven. You can also run "mvn clean install" command in your project directory to build it. After building your project, a jar file is created under "target" folder in your plugin project folder. Upload the plugin jar to Manage Plugins to test your plugin.

...

Thai

เมื่อคุณทำตามขั้นตอนทั้งหมดข้างต้นเสร็จแล้วคุณสามารถสร้างโครงการของคุณด้วย IDE ของคุณโดยใช้ Maven คุณยังสามารถเรียกใช้คำสั่ง "mvn clean install" ในไดเรกทอรีโครงการของคุณเพื่อสร้าง หลังจากสร้างโครงการของคุณไฟล์ jar จะถูกสร้างขึ้นภายใต้โฟลเดอร์ "ปลายทาง" ในโฟลเดอร์โครงการปลั๊กอินของคุณ อัปโหลดโถปลั๊กอินไปที่ Manage Plugins เพื่อทดสอบปลั๊กอินของคุณ

ตัวอย่าง: ใน NetBeans คลิกขวาที่ชื่อโครงการจากนั้นเลือก "ล้างและสร้าง"


8. Take a step further, share it or sell it

Thai

ก้าวไปอีกขั้นแบ่งปันหรือขายมัน

You have completed a very useful plugin. Don't just keep it to yourself, share or sell your plugin in the Joget Marketplace or even better, you can write a tutorial in our Knowledge Base to share your effort with others. To share or sell your plugin, please send an email to info@joget.org.

...