protected void initComponentPropertyPaths( final String path, final AbstractComponentType type, final String[] columns, String[] formulaTemplates, final Mapping factory) throws MappingException { Type[] types = type.getSubtypes(); String[] properties = type.getPropertyNames(); int begin = 0; for (int i = 0; i < properties.length; i++) { String subpath = extendPath(path, properties[i]); try { int length = types[i].getColumnSpan(factory); String[] columnSlice = ArrayHelper.slice(columns, begin, length); String[] formulaSlice = formulaTemplates == null ? null : ArrayHelper.slice(formulaTemplates, begin, length); initPropertyPaths(subpath, types[i], columnSlice, formulaSlice, factory); begin += length; } catch (Exception e) { throw new MappingException("bug in initComponentPropertyPaths", e); } } }
public CascadeStyle getCascadeStyle() throws MappingException { Type type = value.getType(); if (type.isComponentType() && !type.isAnyType()) { AbstractComponentType actype = (AbstractComponentType) type; int length = actype.getSubtypes().length; for (int i = 0; i < length; i++) { if (actype.getCascadeStyle(i) != CascadeStyle.NONE) return CascadeStyle.ALL; } return CascadeStyle.NONE; } else if (cascade == null || cascade.equals("none")) { return CascadeStyle.NONE; } else { StringTokenizer tokens = new StringTokenizer(cascade, ", "); CascadeStyle[] styles = new CascadeStyle[tokens.countTokens()]; int i = 0; while (tokens.hasMoreTokens()) { styles[i++] = CascadeStyle.getCascadeStyle(tokens.nextToken()); } return new CascadeStyle.MultipleCascadeStyle(styles); } }