Ejemplo n.º 1
0
 @Override
 public void deletePosition(int positionId, String sComponentId) throws PdcException {
   assertComponentExists(sComponentId);
   ClassifyPosition positionToDelete = null;
   for (ClassifyPosition position : aListOfPositions()) {
     if (position.getPositionId() == positionId) {
       positionToDelete = position;
       break;
     }
   }
   if (positionToDelete != null) {
     aListOfPositions().remove(positionToDelete);
   } else {
     throw new PdcException(getClass().getSimpleName(), SilverTrace.TRACE_LEVEL_ERROR, "");
   }
 }
Ejemplo n.º 2
0
 @Override
 public int addPosition(int silverObjectId, ClassifyPosition position, String sComponentId)
     throws PdcException {
   String contentId = getContentIdOf(silverObjectId);
   assertContentExists(contentId, in(sComponentId));
   addPosition(position);
   return position.getPositionId();
 }
Ejemplo n.º 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);
 }
 /**
  * Adds a new position of the specified resource content on the PdC configured for the specified
  * Silverpeas component instance. Once added, an identifier is set for the specified position.
  *
  * @param position the classification position to add.
  * @param contentId the identifier of the content for which a new position is created on the PdC.
  * @param componentId the identifier of the component instance that owns the PdC instance.
  * @throws ContentManagerException if no such content or component instance exists with the
  *     specified identifier.
  * @throws PdcException if the position adding fails.
  */
 public void addPosition(final ClassifyPosition position, String contentId, String componentId)
     throws ContentManagerException, PdcException {
   int silverObjectId = getSilverObjectId(contentId, componentId);
   int positionId = getPdcBm().addPosition(silverObjectId, position, componentId);
   position.setPositionId(positionId);
 }