public PdcClassification build() {
    ClassificationPlan pdc = aClassificationPlan();
    List<ClassifyPosition> positions = new ArrayList<ClassifyPosition>();

    List<ClassifyValue> positionValues = new ArrayList<ClassifyValue>();
    List<Value> values = pdc.getValuesOfAxisByName("Pays");
    Value value = findTerm("Grenoble", values);
    ClassifyValue classifyValue =
        new ClassifyValue(toValueId(value.getAxisId()), toValue(value.getFullPath()));
    classifyValue.setFullPath(pdc.getPathInTreeOfValue(value));
    positionValues.add(classifyValue);
    values = pdc.getValuesOfAxisByName("Période");
    value = findTerm("Moyen-Age", values);
    classifyValue = new ClassifyValue(toValueId(value.getAxisId()), toValue(value.getFullPath()));
    classifyValue.setFullPath(pdc.getPathInTreeOfValue(value));
    positionValues.add(classifyValue);
    positions.add(new ClassifyPosition(positionValues));

    positionValues = new ArrayList<ClassifyValue>();
    values = pdc.getValuesOfAxisByName("Religion");
    value = findTerm("Christianisme", values);
    classifyValue = new ClassifyValue(toValueId(value.getAxisId()), toValue(value.getFullPath()));
    classifyValue.setFullPath(pdc.getPathInTreeOfValue(value));
    positionValues.add(classifyValue);
    positions.add(new ClassifyPosition(positionValues));

    PdcClassification classification =
        aClassificationFromPositions(positions).inComponentInstance(getComponentId());
    if (getContentId() != null) {
      classification = classification.ofContent(getContentId());
    } else if (getNodeId() != null) {
      classification = classification.forNode(getNodeId());
    }
    return classification;
  }
Esempio n. 2
0
 public void addClassification(final PdcClassification classification) {
   if (COMPONENT_INSTANCE_ID.equals(classification.getComponentInstanceId())
       && (CONTENT_ID.equals(classification.getContentId()))) {
     this.positions.clear();
     for (ClassifyPosition position : classification.getClassifyPositions()) {
       addPosition(position);
     }
   }
 }