@Override public List<AxisHeader> getAxisByType(String type) throws PdcException { if (!StringUtil.isDefined(type)) { throw new NullPointerException(); } ClassificationPlan pdc = aClassificationPlan(); return pdc.getAxisHeaders(type); }
@Override public List<UsedAxis> getUsedAxisByInstanceId(String instanceId) throws PdcException { List<UsedAxis> usedAxis = new ArrayList<UsedAxis>(); ClassificationPlan pdc = aClassificationPlan(); List<UsedAxis> allAxis = pdc.getUsedAxis(); for (UsedAxis anAxis : allAxis) { if (anAxis.getInstanceId().equals(instanceId)) { usedAxis.add(anAxis); } } return usedAxis; }
private void addPosition(final ClassifyPosition position) { ClassificationPlan pdc = aClassificationPlan(); for (ClassifyValue classifyValue : position.getValues()) { if (classifyValue.getFullPath() == null || classifyValue.getFullPath().isEmpty()) { Value value = new Value(); value.setAxisId(classifyValue.getAxisId()); String path = classifyValue.getValue(); path = path.substring(0, path.length() - 1); int indexOfTermId = path.lastIndexOf("/") + 1; value.setValuePK(new ValuePK(path.substring(indexOfTermId))); value.setPath(path.substring(0, indexOfTermId)); classifyValue.setFullPath(pdc.getPathInTreeOfValue(value)); } } position.setPositionId(positions.size()); positions.add(position); }
@Override public Value getValue(String axisId, String valueId) throws PdcException { Value theValue = null; ClassificationPlan pdc = aClassificationPlan(); for (Value aValue : pdc.getValuesOfAxisById(axisId)) { if (aValue.getPK().getId().equals(valueId)) { theValue = aValue; break; } } if (theValue == null) { throw new PdcException( getClass().getSimpleName() + ".getValue()", SilverpeasException.ERROR, "root.NO_EX_MESSAGE"); } return theValue; }
@Override public List<Value> getPertinentDaughterValuesByInstanceIds( SearchContext searchContext, String axisId, String valueId, List<String> instanceIds) throws PdcException { List<Value> pertinentValues = new ArrayList<Value>(); ClassificationPlan pdc = aClassificationPlan(); UsedAxis theAxis = pdc.getAxis(axisId); if (instanceIds.contains(theAxis.getInstanceId())) { List<Value> values = pdc.getValuesUsedInClassification(axisId); List<SearchCriteria> criteria = searchContext.getCriterias(); if (criteria.isEmpty()) { return values; } for (Value aValue : values) { for (SearchCriteria criterion : criteria) { if (criterion.getAxisId() == Integer.valueOf(aValue.getAxisId()) && criterion.getValue().equals(aValue.getFullPath())) { pertinentValues.add(aValue); } } } } return pertinentValues; }
@Override public List<Value> getAxisValues(int treeId) throws PdcException { ClassificationPlan pdc = aClassificationPlan(); return pdc.getValuesOfAxisById(String.valueOf(treeId)); }
@Override public List<AxisHeader> getAxis() throws PdcException { ClassificationPlan pdc = aClassificationPlan(); return pdc.getAxisHeaders(null); }
@Override public AxisHeader getAxisHeader(String axisId, boolean setTranslations) { ClassificationPlan pdc = aClassificationPlan(); return pdc.getAxisHeader(axisId); }