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); }