public Representation createWithNameAndParent(SkillCategory skill, NodeEnricher nodeEnricher) { Representation representation = createWithName(skill, nodeEnricher); if (skill.getParent() != null) { representation.withLink("parent", "/" + getPath() + "/" + skill.getParent().getId()); } return representation; }
public Representation createWithName(SkillCategory skill, NodeEnricher nodeEnricher) { Representation representation = halFactory.newRepresentation("/" + getPath() + "/" + skill.getId()); representation.withProperty("name", skill.getName()); if (nodeEnricher != null) { nodeEnricher.enrich(skill, representation); } return representation; }
@Test public void countNeededSkills() { skillTestUtil.createTaxonomy(); int noOpps = 5; SkillCategory root = skillStore.findRoot(); oppTestUtil.createOpps( noOpps, new Date(), DEFAULT_HEAD_COUNT, root.getSubCategories().toArray(new SkillCategory[root.getSubCategories().size()])); int actualHeadCount = oppStore.getTotalHeadCountBySkill(root.getSubCategories().get(0)); assertEquals(noOpps * DEFAULT_HEAD_COUNT, actualHeadCount); }
public void addEmbeddedLinks( Representation representation, SkillCategory skill, NodeEnricher nodeEnricher) { for (SkillCategory child : skill.getSubCategories()) { Representation embedded = createWithName(child, nodeEnricher); addEmbeddedLinks(embedded, child, nodeEnricher); representation.withRepresentation("children", embedded); } }