/** * Get instance of AttrDefinitionMgr from store, or create one in the store if one didn't exist */ private static LayoutMapConfig getFromStore() { LayoutMapConfig config = null; try { SimpleDAO dao = getConfigDAOClass().newInstance(); dao.begin(); config = dao.retrieve(LayoutMapConfig.class, ATTRIBUTE_KEY); if (config == null) { config = new LayoutMapConfig(); config.key = ATTRIBUTE_KEY; config.constraintMapConfig = new LayoutMapConfig(); config.constraintMapConfig.key = CONSTRAINT_KEY; config.ref = dao.create(config, ATTRIBUTE_KEY); dao.commit(); } } catch (Exception e) { throw new RuntimeException(e); // FIXME: not sure what we'll get } return config; }