diff --git a/ejb-core/pdc/src/main/java/com/silverpeas/pdc/ejb/PdcBmEJB.java b/ejb-core/pdc/src/main/java/com/silverpeas/pdc/ejb/PdcBmEJB.java index ca5a6e5642b..619c8ae786a 100644 --- a/ejb-core/pdc/src/main/java/com/silverpeas/pdc/ejb/PdcBmEJB.java +++ b/ejb-core/pdc/src/main/java/com/silverpeas/pdc/ejb/PdcBmEJB.java @@ -78,7 +78,8 @@ public List findGlobalSilverContents( SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c); } - return getSilverContentsByIds(silverContentIds); + SearchContext searchContext = (SearchContext) containerPosition; + return getSilverContentsByIds(silverContentIds, searchContext.getUserId()); } @Override @@ -97,7 +98,8 @@ public List findGlobalSilverContents( SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c); } - return getSilverContentsByIds(silverContentIds); + SearchContext searchContext = (SearchContext) containerPosition; + return getSilverContentsByIds(silverContentIds, searchContext.getUserId()); } @Override @@ -234,9 +236,9 @@ public int addUsedAxis(UsedAxis usedAxis) { } } - private List getSilverContentsByIds(List silverContentIds) { + private List getSilverContentsByIds(List silverContentIds, String userId) { SilverTrace.info("Pdc", "PdcBmEJB.getSilverContentsByIds", "root.MSG_GEN_PARAM_VALUE", - "silverContentIds = " + silverContentIds); + "silverContentIds = " + silverContentIds+", userId = "+userId); // recherche des componentId a partir de silverContentId ContentPeas contentP = null; List alSilverContents = new ArrayList(); @@ -279,7 +281,7 @@ private List getSilverContentsByIds(List silverCon // we are going to search only SilverContent of this instanceId ContentInterface contentInterface = contentP.getContentInterface(); silverContentTempo = contentInterface.getSilverContentById( - allSilverContentIds, instanceId, null, new ArrayList()); + allSilverContentIds, instanceId, userId, new ArrayList()); } catch (ContentManagerException c) { throw new PdcBmRuntimeException("PdcBmEJB.getSilverContentsByIds", SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c); diff --git a/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/control/PdcBmImpl.java b/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/control/PdcBmImpl.java index b510db35481..1e97f5d347c 100644 --- a/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/control/PdcBmImpl.java +++ b/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/control/PdcBmImpl.java @@ -589,7 +589,6 @@ public List getAxisValuesByName(String valueName) throws PdcException { * @param valueId * @return List of String * @throws PdcException - * @see getDaughters */ @Override public List getDaughterValues(String axisId, String valueId) @@ -615,11 +614,10 @@ public List getDaughterValues(String axisId, String valueId) /** * Return a list of String corresponding to the valueId of the value in parameter - * @param axisId - * @param valueId + * @param rootId + * @param filter * @return List of String * @throws PdcException - * @see getDaughters */ @Override public List getFilteredAxisValues(String rootId, AxisFilter filter) throws PdcException { @@ -801,7 +799,7 @@ public int moveValueToNewFatherId(Axis axis, Value valueToMove, /** * retourne les droits hérités sur la valeur - * @param current value + * @param value * @return ArrayList( ArrayList UsersId, ArrayList GroupsId) * @throws PdcException */ @@ -838,7 +836,8 @@ public List> getInheritedManagers(Value value) throws PdcException /** * retourne les droits sur la valeur - * @param current value + * @param axisId + * @param valueId * @return List(List userIds, List groupIds) * @throws PdcException */ @@ -906,7 +905,10 @@ private boolean isGroupManager(String[] groupIds) throws PdcException { /** * met à jour les droits sur la valeur - * @param ArrayList ( ArrayList UsersId, ArrayList GroupsId), current value + * @param userIds + * @param groupIds + * @param axisId + * @param valueId * @return * @throws PdcException */ @@ -1354,7 +1356,7 @@ public List getFullPath(String valueId, String treeId) throws PdcExceptio /** * This method searches if a name of axes is alreadey used ! * @param axis - a list of axes - * @param name - the name of the axe + * @param axisToCheck - the name of the axe * @return true if the name of the axe exists, false otherwise */ private boolean isAxisNameExist(List axis, AxisHeader axisToCheck) { @@ -1381,7 +1383,7 @@ private boolean isAxisNameExist(List axis, AxisHeader axisToCheck) { /** * This method searches if a name of values is alreadey used ! * @param values - a list of values - * @param name - the name of the value + * @param valueToCheck - the name of the value * @return true if the name of the value exists, false otherwise */ private boolean isValueNameExist(List values, Value valueToCheck) { @@ -1683,7 +1685,10 @@ private boolean isAscendanteBaseValue(List objectIdList, UsedAxis usedA /** * Update a base value from the PdcUtilization table - * @param valueId - the base value that must be updated + * @param con + * @param baseValueToUpdate - the base value that must be updated + * @param axisId + * @param treeId */ private void updateBaseValueInInstances(Connection con, String baseValueToUpdate, String axisId, String treeId) @@ -1703,7 +1708,10 @@ private void updateBaseValueInInstances(Connection con, /** * Update some base values from the PdcUtilization table - * @param baseValuesToUpdate - the base values that must be updated + * @param con + * @param baseValueToUpdate - the base value that must be updated + * @param axisId + * @param treeId */ private void updateBaseValuesInInstances(Connection con, String baseValueToUpdate, String axisId, String treeId) @@ -2440,8 +2448,6 @@ public void indexAllAxis() throws PdcException { /** * Method declaration - * @param con - * @see */ private Connection openConnection() throws PdcException { Connection con = null; @@ -2539,7 +2545,7 @@ public ContainerPositionInterface getSilverContentIdSearchContext( sComponentId); // Convert the first position in SearchContext - SearchContext searchContext = new SearchContext(); + SearchContext searchContext = new SearchContext(null); if (alPositions != null && alPositions.size() > 0) { Position pos = (Position) alPositions.get(0); List alValues = pos.getValues(); diff --git a/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/model/SearchContext.java b/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/model/SearchContext.java index 70c16c12439..6ec75e5e950 100644 --- a/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/model/SearchContext.java +++ b/ejb-core/pdc/src/main/java/com/stratelia/silverpeas/pdc/model/SearchContext.java @@ -39,11 +39,8 @@ public class SearchContext implements ContainerPositionInterface, java.io.Serial private ArrayList criterias = new ArrayList(); private String userId = null; // user who search - public SearchContext() { - } - - public SearchContext(ArrayList criterias) { - this.criterias = criterias; + public SearchContext(String userId) { + this.userId = userId; } public List getCriterias() { diff --git a/war-core/src/main/java/com/silverpeas/lookV5/AjaxServletLookV5.java b/war-core/src/main/java/com/silverpeas/lookV5/AjaxServletLookV5.java index 88f56198b2e..f7c5bd2789c 100644 --- a/war-core/src/main/java/com/silverpeas/lookV5/AjaxServletLookV5.java +++ b/war-core/src/main/java/com/silverpeas/lookV5/AjaxServletLookV5.java @@ -567,7 +567,7 @@ private void getPertinentAxis(String spaceId, String componentId, String userId, MainSessionController mainSC, Writer out) throws PdcException, IOException { List primaryAxis = null; - SearchContext searchContext = new SearchContext(); + SearchContext searchContext = new SearchContext(userId); PdcBm pdc = new PdcBmImpl(); @@ -634,8 +634,7 @@ private List getPertinentValues(String spaceId, String componentId, throws IOException, PdcException { List daughters = null; - SearchContext searchContext = new SearchContext(); - searchContext.setUserId(userId); + SearchContext searchContext = new SearchContext(userId); if (StringUtil.isDefined(axisId)) { PdcBm pdc = new PdcBmImpl(); diff --git a/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSearchSessionController.java b/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSearchSessionController.java index 676e3a42856..60a0730a19b 100644 --- a/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSearchSessionController.java +++ b/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSearchSessionController.java @@ -130,7 +130,7 @@ public class PdcSearchSessionController extends AbstractComponentSessionControll private ContainerWorkspace containerWorkspace = null; private ContainerPeas containerPeasPDC = null; private ContentPeas contentPeasPDC = null; - private SearchContext searchContext = new SearchContext(); // Current position + private SearchContext searchContext = null; // Current position // in PDC private QueryParameters queryParameters = null; // Current parameters for // plain search @@ -211,7 +211,7 @@ public PdcSearchSessionController(MainSessionController mainSessionCtrl, isThesaurusEnableByUser = false; } - searchContext.setUserId(getUserId()); + this.searchContext = new SearchContext(this.getUserId()); // Initialize external search isEnableExternalSearch = getSettings().getBoolean("external.search.enable", false); diff --git a/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSessionController.java b/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSessionController.java index 7d38a7b0b43..781add74366 100644 --- a/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSessionController.java +++ b/war-core/src/main/java/com/stratelia/silverpeas/pdcPeas/control/PdcSessionController.java @@ -487,10 +487,13 @@ public void updateManager() throws PdcException, SQLException { } public Value getValue(String axisId, String valueId) throws PdcException { - Value value = null; + + SearchContext searchContext = new SearchContext(this.getUserId()); List values = getPdcBm().getPertinentDaughterValuesByInstanceIds( - new SearchContext(), axisId, valueId, getComponentList()); + searchContext, axisId, valueId, getComponentList()); + + Value value = null; if (values != null) { Iterator i = values.iterator(); Value theValue = null; diff --git a/war-core/src/main/java/com/stratelia/silverpeas/silverStatisticsPeas/control/SilverStatisticsPeasSessionController.java b/war-core/src/main/java/com/stratelia/silverpeas/silverStatisticsPeas/control/SilverStatisticsPeasSessionController.java index 38026e5435b..4baf99b82ce 100644 --- a/war-core/src/main/java/com/stratelia/silverpeas/silverStatisticsPeas/control/SilverStatisticsPeasSessionController.java +++ b/war-core/src/main/java/com/stratelia/silverpeas/silverStatisticsPeas/control/SilverStatisticsPeasSessionController.java @@ -98,21 +98,21 @@ private void initYears() { try { yearsConnection = SilverStatisticsPeasDAOConnexion.getYears(); } catch (Exception e) { - SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasDAOConnexion.getYears", + SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasSessionController.initYears", "root.EX_SQL_QUERY_FAILED", e); } try { yearsAccess = SilverStatisticsPeasDAOAccesVolume.getAccessYears(); } catch (Exception e) { - SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasDAOAccesVolume.getYears", + SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasSessionController.initYears", "root.EX_SQL_QUERY_FAILED", e); } try { yearsVolume = SilverStatisticsPeasDAOAccesVolume.getVolumeYears(); } catch (Exception e) { - SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasDAOAccesVolume.getYears", + SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasSessionController.initYears", "root.EX_SQL_QUERY_FAILED", e); } } @@ -336,7 +336,7 @@ public Collection getStatsConnexionAllUser(String dateBegin, String da dateEnd, Integer.parseInt(idUser)); } catch (Exception e) { SilverTrace.error("silverStatisticsPeas", - "SilverStatisticsPeasDAOConnexion.getStatsConnexionAllUser", + "SilverStatisticsPeasSessionController.getStatsConnexionAllUser", "root.EX_SQL_QUERY_FAILED", e); } return c; @@ -495,7 +495,7 @@ public Collection getStatsConnexionGroupAll(String dateBegin, String d dateEnd); } catch (Exception e) { SilverTrace.error("silverStatisticsPeas", - "SilverStatisticsPeasDAOConnexion.getStatsConnexionGroupAll", + "SilverStatisticsPeasSessionController.getStatsConnexionGroupAll", "root.EX_SQL_QUERY_FAILED", e); } return c; @@ -512,7 +512,7 @@ public Collection getStatsConnexionGroupUser(String dateBegin, dateBegin, dateEnd, Integer.parseInt(idUser)); } catch (Exception e) { SilverTrace.error("silverStatisticsPeas", - "SilverStatisticsPeasDAOConnexion.getStatsConnexionGroupUser", + "SilverStatisticsPeasSessionController.getStatsConnexionGroupUser", "root.EX_SQL_QUERY_FAILED", e); } return c; @@ -527,7 +527,7 @@ public Collection getStatsConnexionUserAll(String dateBegin, String da dateEnd); } catch (Exception e) { SilverTrace.error("silverStatisticsPeas", - "SilverStatisticsPeasDAOConnexion.getStatsConnexionUserAll", + "SilverStatisticsPeasSessionController.getStatsConnexionUserAll", "root.EX_SQL_QUERY_FAILED", e); } return c; @@ -543,7 +543,7 @@ public Collection getStatsConnexionUserUser(String dateBegin, String d dateEnd, Integer.parseInt(idUser)); } catch (Exception e) { SilverTrace.error("silverStatisticsPeas", - "SilverStatisticsPeasDAOConnexion.getStatsConnexionUserUser", + "SilverStatisticsPeasSessionController.getStatsConnexionUserUser", "root.EX_SQL_QUERY_FAILED", e); } return c; @@ -805,7 +805,7 @@ public void retourVolumeUserPanelGroup() { setAccessFilterLibGroup(getOrganisationController().getGroup(theGroup).getName()); } SilverTrace.debug("silverStatisticsPeas", - "SilverStatisticsPeasSessionController.retourAccessUserPanelGroup()", + "SilverStatisticsPeasSessionController.retourVolumeUserPanelGroup()", "accessFilterIdGroup=" + accessFilterIdGroup); } @@ -828,7 +828,7 @@ public void retourVolumeUserPanelUser() { setAccessFilterLibUser(getOrganisationController().getUserDetail(theUser).getLastName()); } SilverTrace.debug("silverStatisticsPeas", - "SilverStatisticsPeasSessionController.retourAccessUserPanelUser()", + "SilverStatisticsPeasSessionController.retourVolumeUserPanelUser()", "accessFilterIdUser=" + accessFilterIdUser); } @@ -1484,11 +1484,11 @@ public List getAxisStats(AxisStatsFilter statsFilter) { } } } catch (PdcException e) { - SilverTrace.error("SilverStatisticsPeas", + SilverTrace.error("silverStatisticsPeas", SilverStatisticsPeasSessionController.class.getName() + ".getAxisStats", "Problem to access the PDC"); } catch (SQLException sqlEx) { - SilverTrace.error("SilverStatisticsPeas", + SilverTrace.error("silverStatisticsPeas", SilverStatisticsPeasSessionController.class.getName() + ".getAxisStats", "Problem to retrieve statistics on axis."); } @@ -1506,7 +1506,7 @@ public List getAxisStats(AxisStatsFilter statsFilter) { private List getPdCPublications(String axisId, String valueId, List componentIds) { // Create search context with a new search criteria - SearchContext context = new SearchContext(); + SearchContext context = new SearchContext(this.getUserId()); SearchCriteria criteria = new SearchCriteria(Integer.parseInt(axisId), valueId); context.addCriteria(criteria); @@ -1518,7 +1518,7 @@ private List getPdCPublications(String axisId, String value try { silverContentsMetier = pdcBm.findGlobalSilverContents(context, componentIds, true, true); } catch (Exception e) { - SilverTrace.error("LookINPI", "LookINPIHelper", "getPdCPublications exception", e); + SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasSessionController.getPdCPublications", "getPdCPublications exception", e); } } } @@ -1543,7 +1543,7 @@ private List getPdCPublications(SearchContext searchContext silverContentsMetier = pdcBm.findGlobalSilverContents(searchContext, componentIds, true, true); } catch (Exception e) { - SilverTrace.error("LookINPI", "LookINPIHelper", "getPdCPublications exception", e); + SilverTrace.error("silverStatisticsPeas", "SilverStatisticsPeasSessionController.getPdCPublications", "getPdCPublications exception", e); } } } @@ -1637,7 +1637,7 @@ public CrossStatisticVO getCrossAxisStats(CrossAxisStatsFilter statsFilter) { // String sValueName = secondValue.getName(); // Build PDC search context - SearchContext searchCtx = new SearchContext(); + SearchContext searchCtx = new SearchContext(this.getUserId()); searchCtx.addCriteria(firstSC); searchCtx.addCriteria(new SearchCriteria(secondAxisId, sValue)); // Retrieve publication on current cross axis @@ -1652,11 +1652,11 @@ public CrossStatisticVO getCrossAxisStats(CrossAxisStatsFilter statsFilter) { } crossStat = new CrossStatisticVO(headerColumn, firstRow, stats); } catch (PdcException e) { - SilverTrace.error("SilverStatisticsPeas", + SilverTrace.error("silverStatisticsPeas", SilverStatisticsPeasSessionController.class.getName() + ".getCrossAxisStats", "Problem to access the PDC", e); } catch (SQLException sqlEx) { - SilverTrace.error("SilverStatisticsPeas", + SilverTrace.error("silverStatisticsPeas", SilverStatisticsPeasSessionController.class.getName() + ".getCrossAxisStats", "Problem to access statistics table", sqlEx); } diff --git a/war-core/src/main/webapp/pdcPeas/jsp/pdcInComponent.jsp b/war-core/src/main/webapp/pdcPeas/jsp/pdcInComponent.jsp index 0bca934e4b5..44054006749 100644 --- a/war-core/src/main/webapp/pdcPeas/jsp/pdcInComponent.jsp +++ b/war-core/src/main/webapp/pdcPeas/jsp/pdcInComponent.jsp @@ -55,20 +55,21 @@ String getValueIdFromPdcSearchContext(int axisId, SearchContext searchContext) return null; } -void displayAxisByType(boolean showAllAxis, String axisLabel, List axis, SearchContext searchContext, Boolean activeThesaurus, Jargon jargon, ResourcesWrapper resource, String axisTypeIcon, JspWriter out) throws IOException { - SearchAxis searchAxis = null; - int axisId = -1; - String axisName = null; - int nbPositions = -1; - String valueInContext = null; - Value value = null; - String increment = ""; - String selected = ""; - String sNbObjects = ""; - String language = resource.getLanguage(); - - if (searchContext == null) - searchContext = new SearchContext(); +void displayAxisByType(boolean showAllAxis, String axisLabel, List axis, String userId, SearchContext searchContext, Boolean activeThesaurus, Jargon jargon, ResourcesWrapper resource, String axisTypeIcon, JspWriter out) throws IOException { + SearchAxis searchAxis = null; + int axisId = -1; + String axisName = null; + int nbPositions = -1; + String valueInContext = null; + Value value = null; + String increment = ""; + String selected = ""; + String sNbObjects = ""; + String language = resource.getLanguage(); + + if (searchContext == null) { + searchContext = new SearchContext(userId); + } out.println(""); // il peut y avoir aucun axe primaire dans un 1er temps @@ -160,7 +161,7 @@ void displayAxisByType(boolean showAllAxis, String axisLabel, List axis, SearchC } if (!pertinentAxis.isEmpty()) { String axisIcon = resource.getIcon("pdcPeas.icoPrimaryAxis"); - displayAxisByType(false, "", pertinentAxis, searchContext, Boolean.FALSE, null, resource, axisIcon, out); + displayAxisByType(false, "", pertinentAxis, pdcSC.getUserId(), searchContext, Boolean.FALSE, null, resource, axisIcon, out); } searchAxis = pdcSC.getAxis("S"); @@ -174,6 +175,6 @@ void displayAxisByType(boolean showAllAxis, String axisLabel, List axis, SearchC } if (!pertinentAxis.isEmpty()) { String axisIcon = resource.getIcon("pdcPeas.icoSecondaryAxis"); - displayAxisByType(false, "", pertinentAxis, searchContext, Boolean.FALSE, null, resource, axisIcon, out); + displayAxisByType(false, "", pertinentAxis, pdcSC.getUserId(), searchContext, Boolean.FALSE, null, resource, axisIcon, out); } %> \ No newline at end of file diff --git a/web-core/src/main/java/com/silverpeas/pdc/web/PdcServiceProvider.java b/web-core/src/main/java/com/silverpeas/pdc/web/PdcServiceProvider.java index a7891fdd91e..c990bd02471 100644 --- a/web-core/src/main/java/com/silverpeas/pdc/web/PdcServiceProvider.java +++ b/web-core/src/main/java/com/silverpeas/pdc/web/PdcServiceProvider.java @@ -335,7 +335,7 @@ private int getSilverObjectId(String ofTheContent, String inTheComponent) throws } private SearchContext setUpSearchContextFromCriteria(final PdcFilterCriteria criteria) { - SearchContext context = new SearchContext(); + SearchContext context = new SearchContext(null); if (criteria.hasCriterionOnUser()) { context.setUserId(criteria.getUser().getId()); }