コード例 #1
0
  @Override
  public boolean createOrUpdateSparePartGroup(
      String electronicShopID, String sparePartGroupID, String description) {

    // check if we know that shop
    if (!ConfigurationProperties.getElectronicShopID().equals(electronicShopID)) {
      logger.warning("electronicShopID \"" + electronicShopID + "\" not known!");
      return false;
    }

    List<SparePartGroup> spgl = SparePartGroup.queryGetByForeignID(sparePartGroupID, 0, 1);
    SparePartGroup spg;
    if (spgl.size() == 0) {
      spg = new SparePartGroup();
    } else {
      spg = spgl.get(0);
    }
    try {
      spg.setForeignID(sparePartGroupID);
      spg.setDescription(description);
      spg.writeToDB();
    } catch (RuntimeException e) {
      logger.log(Level.WARNING, "Can't write to DB!", e);
      return false;
    }

    return true;
  }