本文整理汇总了Java中org.olap4j.metadata.Member类的典型用法代码示例。如果您正苦于以下问题:Java Member类的具体用法?Java Member怎么用?Java Member使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Member类属于org.olap4j.metadata包,在下文中一共展示了Member类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.olap4j.metadata.Member; //导入依赖的package包/类
@Override
public String toString() {
StringBuffer sb = new StringBuffer(level.getUniqueName());
if(!members.isEmpty()){
sb.append(" with ").append(members.size()).append(" member(s): [");
for(Member m: members){
if(m!=members.get(0))
sb.append(",");
sb.append(m.getName());
}
sb.append("]");
}
sb.append(" node: ");
sb.append(ParseUtils.toString(node));
return sb.toString();
}
示例2: lookupMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
@Override
public Member lookupMember(List<IdentifierSegment> nameParts)
throws OlapException {
Dimension dim = getDimensions().get(nameParts.get(0).getName());
if(dim instanceof ServerMeasureDimension){
String mp = nameParts.get(1).getName();
for(Measure m : getMeasures()){
if(m.getName()!=null && m.getName().equals(mp))
return m;
}
}else if(dim instanceof ServerDimension && nameParts.size()>2){
Hierarchy h = dim.getHierarchies().get(nameParts.get(1).getName());
if(h!=null){
Level level = h.getLevels().get(nameParts.get(2).getName());
if(level!=null){
if(level.getLevelType()==Type.ALL)
return h.getDefaultMember();
else if(nameParts.size()>3)
return new LevelMember(level, nameParts.get(3).getName(), 0);
}
}
}
return null;
}
示例3: createMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
public Olap4jMember createMember(Member member)
{
Olap4jMember mondrianMember;
if (member == null)
{
mondrianMember = null;
}
else
{
String key = member.getUniqueName();
mondrianMember = members.get(key);
if (mondrianMember == null)
{
mondrianMember = new Olap4jMember(member, this);
members.put(key, mondrianMember);
}
}
return mondrianMember;
}
示例4: getMemberAtPoint
import org.olap4j.metadata.Member; //导入依赖的package包/类
public Member getMemberAtPoint(Point p) {
if (axis == null) return null;
if (axis.getAxisOrdinal() == Axis.ROWS) {
// This is a special-case optimization for members in the row axis
int rowNum = (int) (p.y / rowHeight);
if (rowNum >= getLayoutItems().size()) return null;
if (rowNum < 0) return null;
return getLayoutItems().get(rowNum).member;
} else {
for (LayoutItem item: getLayoutItems()) {
if (item.bounds.contains(p)) {
return item.member;
}
}
return null;
}
}
示例5: toString
import org.olap4j.metadata.Member; //导入依赖的package包/类
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (Object o : comparableObjects) {
if (!first) sb.append(", ");
if (o instanceof String) {
sb.append((String) o);
} else if (o instanceof Position) {
boolean firstMember = true;
for (Member member : ((Position) o).getMembers()) {
if (!first || !firstMember) sb.append(", ");
sb.append(member.getName());
firstMember = false;
}
}
first = false;
}
return sb.toString();
}
示例6: determineRowAxisColumns
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
*
* @param axis
* @return
*/
private List<Level> determineRowAxisColumns(CellSetAxis axis) {
Set<Level> levelsEncountered = new HashSet<Level>();
for (Position p : axis.getPositions()) {
for (Member m : p.getMembers()) {
levelsEncountered.add(m.getLevel());
}
}
List<Level> columnAssignments = new ArrayList<Level>();
for (Hierarchy h : axis.getAxisMetaData().getHierarchies()) {
for (Level l : h.getLevels()) {
if (levelsEncountered.contains(l)) {
columnAssignments.add(l);
}
}
}
return columnAssignments;
}
示例7: removeExcludedMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* Removes the given member with the given operator from the list of members
* that are currently being excluded from the query.
*
* @param memberToExclude
* The member that was excluded that we now want to remove from
* the list of exclusions.
* @param operator
* The operator that the member is being excluded with.
* @return True if the member was successfully removed from the list of
* exclusions, false otherwise.
* @throws QueryInitializationException
*/
public synchronized boolean removeExcludedMember(Member memberToExclude,
Selection.Operator operator) throws QueryInitializationException {
QueryDimension qd = findQueryDimension(memberToExclude);
Selection selectionToRemove = null;
for (Selection s : qd.getExclusions()) {
if (s.getMember().equals(memberToExclude) && s.getOperator().equals(operator)) {
selectionToRemove = s;
break;
}
}
if (selectionToRemove == null) return false;
qd.getExclusions().remove(selectionToRemove);
updateAttributes();
return true;
}
示例8: toggleMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* If the member is currently "expanded" (its children are part of the MDX
* query), its children will be removed from the query. Otherwise (the
* member's children are not showing), the member's children will be added
* to the query. In either case, the query will be re-executed after the
* member selections have been adjusted.
*
* @param member The member whose drilldown state to toggle. Must not be null.
* @throws QueryInitializationException
* @throws OlapException if the list of child members can't be retrieved
* @return Returns true if the query was NOT expanded
*/
public synchronized boolean toggleMember(Member member) throws QueryInitializationException {
Dimension d = member.getDimension();
QueryDimension qd = getMDXQuery().getDimension(d.getName());
boolean wasCollapsed = false;
for (Iterator<Selection> it = qd.getInclusions().iterator(); it.hasNext(); ) {
Selection s = it.next();
logger.debug("Checking if " + s.getMember().getName() + " is a descendant of " + member.getName());
if (OlapUtils.isDescendant(member, s.getMember()) ||
(member.equals(s.getMember()) && (s.getOperator() == Operator.CHILDREN || s.getOperator() == Operator.INCLUDE_CHILDREN))) {
logger.debug(s.getMember().getName() + " was collapsed and removed");
// XXX query model docs now say not to do this,
// but there is no other way in the API
it.remove();
wasCollapsed = true;
}
}
if (!wasCollapsed) {
qd.include(Operator.CHILDREN, member);
}
updateAttributes();
return wasCollapsed;
}
示例9: drillReplace
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* Modifies this query's selection so that members equal to and descended
* from the given member remain selected as before, but other members are no
* longer selected.
*
* @param member
* The member to drill replace on. This member will be the new
* root of the selection for its hierarchy.
* @throws QueryInitializationException
*/
public synchronized void drillReplace(Member member) throws QueryInitializationException {
QueryDimension qd = findQueryDimension(member);
for (Iterator<Selection> it = qd.getInclusions().iterator(); it.hasNext(); ) {
Selection s = it.next();
Member victim = s.getMember();
logger.debug("member = " + member.getName() + ", victim = " + victim.getName());
if (!OlapUtils.isDescendantOrEqualTo(member, victim)) {
if (OlapUtils.isChild(victim, member) &&
(s.getOperator() == Operator.CHILDREN)) {
// If the member is there as one of its parent's children
// rather than itself, then we need to replace the selection
// of children with itself in the inclusions
qd.include(member);
}
it.remove();
}
}
updateAttributes();
}
示例10: removeIncludedMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* Removes the given member from the list of members included in this query.
*
* @param member
* The member to remove.
* @param operator
* The operator used in the inclusion.
* @return True if the member was successfully removed, false otherwise.
* @throws QueryInitializationException
*/
public synchronized boolean removeIncludedMember(Member member, Selection.Operator operator)
throws QueryInitializationException {
QueryDimension qd = findQueryDimension(member);
//XXX There should probably be a better way to remove the member
//from the list of included members. This also needs to be fixed
//in toggleMember
Selection selectionToRemove = null;
for (Selection s : qd.getInclusions()) {
if (s.getMember().equals(member) && s.getOperator().equals(operator)) {
selectionToRemove = s;
break;
}
}
if (selectionToRemove == null) return false;
qd.getInclusions().remove(selectionToRemove);
updateAttributes();
return true;
}
示例11: lookupMember
import org.olap4j.metadata.Member; //导入依赖的package包/类
private MondrianOlap4jMember lookupMember(
SchemaReader schemaReader,
List<IdentifierSegment> nameParts)
{
final List<mondrian.olap.Id.Segment> segmentList =
new ArrayList<mondrian.olap.Id.Segment>();
for (IdentifierSegment namePart : nameParts) {
segmentList.add(Util.convert(namePart));
}
final mondrian.olap.Member member =
schemaReader.getMemberByUniqueName(segmentList, false);
if (member == null) {
return null;
}
return olap4jSchema.olap4jCatalog.olap4jDatabaseMetaData
.olap4jConnection.toOlap4j(member);
}
示例12: addDescendants
import org.olap4j.metadata.Member; //导入依赖的package包/类
private void addDescendants(
List<MondrianOlap4jMember> list,
SchemaReader schemaReader,
MondrianOlap4jConnection olap4jConnection,
MondrianOlap4jMember member,
boolean recurse)
{
for (mondrian.olap.Member m
: schemaReader.getMemberChildren(member.member))
{
MondrianOlap4jMember childMember = olap4jConnection.toOlap4j(m);
list.add(childMember);
if (recurse) {
addDescendants(
list, schemaReader, olap4jConnection, childMember, recurse);
}
}
}
示例13: testVisualTotalCaptionBug
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* Test case for bug <a href="http://jira.pentaho.com/browse/MONDRIAN-1279">
* MONDRIAN-1279, "VisualTotals name only applies to member name not
* caption"</a>.
*
* @throws java.sql.SQLException on error
*/
public void testVisualTotalCaptionBug() throws SQLException {
CellSet cellSet =
TestContext.instance().executeOlap4jQuery(
"select {[Measures].[Unit Sales]} on columns, "
+ "VisualTotals("
+ " {[Product].[Food].[Baked Goods].[Bread],"
+ " [Product].[Food].[Baked Goods].[Bread].[Bagels],"
+ " [Product].[Food].[Baked Goods].[Bread].[Muffins]},"
+ " \"**Subtotal - *\") on rows "
+ "from [Sales]");
List<Position> positions = cellSet.getAxes().get(1).getPositions();
Cell cell;
Member member;
cell = cellSet.getCell(Arrays.asList(0, 0));
member = positions.get(0).getMembers().get(0);
assertEquals("*Subtotal - Bread", member.getName());
assertEquals("*Subtotal - Bread", member.getCaption());
}
示例14: testFormatString
import org.olap4j.metadata.Member; //导入依赖的package包/类
public void testFormatString() throws SQLException {
final OlapConnection connection =
getTestContext().getOlap4jConnection();
final CellSet cellSet =
connection.createStatement().executeOlapQuery(
"with member [Measures].[Foo] as 1, FORMAT_STRING = Iif(1 < 2, '##.0%', 'foo')\n"
+ "select\n"
+ " [Measures].[Foo] DIMENSION PROPERTIES FORMAT_EXP on 0\n"
+ "from [Sales]");
final CellSetAxis axis = cellSet.getAxes().get(0);
final Member member =
axis.getPositions().get(0).getMembers().get(0);
Property property = findProperty(axis, "FORMAT_EXP");
assertNotNull(property);
// Note that the expression is returned, unevaluated. You can tell from
// the parentheses and quotes that it has been un-parsed.
assertEquals(
"IIf((1 < 2), \"##.0%\", \"foo\")",
member.getPropertyValue(property));
}
示例15: testLevelProperties
import org.olap4j.metadata.Member; //导入依赖的package包/类
/**
* Tests that a property that is not a standard olap4j property but is a
* Mondrian-builtin property (viz, "FORMAT_EXP") is included among a level's
* properties.
*
* @throws SQLException on error
*/
public void testLevelProperties() throws SQLException {
final OlapConnection connection =
getTestContext().getOlap4jConnection();
final CellSet cellSet =
connection.createStatement().executeOlapQuery(
"select [Store].[Store Name].Members on 0\n"
+ "from [Sales]");
final CellSetAxis axis = cellSet.getAxes().get(0);
final Member member =
axis.getPositions().get(0).getMembers().get(0);
final NamedList<Property> properties =
member.getLevel().getProperties();
// UNIQUE_NAME is an olap4j standard property.
assertNotNull(properties.get("MEMBER_UNIQUE_NAME"));
// FORMAT_EXP is a Mondrian built-in but not olap4j standard property.
assertNotNull(properties.get("FORMAT_EXP"));
// [Store Type] is a property of the level.
assertNotNull(properties.get("Store Type"));
}