1 13 package com.tonbeller.jpivot.mondrian; 14 15 import com.tonbeller.jpivot.core.ExtensionSupport; 16 import com.tonbeller.jpivot.olap.model.Level; 17 import com.tonbeller.jpivot.olap.model.Member; 18 import com.tonbeller.jpivot.olap.model.MemberPropertyMeta; 19 import com.tonbeller.jpivot.olap.navi.MemberProperties; 20 21 24 public class MondrianMemberProperties extends ExtensionSupport implements MemberProperties { 25 26 public MondrianMemberProperties() { 27 super.setId(MemberProperties.ID); 28 } 29 30 33 public MemberPropertyMeta[] getMemberPropertyMetas(Level level) { 34 mondrian.olap.Level monLevel = ((MondrianLevel) level).getMonLevel(); 35 mondrian.olap.Property[] monProps = monLevel.getProperties(); 36 if (monProps == null || monProps.length == 0) 37 return new MemberPropertyMeta[0]; 38 39 String scope = getPropertyScope(monLevel); 40 MemberPropertyMeta[] props = new MemberPropertyMeta[monProps.length]; 41 for (int i = 0; i < props.length; i++) { 42 String name = monProps[i].getName(); 43 String label = monProps[i].getCaption(); 44 if (label==null) 45 label=name; 46 props[i] = new MemberPropertyMeta(label, name, scope); 47 } 48 return props; 49 } 50 51 56 private String getPropertyScope(mondrian.olap.Level monLevel) { 57 return monLevel.getHierarchy().getUniqueName(); 58 } 59 60 63 public boolean isLevelScope() { 64 return false; 65 } 66 67 public String getPropertyScope(Member m) { 68 MondrianLevel level = (MondrianLevel) m.getLevel(); 69 return getPropertyScope(level.getMonLevel()); 70 } 71 72 77 public void setVisibleProperties(MemberPropertyMeta[] props) { 78 } 80 81 } | Popular Tags |