Ninja Kanban

The migration of Adempiere modules to iDempiere

Ninja Kanban

Postby red1 » Sun Jun 10, 2018 10:32 am

I made the Kanban board creation in Ninja to allow core models such as C_Order to be done instantly too. Using the SQLWhere in Kanban Board Configuration you can later segregate it for Sales or Purchases.

CoreModelKanban.png (58.54 KiB) Viewed 5180 times
To produce the above, just have Ninja plugin installed and go to the Model Maker tab and put in the C_Order name, check KanbanBoard box, and press GenerateModule at the Module Designer header tab. Takes hardly 2 secs. Then login to your active client to view your ready made C_Order KanbanBoard. Tweaking it is easier with the puffy work done.

KanbanGenerate.png (64.18 KiB) Viewed 5180 times
Use the Ninja plugin even as a binary without going to source in Eclipse. For source, here source or binary(org.red1.ninja_4.1.0.<timestamp>.jar)
After generating the kanban board, switch from the Ninja plugin to Diego's modified kanbanboard plugin which is slightly changed to work with the core models. That modified kanban is also in my same binary location. You can do the switch via the Felix Console or the ss console as shown in the movie here.

When you wish to handle kanban board that are not core as viewtopic.php?f=45&t=1848#p8947, then switch back to the Ninja plugin and stop Diego's plugin.

Steps in summary for Standard Documents Kanban Generation:
1. Start Ninja.
2. Generate Kanban Board
3. Stop Ninja
4. Start KanbanBoard
5. Restart to your client and use your new kanban board.
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Ninja Kanban - Power of Separation

Postby red1 » Tue Jun 19, 2018 9:24 am

Now we arrived at the ultimate meaning of the phrase 'Separation of Concern' in Java Object Oriented practice. The power of using OSGi is to separate implementations of particular functionaity from the core of the application. Here i demonstrate a truly clean purist approach to really separate details on a sample Kanban Board. I mean absolutely clean decoupling of optional plugins. This will maximise zero maintenance of the core and vertical layer plugins.

The Kanban Board is a separate fork plugin of the original Kanban board within my 'ninja' and is used by another WMS plugin. I then 'freeze' these and implement different behaviour of Document Actions such as Invalidation or Close of the HandlingUnit Document within a new plugin 'red1.kanban'.

The new plugin DocEvent implementation is as below.

KanbanDocEvent.png (273.04 KiB) Viewed 5093 times
The testing is done as in this movie.

For the other 7 document actions to work i have submitted this tracker for core change consideration
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Re: Ninja Kanban

Postby red1 » Tue Oct 23, 2018 8:46 pm

I have simplified absolutely where WMS is no longer dependent on custom DocAction and DocumentEngine. This is noted at end of

Now i committed and pushed a brand new kanban sample you can reuse to just craft any DocStatus movement without concern of ModelValidator core constraints. See the sample RD_HandlerDocEvent class to understand

Code: Select all
   protected void doHandleEvent(Event event) {
      String type = event.getTopic();
      if (type.equals(IEventTopics.DOCACTION)) {
          DocActionEventData eventData = getEventData(event);
          if (eventData.po instanceof MRD_Handler) {
                MRD_Handler model = (MRD_Handler) eventData.po;
                String docStatus = model.getDocStatus(); //from KanbanStatus
               String newStatus = eventData.docStatus; //to new KanbanStatus
               //choose your preferred action against the intended status
               if (docStatus.equals(DocAction.STATUS_Completed) && newStatus.equals(DocAction.STATUS_Closed)){
                  //TODO fill in your logic before assigning new status
                  if (model.getName().equals("Good"))
                     eventData.orderType = "Tell the world what happened here!";//customize your exception message   
                  model.setDocStatus(newStatus);//if no condition then let thru successfully
               //end of your logic

This relies on your Kanban Board created by Ninja and must have Ninja plugin active when running the Kanban. I forked Diego Ruiz's MKanbanCard class to free up from the Model.ProcessIt method:

Code: Select all
               //TODO trigger EventHandler but do we need to go thru its valid actions?
               DocActionEventData eventData = new DocActionEventData(newStatusValue, null, "", "", m_po.get_Table_ID(),new ArrayList<String>(Arrays.asList(p_docAction)), new ArrayList<String>(Arrays.asList(new String[14])),new AtomicInteger(0), m_po);
               Event event = EventManager.newEvent(IEventTopics.DOCACTION,new EventProperty(EventManager.EVENT_DATA, eventData),new EventProperty("tableName", m_po.get_TableName()));
               if ((m_po.get_Value("DocStatus")).equals(newStatusValue)) {
               } else {
                  KDB_ErrorMessage = eventData.orderType;//you can pass a customized exception message from the plugin event handler
                  throw new IllegalStateException();
Site Admin
Posts: 2762
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Return to iDempiere

Who is online

Users browsing this forum: No registered users and 1 guest