public final <T extends AItemSpecifics<?, ?>> void updateGoodsSpecificsInList(
    final Map<String, Object> pReqVars, final SettingsAdd pSettingsAdd, final T pOutdGdSp,
      final ItemInList pItemInList, final SpecificsOfItemGroup pSpecificsOfItemGroupWas,
        final List<I18nSpecificInList> pI18nSpecInListLst, final List<I18nSpecificsOfItem> pI18nSpecLst,
          final List<I18nChooseableSpecifics> pI18nChSpecLst, final List<I18nUnitOfMeasure> pI18nUomLst) throws Exception {
    String val1 = "";
    String val2 = "";
    @SuppressWarnings("unchecked")
    List<LangPreferences> langPreferences = (List<LangPreferences>) pReqVars.get("langPreferences");
    LangPreferences currLp = langPreferences.get(0);
    for (LangPreferences lp : langPreferences) {
      if (lp.getIsDefault()) {
        currLp = lp;
        break;
      }
    }
    if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.TEXT)) {
      //i18n not implemented, use chooseable specifics instead
      val1 = pOutdGdSp.getStringValue1();
    } else if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.BIGDECIMAL)) {
      val1 = srvNumberToString.print(pOutdGdSp.getNumericValue1().toString(),
        currLp.getDecimalSep().getItsId(), currLp.getDecimalGroupSep().getItsId(),
          Integer.valueOf(pOutdGdSp.getLongValue1().intValue()), currLp.getDigitsInGroup());
      if (pOutdGdSp.getStringValue1() != null) {
        val2 = pOutdGdSp.getStringValue1();
      }
    } else if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.INTEGER)) {
      val1 = pOutdGdSp.getLongValue1().toString();
      if (pOutdGdSp.getStringValue1() != null) {
        val2 = pOutdGdSp.getStringValue1();
      }
    } else if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.CHOOSEABLE_SPECIFICS)) {
      val1 =  pOutdGdSp.getStringValue1();
    } else {
      return;
    }
    String templateDetail;
    if (pOutdGdSp.getSpecifics().getTempHtml() != null) {
      templateDetail = pOutdGdSp.getSpecifics().getTempHtml().getHtmlTemplate();
    } else if (pOutdGdSp.getSpecifics().getItsGroop() != null && pOutdGdSp.getSpecifics().getItsGroop().getTemplateDetail() != null) {
      templateDetail = pOutdGdSp.getSpecifics().getItsGroop().getTemplateDetail().getHtmlTemplate();
    } else {
      templateDetail = " <b>:SPECNM:</b> :VAL1:VAL2";
    }
    String spdet = templateDetail.replace(":SPECNM", pOutdGdSp.getSpecifics().getItsName());
    spdet = spdet.replace(":VAL1", val1);
    spdet = spdet.replace(":VAL2", val2);
    if (pOutdGdSp.getSpecifics().getItsGroop() != null && pSpecificsOfItemGroupWas != null
      && pOutdGdSp.getSpecifics().getItsGroop().getItsId().equals(pSpecificsOfItemGroupWas.getItsId())) {
      pItemInList.setSpecificInList(pItemInList.getSpecificInList() + pSettingsAdd.getSpecSeparator() + spdet);
    } else {
      pItemInList.setSpecificInList(pItemInList.getSpecificInList() + spdet);
    }
    if (pI18nSpecInListLst != null) {
      for (I18nSpecificInList i18nspl : pI18nSpecInListLst) {
        for (LangPreferences lp : langPreferences) {
          if (lp.getLang().getItsId().equals(i18nspl.getLang().getItsId())) {
            currLp = lp;
            break;
          }
        }
        if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.BIGDECIMAL)) {
          val1 = srvNumberToString.print(pOutdGdSp.getNumericValue1().toString(),
            currLp.getDecimalSep().getItsId(), currLp.getDecimalGroupSep().getItsId(),
              Integer.valueOf(pOutdGdSp.getLongValue1().intValue()), currLp.getDigitsInGroup());
        }
        if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.BIGDECIMAL)
          || pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.INTEGER)
            && pOutdGdSp.getLongValue2() != null) {
          UnitOfMeasure uom = new UnitOfMeasure();
          uom.setItsName(pOutdGdSp.getStringValue1());
          uom.setItsId(pOutdGdSp.getLongValue2());
          val2 = findUomName(pI18nUomLst, uom, i18nspl.getLang());
        } else if (pOutdGdSp.getSpecifics().getItsType().equals(ESpecificsItemType.CHOOSEABLE_SPECIFICS)) {
          ChooseableSpecifics sp = new ChooseableSpecifics();
          sp.setItsName(pOutdGdSp.getStringValue1());
          sp.setItsId(pOutdGdSp.getLongValue1());
          val1 =  findChSpecName(pI18nChSpecLst, sp, i18nspl.getLang());
        }
        spdet = templateDetail.replace(":SPECNM", findSpecName(pI18nSpecLst, pOutdGdSp.getSpecifics(), i18nspl.getLang()));
        spdet = spdet.replace(":VAL1", val1);
        spdet = spdet.replace(":VAL2", val2);
        if (pOutdGdSp.getSpecifics().getItsGroop() != null && pSpecificsOfItemGroupWas != null
          && pOutdGdSp.getSpecifics().getItsGroop().getItsId().equals(pSpecificsOfItemGroupWas.getItsId())) {
          i18nspl.setSpecificInList(i18nspl.getSpecificInList() + pSettingsAdd.getSpecSeparator() + spdet);
        } else {
          i18nspl.setSpecificInList(i18nspl.getSpecificInList() + spdet);
        }
      }
    }
  }
