/** * ******************************************************************** * * @param the object that will receive a new association * @param the object that will be added as new association (neighbor) * ******************************************************************** */ public synchronized void insertAssociation( Address address, Object neighbor, String AssociationID) { try { Address object = Database.get(Address.class, address.ID()); if (object != null) { int oldID = address.ID(); if (neighbor instanceof Station) { ((Station) neighbor).insertAssociation(object, AssociationID); Transactions.AddCommand( new Command( getAccess(), CommandType.INSERT_ASSOCIATION, CommandTargetLayer.VIEW, oldID, address, object, Station.class, ((Station) neighbor).ID(), null, neighbor)); } object.checkModelRestrictions(); object.checkRestrictions(); Transactions.getSession().store(object); } else { Transactions.CancelTransaction( "Failed in InsertAssociation", "the Address does not exists"); } } catch (Exception e) { Transactions.CancelTransaction( "Failed in InsertAssociation", "Error ocurred while trying to associate the Address"); } }