Search in sources :

Example 1 with X_M_AttributeSearch

use of org.compiere.model.X_M_AttributeSearch in project adempiere by adempiere.

the class ImportProductASI method getAttribute.

private MAttribute getAttribute(X_I_Product_ASI ip_asi) {
    MAttribute attribute = null;
    int attributeId = getID(MAttribute.Table_Name, MAttribute.COLUMNNAME_Name + "=?", ip_asi.getAttributeName());
    if (attributeId <= 0) {
        attribute = new MAttribute(ip_asi.getCtx(), 0, ip_asi.get_TrxName());
        attribute.setName(ip_asi.getAttributeName());
        attribute.setIsMandatory(ip_asi.isMandatory());
        attribute.setAttributeValueType(ip_asi.getAttributeValueType());
        attribute.setIsMandatory(ip_asi.isMandatory());
        attribute.saveEx();
    } else {
        attribute = new MAttribute(getCtx(), attributeId, get_TrxName());
    }
    if (ip_asi.getAttributeSearchName() != null) {
        X_M_AttributeSearch attributeSearch = (X_M_AttributeSearch) getAttributeSearch(ip_asi);
        attribute.setM_AttributeSearch_ID(attributeSearch.get_ID());
        attribute.saveEx();
        ip_asi.setM_AttributeSearch_ID(attributeSearch.get_ID());
        ip_asi.saveEx();
    }
    if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(ip_asi.getAttributeValueType())) {
        getAttributeValue(attribute, ip_asi);
    }
    return attribute;
}
Also used : X_M_AttributeSearch(org.compiere.model.X_M_AttributeSearch) MAttribute(org.compiere.model.MAttribute)

Example 2 with X_M_AttributeSearch

use of org.compiere.model.X_M_AttributeSearch in project adempiere by adempiere.

the class ImportProductASI method getAttributeSearch.

private I_M_AttributeSearch getAttributeSearch(X_I_Product_ASI ip_asi) {
    X_M_AttributeSearch asearch = null;
    int attributeSearchId = getID(I_M_AttributeSearch.Table_Name, I_M_AttributeSearch.COLUMNNAME_Name + "=?", ip_asi.getAttributeSearchName());
    if (attributeSearchId <= 0) {
        asearch = new X_M_AttributeSearch(getCtx(), 0, get_TrxName());
        asearch.setName(ip_asi.getAttributeSearchName());
        asearch.saveEx();
        ip_asi.setM_AttributeSearch_ID(asearch.get_ID());
        ip_asi.saveEx();
    } else {
        asearch = new X_M_AttributeSearch(getCtx(), attributeSearchId, get_TrxName());
    }
    return asearch;
}
Also used : X_M_AttributeSearch(org.compiere.model.X_M_AttributeSearch)

Aggregations

X_M_AttributeSearch (org.compiere.model.X_M_AttributeSearch)2 MAttribute (org.compiere.model.MAttribute)1