public final < T extends AItemSpecifics < ? , ? > > void updateGoodsSpecificsInList ( final Map < String , Object > pReqVars , final SettingsAdd pSettingsAdd , final T pOutdGdSp , final ItemInList pItemInList , final SpecificsOfItemGroup pSpecificsOfItemGroupWas , final List < I18nSpecificInList > pI18nSpecInListLst , final List < I18nSpecificsOfItem > pI18nSpecLst , final List < I18nChooseableSpecifics > pI18nChSpecLst , final List < I18nUnitOfMeasure > pI18nUomLst ) throws Exception { String val1 = "" ; String val2 = "" ; @ SuppressWarnings ( "unchecked" ) List < LangPreferences > langPreferences = ( List < LangPreferences > ) pReqVars . get ( "langPreferences" ) ; LangPreferences currLp = langPreferences . get ( 0 ) ; for ( LangPreferences lp : langPreferences ) { if ( lp . getIsDefault ( ) ) { currLp = lp ; break ; } } if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . TEXT ) ) { val1 = pOutdGdSp . getStringValue1 ( ) ; } else if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . BIGDECIMAL ) ) { val1 = srvNumberToString . print ( pOutdGdSp . getNumericValue1 ( ) . toString ( ) , currLp . getDecimalSep ( ) . getItsId ( ) , currLp . getDecimalGroupSep ( ) . getItsId ( ) , Integer . valueOf ( pOutdGdSp . getLongValue1 ( ) . intValue ( ) ) , currLp . getDigitsInGroup ( ) ) ; if ( pOutdGdSp . getStringValue1 ( ) != null ) { val2 = pOutdGdSp . getStringValue1 ( ) ; } } else if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . INTEGER ) ) { val1 = pOutdGdSp . getLongValue1 ( ) . toString ( ) ; if ( pOutdGdSp . getStringValue1 ( ) != null ) { val2 = pOutdGdSp . getStringValue1 ( ) ; } } else if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . CHOOSEABLE_SPECIFICS ) ) { val1 = pOutdGdSp . getStringValue1 ( ) ; } else { return ; } String templateDetail ; if ( pOutdGdSp . getSpecifics ( ) . getTempHtml ( ) != null ) { templateDetail = pOutdGdSp . getSpecifics ( ) . getTempHtml ( ) . getHtmlTemplate ( ) ; } else if ( pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) != null && pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) . getTemplateDetail ( ) != null ) { templateDetail = pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) . getTemplateDetail ( ) . getHtmlTemplate ( ) ; } else { templateDetail = " <b>:SPECNM:</b> :VAL1:VAL2" ; } String spdet = templateDetail . replace ( ":SPECNM" , pOutdGdSp . getSpecifics ( ) . getItsName ( ) ) ; spdet = spdet . replace ( ":VAL1" , val1 ) ; spdet = spdet . replace ( ":VAL2" , val2 ) ; if ( pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) != null && pSpecificsOfItemGroupWas != null && pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) . getItsId ( ) . equals ( pSpecificsOfItemGroupWas . getItsId ( ) ) ) { pItemInList . setSpecificInList ( pItemInList . getSpecificInList ( ) + pSettingsAdd . getSpecSeparator ( ) + spdet ) ; } else { pItemInList . setSpecificInList ( pItemInList . getSpecificInList ( ) + spdet ) ; } if ( pI18nSpecInListLst != null ) { for ( I18nSpecificInList i18nspl : pI18nSpecInListLst ) { for ( LangPreferences lp : langPreferences ) { if ( lp . getLang ( ) . getItsId ( ) . equals ( i18nspl . getLang ( ) . getItsId ( ) ) ) { currLp = lp ; break ; } } if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . BIGDECIMAL ) ) { val1 = srvNumberToString . print ( pOutdGdSp . getNumericValue1 ( ) . toString ( ) , currLp . getDecimalSep ( ) . getItsId ( ) , currLp . getDecimalGroupSep ( ) . getItsId ( ) , Integer . valueOf ( pOutdGdSp . getLongValue1 ( ) . intValue ( ) ) , currLp . getDigitsInGroup ( ) ) ; } if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . BIGDECIMAL ) || pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . INTEGER ) && pOutdGdSp . getLongValue2 ( ) != null ) { UnitOfMeasure uom = new UnitOfMeasure ( ) ; uom . setItsName ( pOutdGdSp . getStringValue1 ( ) ) ; uom . setItsId ( pOutdGdSp . getLongValue2 ( ) ) ; val2 = findUomName ( pI18nUomLst , uom , i18nspl . getLang ( ) ) ; } else if ( pOutdGdSp . getSpecifics ( ) . getItsType ( ) . equals ( ESpecificsItemType . CHOOSEABLE_SPECIFICS ) ) { ChooseableSpecifics sp = new ChooseableSpecifics ( ) ; sp . setItsName ( pOutdGdSp . getStringValue1 ( ) ) ; sp . setItsId ( pOutdGdSp . getLongValue1 ( ) ) ; val1 = findChSpecName ( pI18nChSpecLst , sp , i18nspl . getLang ( ) ) ; } spdet = templateDetail . replace ( ":SPECNM" , findSpecName ( pI18nSpecLst , pOutdGdSp . getSpecifics ( ) , i18nspl . getLang ( ) ) ) ; spdet = spdet . replace ( ":VAL1" , val1 ) ; spdet = spdet . replace ( ":VAL2" , val2 ) ; if ( pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) != null && pSpecificsOfItemGroupWas != null && pOutdGdSp . getSpecifics ( ) . getItsGroop ( ) . getItsId ( ) . equals ( pSpecificsOfItemGroupWas . getItsId ( ) ) ) { i18nspl . setSpecificInList ( i18nspl . getSpecificInList ( ) + pSettingsAdd . getSpecSeparator ( ) + spdet ) ; } else { i18nspl . setSpecificInList ( i18nspl . getSpecificInList ( ) + spdet ) ; } } } }
<p>Update ItemInList.SpecificInList with outdated GoodsSpecifics.</p>
@param <T> item specifics type
@param pReqVars additional param
@param pSettingsAdd SettingsAdd
@param pOutdGdSp outdated GoodsSpecifics
@param pItemInList ItemInList
@param pSpecificsOfItemGroupWas SpecificsOfItemGroup previous
@param pI18nSpecInListLst I18nSpecificInList list
@param pI18nSpecLst I18nSpecificsOfItem list
@param pI18nChSpecLst I18nChooseableSpecifics list
@param pI18nUomLst I18nUnitOfMeasure list
@throws Exception - an exception