public XJoinChains withJoinChain(XJoinChain... values) { if (values!= null) { for (XJoinChain value: values) { getJoinChain().add(value); } } return this; }
public XJoinChains withJoinChain(XJoinChain... values) { if (values!= null) { for (XJoinChain value: values) { getJoinChain().add(value); } } return this; }
public XJoinChains withJoinChain(Collection<XJoinChain> values) { if (values!= null) { getJoinChain().addAll(values); } return this; }
public XJoinChains withJoinChain(Collection<XJoinChain> values) { if (values!= null) { getJoinChain().addAll(values); } return this; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { List<XJoinChain> theJoinChain; theJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); strategy.appendField(locator, this, "joinChain", buffer, theJoinChain); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { { List<XJoinChain> theJoinChain; theJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); strategy.appendField(locator, this, "joinChain", buffer, theJoinChain); } return buffer; }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { List<XJoinChain> theJoinChain; theJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "joinChain", theJoinChain), currentHashCode, theJoinChain); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) { int currentHashCode = 1; { List<XJoinChain> theJoinChain; theJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "joinChain", theJoinChain), currentHashCode, theJoinChain); } return currentHashCode; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof XJoinChains)) { return false; } if (this == object) { return true; } final XJoinChains that = ((XJoinChains) object); { List<XJoinChain> lhsJoinChain; lhsJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); List<XJoinChain> rhsJoinChain; rhsJoinChain = (((that.joinChain!= null)&&(!that.joinChain.isEmpty()))?that.getJoinChain():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "joinChain", lhsJoinChain), LocatorUtils.property(thatLocator, "joinChain", rhsJoinChain), lhsJoinChain, rhsJoinChain)) { return false; } } return true; }
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof XJoinChains)) { return false; } if (this == object) { return true; } final XJoinChains that = ((XJoinChains) object); { List<XJoinChain> lhsJoinChain; lhsJoinChain = (((this.joinChain!= null)&&(!this.joinChain.isEmpty()))?this.getJoinChain():null); List<XJoinChain> rhsJoinChain; rhsJoinChain = (((that.joinChain!= null)&&(!that.joinChain.isEmpty()))?that.getJoinChain():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "joinChain", lhsJoinChain), LocatorUtils.property(thatLocator, "joinChain", rhsJoinChain), lhsJoinChain, rhsJoinChain)) { return false; } } return true; }
@Override public String toString() { return new CollectionTable<>(xJoinChains.getJoinChain(), new CollectionTable.RowProvider<XJoinChain>() { @Override public String[][] getRows(XJoinChain element) {
public static Dimension dimensionFromXDimension(XDimension dimension) throws LensException { Set<CubeDimAttribute> dims = new LinkedHashSet<CubeDimAttribute>(); for (XDimAttribute xd : dimension.getAttributes().getDimAttribute()) { dims.add(hiveDimAttrFromXDimAttr(xd)); } Set<ExprColumn> expressions = new LinkedHashSet<ExprColumn>(); if (dimension.getExpressions() != null && !dimension.getExpressions().getExpression().isEmpty()) { for (XExprColumn xe : dimension.getExpressions().getExpression()) { expressions.add(hiveExprColumnFromXExprColumn(xe)); } } Set<JoinChain> joinchains = new LinkedHashSet<JoinChain>(); if (dimension.getJoinChains() != null && !dimension.getJoinChains().getJoinChain().isEmpty()) { for (XJoinChain xj : dimension.getJoinChains().getJoinChain()) { joinchains.add(joinChainFromXJoinChain(xj)); } } Map<String, String> properties = mapFromXProperties(dimension.getProperties()); return new Dimension(dimension.getName(), dims, expressions, joinchains, properties, 0L); }
public static Dimension dimensionFromXDimension(XDimension dimension) throws LensException { Set<CubeDimAttribute> dims = new LinkedHashSet<CubeDimAttribute>(); for (XDimAttribute xd : dimension.getAttributes().getDimAttribute()) { dims.add(hiveDimAttrFromXDimAttr(xd)); } Set<ExprColumn> expressions = new LinkedHashSet<ExprColumn>(); if (dimension.getExpressions() != null && !dimension.getExpressions().getExpression().isEmpty()) { for (XExprColumn xe : dimension.getExpressions().getExpression()) { expressions.add(hiveExprColumnFromXExprColumn(xe)); } } Set<JoinChain> joinchains = new LinkedHashSet<JoinChain>(); if (dimension.getJoinChains() != null && !dimension.getJoinChains().getJoinChain().isEmpty()) { for (XJoinChain xj : dimension.getJoinChains().getJoinChain()) { joinchains.add(joinChainFromXJoinChain(xj)); } } Map<String, String> properties = mapFromXProperties(dimension.getProperties()); return new Dimension(dimension.getName(), dims, expressions, joinchains, properties, 0L); }
@Override public XJoinChains getAllJoinChains(LensSessionHandle sessionHandle, String tableName) throws LensException { try (SessionContext ignored = new SessionContext(sessionHandle)){ CubeMetastoreClient client = getClient(sessionHandle); Set<JoinChain> chains; if (client.isCube(tableName)) { chains = client.getCube(tableName).getJoinChains(); } else if (client.isDimension(tableName)) { chains = client.getDimension(tableName).getJoinChains(); } else { throw new BadRequestException("Can't get join chains. '" + tableName + "' is neither a cube nor a dimension"); } XJoinChains xJoinChains = new XJoinChains(); List<XJoinChain> joinChains = xJoinChains.getJoinChain(); if (chains != null) { for (JoinChain chain : chains) { joinChains.add(JAXBUtils.getXJoinChainFromJoinChain(chain)); } } return xJoinChains; } }
public static XDimension xdimensionFromDimension(Dimension dimension) { XDimension xd = XCF.createXDimension(); xd.setName(dimension.getName()); xd.setAttributes(new XDimAttributes()); xd.setExpressions(new XExpressions()); xd.setJoinChains(new XJoinChains()); xd.setProperties(new XProperties()); xd.getProperties().getProperty().addAll(xPropertiesFromMap(((AbstractCubeTable) dimension).getProperties())); for (CubeDimAttribute cd : dimension.getAttributes()) { xd.getAttributes().getDimAttribute().add(xDimAttrFromHiveDimAttr(cd, dimension)); } for (ExprColumn ec : dimension.getExpressions()) { xd.getExpressions().getExpression().add(xExprColumnFromHiveExprColumn(ec)); } for (JoinChain jc : dimension.getJoinChains()) { xd.getJoinChains().getJoinChain().add(getXJoinChainFromJoinChain(jc)); } return xd; }
public static XDimension xdimensionFromDimension(Dimension dimension) { XDimension xd = XCF.createXDimension(); xd.setName(dimension.getName()); xd.setAttributes(new XDimAttributes()); xd.setExpressions(new XExpressions()); xd.setJoinChains(new XJoinChains()); xd.setProperties(new XProperties()); xd.getProperties().getProperty().addAll(xPropertiesFromMap(((AbstractCubeTable) dimension).getProperties())); for (CubeDimAttribute cd : dimension.getAttributes()) { xd.getAttributes().getDimAttribute().add(xDimAttrFromHiveDimAttr(cd, dimension)); } for (ExprColumn ec : dimension.getExpressions()) { xd.getExpressions().getExpression().add(xExprColumnFromHiveExprColumn(ec)); } for (JoinChain jc : dimension.getJoinChains()) { xd.getJoinChains().getJoinChain().add(getXJoinChainFromJoinChain(jc)); } return xd; }
xbc.getJoinChains().getJoinChain().add(getXJoinChainFromJoinChain(jc));
xbc.getJoinChains().getJoinChain().add(getXJoinChainFromJoinChain(jc));
chain2.getPaths().getPath().add(path2); chain2.setDestTable("test_dim"); chains.getJoinChain().add(chain2); chains.getJoinChain().add(chain1); XJoinChains chainsInDiffOrder = new XJoinChains(); chainsInDiffOrder.getJoinChain().add(chain1); chainsInDiffOrder.getJoinChain().add(chain2); assertTrue(joinChains.equals(new XJoinChainTable(chains).toString()) || joinChains.equals(new XJoinChainTable(chainsInDiffOrder).toString()));
private void testJoinChains(LensDimensionCommands command) { XJoinChains chains = new XJoinChains(); XJoinChain chain1 = new XJoinChain(); chain1.setPaths(new XJoinPaths()); XJoinPath path = new XJoinPath(); path.setEdges(new XJoinEdges()); XJoinEdge edge1 = new XJoinEdge(); XTableReference ref1 = new XTableReference(); ref1.setTable("test_dim"); ref1.setColumn("d2id"); XTableReference ref2 = new XTableReference(); ref2.setTable("test_detail"); ref2.setColumn("id"); edge1.setFrom(ref1); edge1.setTo(ref2); path.getEdges().getEdge().add(edge1); chain1.setName("dim2chain"); chain1.getPaths().getPath().add(path); chain1.setDestTable("test_detail"); chains.getJoinChain().add(chain1); assertEquals(command.showJoinChains("test_dim"), new XJoinChainTable(chains).toString()); }