public void onNew(@Observes EntityNewEvent event) {
   if (!isValidEvent(event)) {
     return;
   }
   Property treeStructureProperty = entities[0].getProperty(TableTree.PROPERTY_TREESTRUCTURE);
   Property tableProperty = entities[0].getProperty(TableTree.PROPERTY_TABLE);
   String treeStructureValue = (String) event.getCurrentState(treeStructureProperty);
   Table tableValue = (Table) event.getCurrentState(tableProperty);
   checkTreeStructure(tableValue, treeStructureValue, null);
 }
  public void onSave(@Observes EntityNewEvent event) {
    if (!isValidEvent(event)) {
      return;
    }
    ShipmentInOutLine shipmentInOutLine = (ShipmentInOutLine) event.getTargetInstance();

    if (shipmentInOutLine.getProduct() == null
        && (shipmentInOutLine.getMovementQuantity().doubleValue() != 0)) {
      throw new OBException(OBMessageUtils.messageBD("ProductNullAndMovementQtyGreaterZero"));
    }
  }