/** * Create cube's JoinChain from JAXB counterpart * * @param xj * @return {@link JoinChain} */ public static JoinChain joinChainFromXJoinChain(XJoinChain xj) { JoinChain jc = new JoinChain(xj.getName(), xj.getDisplayString(), xj.getDescription()); for (int i = 0; i < xj.getPaths().getPath().size(); i++) { XJoinPath xchain = xj.getPaths().getPath().get(i); List<TableReference> chain = new ArrayList<TableReference>(xchain.getEdges().getEdge().size() * 2); for (XJoinEdge xRef : xchain.getEdges().getEdge()) { chain.add(new TableReference(xRef.getFrom().getTable(), xRef.getFrom().getColumn(), xRef.getFrom().isMapsToMany())); chain.add(new TableReference(xRef.getTo().getTable(), xRef.getTo().getColumn(), xRef.getTo().isMapsToMany())); } jc.addPath(chain); } return jc; }
/** * Create cube's JoinChain from JAXB counterpart * * @param xj * @return {@link JoinChain} */ public static JoinChain joinChainFromXJoinChain(XJoinChain xj) { JoinChain jc = new JoinChain(xj.getName(), xj.getDisplayString(), xj.getDescription()); for (int i = 0; i < xj.getPaths().getPath().size(); i++) { XJoinPath xchain = xj.getPaths().getPath().get(i); List<TableReference> chain = new ArrayList<TableReference>(xchain.getEdges().getEdge().size() * 2); for (XJoinEdge xRef : xchain.getEdges().getEdge()) { chain.add(new TableReference(xRef.getFrom().getTable(), xRef.getFrom().getColumn(), xRef.getFrom().isMapsToMany())); chain.add(new TableReference(xRef.getTo().getTable(), xRef.getTo().getColumn(), xRef.getTo().isMapsToMany())); } jc.addPath(chain); } return jc; }
chain.add(new TableReference("statedim", "id")); JoinChain zipState = new JoinChain("stateFromZip", "Zip State", "zip State desc"); zipState.addPath(chain); joinChains.add(zipState);
chain.add(new TableReference(cubeName, "cityid")); chain.add(new TableReference("citydim", "id")); cityChain.addPath(chain); toAlter.alterJoinChain(cityChain); toAlter.removeJoinChain("cityFromZip");
chain.add(new TableReference("zipdim", "cityid")); chain.add(new TableReference("citydim", "id")); zipCity.addPath(chain); List<TableReference> chain2 = new ArrayList<>(); chain2.add(new TableReference(cubeName, "zipcode2")); chain2.add(new TableReference("zipdim", "cityid")); chain2.add(new TableReference("citydim", "id")); zipCity.addPath(chain2); joinChains.add(zipCity); JoinChain cityChain = new JoinChain("city", "Cube City", "cube city desc"); chain.add(new TableReference(cubeName, "cityid")); chain.add(new TableReference("citydim", "id")); cityChain.addPath(chain); joinChains.add(cityChain); joinChains.add(new JoinChain("cubeState", "cube-state", "state thru cube") {