コード例 #1
0
  private void manageEventInfo(GetItemResponse response, String operation) {
    FieldInformationCollection fields = response.getFields();

    FieldInformation[] fieldsInformation = fields.getFieldInformation();

    String createdBy = null;
    String modifiedBy = null;
    String created = null;

    String modified = null;
    String contentType = null;
    String eventCreationDate = null;
    String eventAuthor = null;
    HashMap<String, String> hm = new HashMap<String, String>();

    for (int i = 0; i < fieldsInformation.length; i++) {
      FieldInformation field = fieldsInformation[i];
      String name = field.getInternalName();
      if (name.equalsIgnoreCase("BaseName")) {
        fileName = field.getValue();
        eventResult.setTitle(fileName);
      }
      if (name.equalsIgnoreCase("Created_x0020_By")) {
        createdBy = field.getValue();
      }
      if (name.equalsIgnoreCase("Modified_x0020_By")) {
        modifiedBy = field.getValue();
      }
      if (name.equalsIgnoreCase("Created_x0020_Date")) {
        created = field.getValue();
      }
      if (name.equalsIgnoreCase("Last_x0020_Modified")) {
        modified = field.getValue();
      }
      if (name.equalsIgnoreCase("File_x0020_Type")) {
        contentType = field.getValue();
      }
      if (name.equalsIgnoreCase("Process")) {
        String processValue[] = field.getValue().split("-");
        hm.put("kpeopletag", processValue[0]);
      }
    }

    if (operation.equalsIgnoreCase("modified")) {
      eventCreationDate = modified;
      eventAuthor = modifiedBy;
    }
    if (operation.equalsIgnoreCase("created")) {
      eventCreationDate = created;
      eventAuthor = createdBy;
    }

    eventResult.setContentType(contentType);

    eventResult.setCreationDate(ActionDataProcessorUtil.getDateString(eventCreationDate));
    Author author = new Author();
    author.setUsername(eventAuthor);
    eventResult.setAuthor(author);
    eventResult.setProperties(hm);
    // eventResult.setAuthor(eventAuthor);

  }