Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing bug #6550 Erreur lors la consultation du Plan de classement #607

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions ejb-core/pdc/src/main/java/com/silverpeas/pdc/ejb/PdcBmEJB.java
Expand Up @@ -78,7 +78,8 @@ public List<GlobalSilverContent> findGlobalSilverContents(
SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c);
}

return getSilverContentsByIds(silverContentIds);
SearchContext searchContext = (SearchContext) containerPosition;
return getSilverContentsByIds(silverContentIds, searchContext.getUserId());
}

@Override
Expand All @@ -97,7 +98,8 @@ public List<GlobalSilverContent> findGlobalSilverContents(
SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c);
}

return getSilverContentsByIds(silverContentIds);
SearchContext searchContext = (SearchContext) containerPosition;
return getSilverContentsByIds(silverContentIds, searchContext.getUserId());
}

@Override
Expand Down Expand Up @@ -234,9 +236,9 @@ public int addUsedAxis(UsedAxis usedAxis) {
}
}

private List<GlobalSilverContent> getSilverContentsByIds(List<Integer> silverContentIds) {
private List<GlobalSilverContent> getSilverContentsByIds(List<Integer> 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<GlobalSilverContent> alSilverContents = new ArrayList<GlobalSilverContent>();
Expand Down Expand Up @@ -279,7 +281,7 @@ private List<GlobalSilverContent> getSilverContentsByIds(List<Integer> silverCon
// we are going to search only SilverContent of this instanceId
ContentInterface contentInterface = contentP.getContentInterface();
silverContentTempo = contentInterface.getSilverContentById(
allSilverContentIds, instanceId, null, new ArrayList<String>());
allSilverContentIds, instanceId, userId, new ArrayList<String>());
} catch (ContentManagerException c) {
throw new PdcBmRuntimeException("PdcBmEJB.getSilverContentsByIds",
SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", c);
Expand Down
Expand Up @@ -589,7 +589,6 @@ public List<Value> getAxisValuesByName(String valueName) throws PdcException {
* @param valueId
* @return List of String
* @throws PdcException
* @see getDaughters
*/
@Override
public List<String> getDaughterValues(String axisId, String valueId)
Expand All @@ -615,11 +614,10 @@ public List<String> 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<Value> getFilteredAxisValues(String rootId, AxisFilter filter) throws PdcException {
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -838,7 +836,8 @@ public List<List<String>> 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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -1354,7 +1356,7 @@ public List<Value> 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<AxisHeader> axis, AxisHeader axisToCheck) {
Expand All @@ -1381,7 +1383,7 @@ private boolean isAxisNameExist(List<AxisHeader> 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<Value> values, Value valueToCheck) {
Expand Down Expand Up @@ -1683,7 +1685,10 @@ private boolean isAscendanteBaseValue(List<Integer> 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)
Expand All @@ -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)
Expand Down Expand Up @@ -2440,8 +2448,6 @@ public void indexAllAxis() throws PdcException {

/**
* Method declaration
* @param con
* @see
*/
private Connection openConnection() throws PdcException {
Connection con = null;
Expand Down Expand Up @@ -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();
Expand Down
Expand Up @@ -39,11 +39,8 @@ public class SearchContext implements ContainerPositionInterface, java.io.Serial
private ArrayList<SearchCriteria> criterias = new ArrayList<SearchCriteria>();
private String userId = null; // user who search

public SearchContext() {
}

public SearchContext(ArrayList<SearchCriteria> criterias) {
this.criterias = criterias;
public SearchContext(String userId) {
this.userId = userId;
}

public List<SearchCriteria> getCriterias() {
Expand Down
Expand Up @@ -567,7 +567,7 @@ private void getPertinentAxis(String spaceId, String componentId,
String userId, MainSessionController mainSC, Writer out)
throws PdcException, IOException {
List<SearchAxis> primaryAxis = null;
SearchContext searchContext = new SearchContext();
SearchContext searchContext = new SearchContext(userId);

PdcBm pdc = new PdcBmImpl();

Expand Down Expand Up @@ -634,8 +634,7 @@ private List<Value> getPertinentValues(String spaceId, String componentId,
throws IOException,
PdcException {
List<Value> daughters = null;
SearchContext searchContext = new SearchContext();
searchContext.setUserId(userId);
SearchContext searchContext = new SearchContext(userId);

if (StringUtil.isDefined(axisId)) {
PdcBm pdc = new PdcBmImpl();
Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Expand Up @@ -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<Value> values = getPdcBm().getPertinentDaughterValuesByInstanceIds(
new SearchContext(), axisId, valueId, getComponentList());
searchContext, axisId, valueId, getComponentList());

Value value = null;
if (values != null) {
Iterator<Value> i = values.iterator();
Value theValue = null;
Expand Down
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -336,7 +336,7 @@ public Collection<String[]> 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;
Expand Down Expand Up @@ -495,7 +495,7 @@ public Collection<String[]> getStatsConnexionGroupAll(String dateBegin, String d
dateEnd);
} catch (Exception e) {
SilverTrace.error("silverStatisticsPeas",
"SilverStatisticsPeasDAOConnexion.getStatsConnexionGroupAll",
"SilverStatisticsPeasSessionController.getStatsConnexionGroupAll",
"root.EX_SQL_QUERY_FAILED", e);
}
return c;
Expand All @@ -512,7 +512,7 @@ public Collection<String[]> 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;
Expand All @@ -527,7 +527,7 @@ public Collection<String[]> getStatsConnexionUserAll(String dateBegin, String da
dateEnd);
} catch (Exception e) {
SilverTrace.error("silverStatisticsPeas",
"SilverStatisticsPeasDAOConnexion.getStatsConnexionUserAll",
"SilverStatisticsPeasSessionController.getStatsConnexionUserAll",
"root.EX_SQL_QUERY_FAILED", e);
}
return c;
Expand All @@ -543,7 +543,7 @@ public Collection<String[]> 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;
Expand Down Expand Up @@ -805,7 +805,7 @@ public void retourVolumeUserPanelGroup() {
setAccessFilterLibGroup(getOrganisationController().getGroup(theGroup).getName());
}
SilverTrace.debug("silverStatisticsPeas",
"SilverStatisticsPeasSessionController.retourAccessUserPanelGroup()",
"SilverStatisticsPeasSessionController.retourVolumeUserPanelGroup()",
"accessFilterIdGroup=" + accessFilterIdGroup);
}

Expand All @@ -828,7 +828,7 @@ public void retourVolumeUserPanelUser() {
setAccessFilterLibUser(getOrganisationController().getUserDetail(theUser).getLastName());
}
SilverTrace.debug("silverStatisticsPeas",
"SilverStatisticsPeasSessionController.retourAccessUserPanelUser()",
"SilverStatisticsPeasSessionController.retourVolumeUserPanelUser()",
"accessFilterIdUser=" + accessFilterIdUser);
}

Expand Down Expand Up @@ -1484,11 +1484,11 @@ public List<StatisticVO> 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.");
}
Expand All @@ -1506,7 +1506,7 @@ public List<StatisticVO> getAxisStats(AxisStatsFilter statsFilter) {
private List<GlobalSilverContent> getPdCPublications(String axisId, String valueId,
List<String> 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);

Expand All @@ -1518,7 +1518,7 @@ private List<GlobalSilverContent> 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);
}
}
}
Expand All @@ -1543,7 +1543,7 @@ private List<GlobalSilverContent> 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);
}
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down