Exemplo n.º 1
0
  /** {@inheritDoc} */
  public String getNumberOfItemOrFileRequests(
      String reportDefinitionId, String objectId, AccountUserVO accountUser) throws Exception {

    List<StatisticReportRecordVO> reportRecordList =
        getStatisticReportRecord(reportDefinitionId, objectId, accountUser);

    int requests = 0;

    // Search for parameter with name "itemrequests" or "filerequests" in records
    // go through records and accumulate requests for different versions
    for (StatisticReportRecordVO record : reportRecordList) {
      List<StatisticReportRecordParamVO> parameterList = record.getParamList();

      for (StatisticReportRecordParamVO parameter : parameterList) {
        if (parameter.getName().equals("itemrequests")
            || parameter.getName().equals("filerequests")) {
          StatisticReportRecordDecimalParamValueVO decimalvalue =
              (StatisticReportRecordDecimalParamValueVO) parameter.getParamValue();
          requests += decimalvalue.getDecimalValue();
        }
      }
    }

    return String.valueOf(requests);
  }
Exemplo n.º 2
0
  public void logPubItemExport(
      PubItemVO pubItem,
      String ip,
      String userAgent,
      String sessionId,
      boolean loggedIn,
      String referer,
      ExportFormatVO exportFormat)
      throws Exception {
    List<StatisticReportRecordParamVO> paramList = new ArrayList<StatisticReportRecordParamVO>();
    StatisticReportRecordParamVO exportFormatParam = new StatisticReportRecordParamVO();
    exportFormatParam.setName("exportFormat");
    exportFormatParam.setParamValue(
        new StatisticReportRecordStringParamValueVO(exportFormat.getName()));
    paramList.add(exportFormatParam);

    StatisticReportRecordParamVO exportFileFormatParam = new StatisticReportRecordParamVO();
    exportFileFormatParam.setName("exportFileFormat");
    exportFileFormatParam.setParamValue(
        new StatisticReportRecordStringParamValueVO(
            exportFormat.getSelectedFileFormat().getName()));
    paramList.add(exportFileFormatParam);

    this.logPubItemAction(
        pubItem, ip, userAgent, ItemAction.EXPORT, sessionId, loggedIn, referer, paramList);
  }
Exemplo n.º 3
0
  private void logPubItemAction(
      PubItemVO pubItem,
      String ip,
      String userAgent,
      ItemAction action,
      String sessionId,
      boolean loggedIn,
      String referer,
      List<StatisticReportRecordParamVO> additionalParams)
      throws Exception {

    List<StatisticReportRecordParamVO> paramList = new ArrayList<StatisticReportRecordParamVO>();
    /*
     * List<CreatorVO> creatorList = pubItem.getMetadata().getCreators(); String persAffIds = "";
     * for(CreatorVO creator : creatorList) { if (creator.getPerson()!=null &&
     * creator.getPerson().getIdentifier()!=null &&
     * creator.getPerson().getIdentifier().getId()!=null &&
     * !creator.getPerson().getIdentifier().getId().equals("")) { persAffIds +=
     * creator.getPerson().getIdentifier().getId() + ","; } } StatisticReportRecordParamVO
     * persAffParam = new StatisticReportRecordParamVO(); persAffParam.setName("persAffId");
     * persAffParam.setParamValue(new StatisticReportRecordStringParamValueVO(persAffIds));
     * paramList.add(persAffParam);
     */

    StatisticReportRecordParamVO oaParam = new StatisticReportRecordParamVO();
    oaParam.setName("hasOAComponent");
    oaParam.setParamValue(
        new StatisticReportRecordStringParamValueVO(String.valueOf(getHasOAComponent(pubItem))));
    paramList.add(oaParam);

    String authorIds = "{";
    String orgIds = "{";
    List<CreatorVO> creatorList = pubItem.getMetadata().getCreators();
    for (CreatorVO creator : creatorList) {
      if (creator.getPerson() != null
          && creator.getPerson().getIdentifier() != null
          && creator.getPerson().getIdentifier().getId() != null
          && !creator.getPerson().getIdentifier().getId().equals("")) {
        // sl.logAuthorAction(sessionId, ip, creator.getPerson().getIdentifier().getId(), loggedIn,
        // referer, "pubman", null, AdminHelper.getAdminUserHandle());
        authorIds += creator.getPerson().getIdentifier().getId() + ",";
        /*
         * StatisticReportRecordParamVO authorIdsParam = new StatisticReportRecordParamVO();
         * authorIdsParam.setName("authorId"); authorIdsParam.setParamValue(new
         * StatisticReportRecordStringParamValueVO(creator.getPerson().getIdentifier().getId()));
         * paramList.add(authorIdsParam);
         */
      }

      /*
       * if(creator.getPerson()!=null && creator.getPerson().getOrganizationsSize()>0) {
       * for(OrganizationVO org : creator.getPerson().getOrganizations()) { if(org.getIdentifier()!=
       * null && !org.getIdentifier().equals("")) { //sl.logOrgAction(sessionId, ip,
       * org.getIdentifier(), loggedIn, referer, "pubman", null, AdminHelper.getAdminUserHandle());
       * orgIds += org.getIdentifier() + ",";
       *
       * // StatisticReportRecordParamVO orgIdsParam = new StatisticReportRecordParamVO(); //
       * orgIdsParam.setName("orgId"); // orgIdsParam.setParamValue(new
       * StatisticReportRecordStringParamValueVO(org.getIdentifier())); //
       * paramList.add(orgIdsParam);
       *
       * } } }
       */
      if (creator.getOrganization() != null
          && creator.getOrganization().getIdentifier() != null
          && !creator.getOrganization().getIdentifier().equals("")) {
        // sl.logOrgAction(sessionId, ip, creator.getOrganization().getIdentifier(), loggedIn,
        // referer, "pubman", null, AdminHelper.getAdminUserHandle());
        orgIds += creator.getOrganization().getIdentifier() + ",";

        /*
         * StatisticReportRecordParamVO orgIdsParam = new StatisticReportRecordParamVO();
         * orgIdsParam.setName("orgId"); orgIdsParam.setParamValue(new
         * StatisticReportRecordStringParamValueVO(creator.getOrganization().getIdentifier()));
         * paramList.add(orgIdsParam);
         */

      }
    }

    for (OrganizationVO org : getAffiliatedOrganizations(pubItem)) {
      if (org.getIdentifier() != null && !org.getIdentifier().equals("")) {
        orgIds += org.getIdentifier() + ",";
      }
    }
    authorIds += "}";
    orgIds += "}";

    StatisticReportRecordParamVO authorIdsParam = new StatisticReportRecordParamVO();
    authorIdsParam.setName("authorIds");
    authorIdsParam.setParamValue(new StatisticReportRecordStringParamValueVO(authorIds));
    paramList.add(authorIdsParam);

    StatisticReportRecordParamVO orgIdsParam = new StatisticReportRecordParamVO();
    orgIdsParam.setName("orgIds");
    orgIdsParam.setParamValue(new StatisticReportRecordStringParamValueVO(orgIds));
    paramList.add(orgIdsParam);

    if (additionalParams != null) {
      paramList.addAll(additionalParams);
    }

    // InitialContext ic = new InitialContext();
    // StatisticLogger sl = (StatisticLogger) ic.lookup(StatisticLogger.SERVICE_NAME);
    statisticLogger.logItemAction(
        sessionId,
        ip,
        userAgent,
        new PubItemVO(pubItem),
        action,
        loggedIn,
        referer,
        "pubman",
        paramList,
        AdminHelper.getAdminUserHandle());
  }