예제 #1
0
 @Override
 public List<AxisHeader> getAxisByType(String type) throws PdcException {
   if (!StringUtil.isDefined(type)) {
     throw new NullPointerException();
   }
   ClassificationPlan pdc = aClassificationPlan();
   return pdc.getAxisHeaders(type);
 }
예제 #2
0
 @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;
 }
예제 #3
0
 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);
 }
예제 #4
0
 @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;
 }
예제 #5
0
 @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;
 }
예제 #6
0
 @Override
 public List<Value> getAxisValues(int treeId) throws PdcException {
   ClassificationPlan pdc = aClassificationPlan();
   return pdc.getValuesOfAxisById(String.valueOf(treeId));
 }
예제 #7
0
 @Override
 public List<AxisHeader> getAxis() throws PdcException {
   ClassificationPlan pdc = aClassificationPlan();
   return pdc.getAxisHeaders(null);
 }
예제 #8
0
 @Override
 public AxisHeader getAxisHeader(String axisId, boolean setTranslations) {
   ClassificationPlan pdc = aClassificationPlan();
   return pdc.getAxisHeader(axisId);
 }