Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Status of 1.2.1 - commit / rollback / edit fun

So I tried the same tests and others; and the edit tools are currently working in Transaction.AUTO_COMMIT mode. Since that does not fire the same events as normal the screen is not being refreshed.

I did a code review of UDIGFeatureStore and made sure to get all the method signatures correct.

I also paid special attention to the following method:

    private void setTransactionInternal() {
        if (!layer.isApplicable(ProjectBlackboardConstants.LAYER__EDIT_APPLICABILITY)) {
            String message = "Attempted to open a transaction on a non-editable layer (Aborted)";
            IllegalStateException illegalStateException = new IllegalStateException( message );
            ProjectPlugin.log(message, illegalStateException);
            throw illegalStateException;
        }
        // grab the current map transaction
        EditManager editManager = (EditManager) layer.getMap().getEditManager();
        Transaction transaction = editManager.getTransaction();

        

        if (wrapped.getTransaction() == Transaction.AUTO_COMMIT) {
            // change over from autocommit to transactional
            wrapped.setTransaction(transaction);
        }
        else if (wrapped.getTransaction() != transaction){
            // a transaction is already present? huh ...
            String msg = "Layer transaction already set "+wrapped.getTransaction(); //$NON-NLS-1$
            IllegalStateException illegalStateException = new IllegalStateException(msg);
            ProjectPlugin.log(msg,illegalStateException);
            throw illegalStateException;
        }
    }

The serious differences are (code review welcome):
- checking that the transaction is actually the current map transaction
- And then throwing a fit (well an IllegalStateException) rather than just logging the problem

I am going to stick some break points in and resume testing; after lunch.

Jody

Back to the top