public String setClassification ( String classificationType ) { Metadata metadata = new Metadata ( ) . add ( Metadata . CLASSIFICATION_KEY , classificationType ) ; Metadata classification = null ; try { classification = this . createMetadata ( Metadata . CLASSIFICATION_TEMPLATE_KEY , "enterprise" , metadata ) ; } catch ( BoxAPIException e ) { if ( e . getResponseCode ( ) == 409 ) { metadata = new Metadata ( "enterprise" , Metadata . CLASSIFICATION_TEMPLATE_KEY ) ; metadata . replace ( Metadata . CLASSIFICATION_KEY , classificationType ) ; classification = this . updateMetadata ( metadata ) ; } else { throw e ; } } return classification . getString ( Metadata . CLASSIFICATION_KEY ) ; }
Attempts to add classification to a file . If classification already exists then do update .