X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fsimpleclient%2FClientDocument.java;h=b9e918e2475d02185fb24944cc492d351381ca9d;hb=1e940bf58bbd9f228ff991b5ee6e5b38c36a78fe;hp=0a8dc41cb7d41ff2cca25cb6264a6265b20dd22b;hpb=034f5a16d595a288389bdae61e8f0eae260d3ef5;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java b/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java index 0a8dc41..b9e918e 100644 --- a/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java +++ b/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java @@ -103,6 +103,11 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement * internal reference to single copy of Document Roots array */ private VAMSAS[] _VamsasRoots=null; + /** + * set if the client has corrupted the Vamsas Document structure somehow. + * if this is set the document will never be written back to the session unless the corruption is fixed. + */ + private boolean invalidModification=false; protected void updateDocumentRoots() { if (doc==null) { @@ -189,13 +194,16 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement } // just do internal validation for moment. try { - if (SimpleClientConfig.validateUpdatedRoots()) + if (getSimpleClientConfig().validateUpdatedRoots()) + { newVersion.validate(); + } return true; } catch (Exception e) { log.error("Validation Exception for new vamsas root :"+newVersion.getVorbaId(),e); + modflag.invalidModification=true; } return false; } else { @@ -206,7 +214,7 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement modflag.isModified=true; } try { - if (SimpleClientConfig.validateMergedRoots()) + if (getSimpleClientConfig().validateMergedRoots()) { newVersion.validate(); } @@ -268,6 +276,9 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement } }*/ } + private SimpleClientConfig getSimpleClientConfig() { + return sclient.getSimpleClientConfig(); +} /** * merge old and new root vectors * @param newr This array may be written to @@ -277,7 +288,6 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement */ private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original, ClientDocument modflag) { Vector rts = new Vector(); - boolean modified=false; for (int i=0,j=original.length; i-1) { @@ -581,4 +591,19 @@ public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implement // TODO: WALK through the document objects calling the update mechanism for each one, or just pass this vector back to client ?return updatedObjects; return null; } + /** + * if this is set the document will never be written back to the session unless the corruption is fixed. + * @return the invalidModification + */ + public boolean isInvalidModification() { + return invalidModification; + } + /** + * set if the client has corrupted the Vamsas Document structure somehow. + * if this is set the document will never be written back to the session unless the corruption is fixed. + * @param invalidModification the invalidModification to set + */ + public void setInvalidModification(boolean invalidModification) { + this.invalidModification = invalidModification; + } }