/* * Passes the user’s light control action to the transaction object */ public boolean turnOnOffLighting(HouseSection hs, LightStatus action) { // 1st validate all user inputs if (hs == null) { throw new IllegalArgumentException("The HouseSection supplied is undefined!"); } if (action == null) { throw new IllegalArgumentException("The light action supplied is undefined!"); } // try to add the user's selection where duplicate house section is not allowed try { lct.addLightControlAction(hs, action); } catch (Exception e) { return false; // duplicates found } return true; }
/* * Indicates that user has ended house sections picking and ready to apply the * transaction. */ public TransactionStatus endControlLighting() { TransactionStatus status = lct.process(); house.logTransaction(lct, TransactionType.CONTROL_LIGHTING, status); return status; }