DATA.NAME, key); if ( data != null && data.getVisible() != null && data.getVisible() == visible ) { return data.getValue();
@Override public String doWithLock() { Data data = objectManager.findAny(Data.class, DATA.NAME, key); if ( data != null && data.getVisible() != null && data.getVisible() == visible ) { return data.getValue(); } else if ( data != null ) { data.setVisible(visible); objectManager.persist(data); return data.getValue(); } try { String value = generator.call(); if ( value == null ) { return value; } return objectManager.create(Data.class, DATA.NAME, key, DATA.VISIBLE, visible, DATA.VALUE, value).getValue(); } catch (Exception e) { ExceptionUtils.rethrowRuntime(e); throw new RuntimeException("Failed to generate value for [" + key + "]", e); } } });
/** * {@inheritDoc} */ @Override public void from(io.cattle.platform.core.model.Data from) { setId(from.getId()); setName(from.getName()); setVisible(from.getVisible()); setValue(from.getValue()); }