This project was formerly called "Product Attribute Search and Reporting". It was renamed as a result of (1) bypassing the Product Attribute architecture and (2) extending the concept to BP.
The purpose of this page is to help you understand the design and implementation process of the Object Tagging and Reporting project. This project was born from the conversation labeled "2014-04-15 AM – Open Discussion" starting at 0:26:30.
2014-05-01 PM - Object Tag and Search Introduction, Demonstration and Installation Instructions
Introduction to the project
0:01:00 Tags and Tag Values
0:01:45 Business Partner Tagging
0:03:15 Product Tagging
0:04:15 Tag Search Results
0:11:30 the Where Clause
0:13:30 Adding new tag sources and adding new tag points
------- How to Remove the Plugin - needed so that I can demonstrate how to install later ----------
0:17:45 Stripping out the plugin
0:21:00 Restore the database
0:25:00 Start up the Application Server
0:27:00 Summary of how to export a plugin from Eclipse
0:28:30 Install the Object Tag and Search iDempiere plugin
Create the Source view for M_Storage (ChuBoe_TagSource_Storage_V) (DONE)
Create my ChuBoe_TagSource records (ex: Storage) (DONE)
Create the model for ChuBoe_TagInstance (DONE)
Create the Process to populate the results table (DONE)
Update ChuBoe_TagInstance model to set the AD_Column_ID when any of the 'IDs are not null.
Develop the process to populate the search results table. (DONE)
Iterate across ChuBoe_TagInstance columns to gather the distinct IDs (M_Product_ID, C_BPartner_ID
Update the below query to include the above columns as limiters
ex. m_product_id in (...)
ex. c_bpartner_id in (...)
ex. new_column_id in (...) (just in case someone adds a new column)
Design Document
* Plugin Name *
com.chuboe.objecttag
* Package Name *
com.chuboe.objecttag
* Window/Table Structure *
Business Partner - add subtab
ChuBoe_TagInstance
Product - add subtab
ChuBoe_TagInstance
Tag
ChuBoe_Tag
ChuBoe_TagValue
Tag Source
ChuBoe_TagSource
Search Window
ChuBoe_TagSearch_Param
ChuBoe_TagInstance
ChuBoe_TagSearch_Result
ChuBoe_TagSearch_Result_GroupBy... (create as many as needed - limit visibility by param._Target_ID)
* Table Definition *
ChuBoe_Tag
- Normal Columns
ChuBoe_TagValue
- Normal Columns
- ChuBoe_Tag_ID
ChuBoe_TagInstance
- Normal Columns
- C_BPartner_ID
- M_Product_ID
- ChuBoe_Tag_ID
- ChuBoe_TagValue_ID (limited by Tag_ID relationships)
- ChuBoe_TagSearch_Param_ID
ChuBoe_TagSearch_Param
- Normal Columns
- StartDate
- EndDate
- ChuBoe_TagSource_ID
- SearchStamp
- Do_Search (button)
- isSearchStampChanged
- isIncludeNoAttribute (allows products with no attributes to be included in the results)
ChuBoe_TagSearch_Result (where result.SearchStamp = param.SearchStamp)
- Normal Columns
- ChuBoe_TagSearch_Param_ID
- SearchStamp
- StartDate
- EndDate
- C_BPartner_ID
- C_BP_Group_ID
- M_Product_ID
- M_Product_Category_ID
- C_Order_ID
- C_OrderLine_ID
- C_Invoice_ID
- C_InvoiceLine_ID
- M_Production_ID
- M_ProductionLine_ID
- M_InOut_ID
- M_InOutLine_ID
- Qty
- Amt
ChuBoe_TagSource
- Normal Columns
- AD_Table_ID
* Programming Objects *
- Models for above tables
- Create views to populate _Target records
- Param param.method for creating where clause used to limit _Result records
- Process for creating _Result records
- Param method for creating SearchStamp
Sample Query to Tie Product to Attribute Values
Get Source View from ChuBoe_TagSearch_Param
Get list of Result ColumnNames from T&C for ChuBoe_TagSearch_Result (java List)
Note: assumes the source view represents (has) all columns of ChuBoe_TagSearch_Result
This will be used in the insert statement's VALUES and SELECT list
Issue Delete statement for ChuBoe_TagSearch_Result
Iterate through ChuBoe_TagSearch_Param -> ChuBoe_TagInstance records
Order by AD_Column_ID, ChuBoe_Tag_ID, ChuBoe_TagValue_ID
Create a map
FYI - AD_Column_ID ' s ColumnName (ex: C_BPartner_ID, M_Product_ID).
drives the where clause 'IN' statement (ex: C_BPartner_ID IN ... or M_Product_ID IN ...)
drives the select clause in the sub query (ex: select C_BPartner_ID from ... or select M_Product_ID from ...)
AD_Column_ID and ChuBoe_Tag_ID drive teh sub query's where clause
Said another way, for every unique combination of AD_Column+ID and ChuBoe_Tag_ID, inject a WHERE CLAUSE based on the above logic where you look for the associated ChuBoe_TagValue_IDs. See below example.
delete from chuboe_tagsearch_result;
insert into chuboe_tagsearch_result
select
ad_client_id,
ad_org_id,
null::numeric as amt,
null::numeric as c_bpartner_id,
null::numeric as c_bpartner_location_id,
null::numeric as c_bp_group_id,
1000001::numeric as chuboe_tagsearch_param_id,
null::numeric as c_invoice_id,
null::numeric as c_invoiceline_id,
null::numeric as c_order_id,
null::numeric as c_orderline_id,
created,
createdby,
null::timestamp without time zone as enddate,
'Y' as isactive,
null::numeric as m_inout_id,
null::numeric as m_inoutline_id,
null::numeric as m_product_category_id,
m_product_id,
null::numeric as m_production_id,
null::numeric as m_productionline_id,
qtyonhand as qty,
null::character varying(36) as searchstamp,
null::timestamp without time zone as startdate,
updated,
updatedby
from M_storageonhand
where m_product_id in --driven by AD_Column_ID
(
select m_product_id --driven by AD_Column_ID
from chuboe_taginstance
where ad_column_id = 1000124
and chuboe_tag_id = 1000000 --driven by ChuBoe_Tag_ID
and chuboe_tagvalue_id in (1000005, 1000006) --driven by collection of ChuBoe_TagValue_IDs
)
and m_product_id in --example of same AD_Column_ID, different ChuBoe_Tag_ID and ChuBoe_TagValue_IDs
(
select m_product_id
from chuboe_taginstance
where ad_column_id = 1000124
and chuboe_tag_id = 1000001
and chuboe_tagvalue_id in (1000002)
);
Instructions to Add a new Tag Type
Add the new column to ChuBoe_TagInstance (ex: C_BPartner_Location_ID)
Add a new Tag tab below the appropriate tab (ex: Add Tag tab below BP window --> Location tab)
Instructions to Add a new Tag Source
Create a new view similar to ChuBoe_TagSource_Storage_V
Create a new Tag Source record and point it to your new view (above)
2014-04-17 PM Topic Introduction Meeting
2014-04-22 AM - Object Tag and Report Design Review - Session #2