protected RuntimePropsDatasource loadRuntimePropsDatasource(Element element){ String id = getDatasourceId(element); MetaClass metaClass = loadMetaClass(element); String mainDsId = element.attributeValue("mainDs"); if (mainDsId == null) { throw new IllegalStateException("RuntimePropsDs attributes not specified"); } String categorizedEntityClassName = element.attributeValue("categorizedEntityClass"); MetaClass categorizedEntityMetaClass = null; if (StringUtils.isNotBlank(categorizedEntityClassName)) { final Class<?> aClass = ReflectionHelper.getClass(categorizedEntityClassName); categorizedEntityMetaClass = metadata.getSession().getClass(aClass); } builder.reset().setMetaClass(metaClass).setId(id); RuntimePropsDatasource datasource = builder.buildRuntimePropsDatasource(mainDsId, categorizedEntityMetaClass); loadDatasources(element, datasource); return datasource; }
private void initCollectionDatasourceAttributes(Element element, MetaClass metaClass) { String id = getDatasourceId(element); String viewName = element.attributeValue("view"); String deletion = element.attributeValue("softDeletion"); boolean softDeletion = deletion == null || Boolean.parseBoolean(deletion); boolean cacheable = Boolean.parseBoolean(element.attributeValue("cacheable")); builder.reset() .setMetaClass(metaClass) .setId(id) .setViewName(viewName) .setSoftDeletion(softDeletion) .setCacheable(cacheable) .setRefreshMode(getRefreshMode(element)) .setMaxResults(getMaxResults(element)) .setAllowCommit(getAllowCommit(element)); }
private void initDatasourceAttributes(Element element) { String id = getDatasourceId(element); MetaClass metaClass = loadMetaClass(element); String viewName = element.attributeValue("view"); builder.reset() .setMetaClass(metaClass) .setId(id) .setViewName(viewName) .setAllowCommit(getAllowCommit(element)); }
private ValueGroupDatasourceImpl loadValueGroupDatasource(Element element) { String id = getDatasourceId(element); builder.reset().setMetaClass(metadata.getClassNN(KeyValueEntity.class)).setId(id); ValueGroupDatasourceImpl datasource = builder .setDsClass(getDatasourceClass(element)) .buildValuesGroupDatasource(); String maxResults = element.attributeValue("maxResults"); if (!StringUtils.isEmpty(maxResults)) datasource.setMaxResults(Integer.parseInt(maxResults)); datasource.setSuspended(true); loadQuery(element, datasource); loadProperties(element, datasource); datasource.setStoreName(element.attributeValue("store")); return datasource; }
private ValueHierarchicalDatasourceImpl loadValueHierarchicalDatasource(Element element) { String id = getDatasourceId(element); builder.reset().setMetaClass(metadata.getClassNN(KeyValueEntity.class)).setId(id); ValueHierarchicalDatasourceImpl datasource = builder .setDsClass(getDatasourceClass(element)) .buildValuesHierarchicalDatasource(); String maxResults = element.attributeValue("maxResults"); if (!StringUtils.isEmpty(maxResults)) datasource.setMaxResults(Integer.parseInt(maxResults)); datasource.setSuspended(true); loadQuery(element, datasource); loadProperties(element, datasource); String hierarchyProperty = element.attributeValue("hierarchyProperty"); if (!StringUtils.isEmpty(hierarchyProperty)) { datasource.setHierarchyPropertyName(hierarchyProperty); } datasource.setStoreName(element.attributeValue("store")); return datasource; }
private ValueCollectionDatasourceImpl loadValueCollectionDatasource(Element element) { String id = getDatasourceId(element); builder.reset().setMetaClass(metadata.getClassNN(KeyValueEntity.class)).setId(id); ValueCollectionDatasourceImpl datasource = builder .setDsClass(getDatasourceClass(element)) .buildValuesCollectionDatasource(); String maxResults = element.attributeValue("maxResults"); if (!StringUtils.isEmpty(maxResults)) datasource.setMaxResults(Integer.parseInt(maxResults)); datasource.setSuspended(true); loadQuery(element, datasource); loadProperties(element, datasource); datasource.setStoreName(element.attributeValue("store")); return datasource; }
private void initPropertyDatasourceAttributes(Element element, Datasource ds, String property) { String id = getDatasourceId(element); MetaClass metaClass = ds.getMetaClass(); metaClass.getPropertyNN(property); // check property existence builder.reset() .setMetaClass(metaClass) .setId(id) .setMaster(ds) .setProperty(property) .setAllowCommit(getAllowCommit(element)); }