Example #1
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;
 }
 /**
  * Deletes the specified position of the specified resource content on the PdC configured for the
  * specified component instance.
  *
  * @param positionId the identifier of the position to delete.
  * @param componentId the identifier of the component that owns the PdC instance.
  * @throws PdcException if the position or the component identifier doesn't exist or if the
  *     deletion fails.
  */
 public void deletePosition(int positionId, String contentId, String componentId)
     throws PdcException, ContentManagerException {
   List<UsedAxis> axis = getAxisUsedInPdcFor(componentId);
   List<ClassifyPosition> positions = getAllPositions(contentId, componentId);
   if (positions.size() == 1) {
     for (UsedAxis anAxis : axis) {
       if (anAxis.getMandatory() == 1) {
         throw new PdcPositionDeletionException(
             getClass().getSimpleName(), SilverTrace.TRACE_LEVEL_ERROR, "Pdc.CANNOT_DELETE_VALUE");
       }
     }
   }
   getPdcBm().deletePosition(positionId, componentId);
 }
Example #3
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;
 }