/** * Set auto-generated fields on save or update */ public void setAutoFields() { if ( uid == null || uid.length() == 0 ) { setUid( CodeGenerator.generateUid() ); } Date date = new Date(); if ( created == null ) { created = date; } setLastUpdated( date ); }
/** * Sets the name, uid and code properties on the given object. * * @param object the object to set identifiable properties. * @param values the array of property values. */ private static void setIdentifiableObject( BaseIdentifiableObject object, String[] values ) { object.setName( getSafe( values, 0, null, 230 ) ); object.setUid( getSafe( values, 1, CodeGenerator.generateUid(), 11 ) ); object.setCode( getSafe( values, 2, null, 50 ) ); }
.forEach( identifiableObject -> ((BaseIdentifiableObject) identifiableObject).setUid( CodeGenerator.generateUid() ) );