test_class.file: anhalytics-commons/src/test/java/fr/inria/anhalytics/commons/utilities/UtilitiesTest.java
test_class.identifier: UtilitiesTest
test_case.body: @Test
      public void testCompleteDate_onlyYM_shouldReturnCompletedDate() throws Exception {
          assertThat(Utilities.completeDate("2015-12"), is("2015-12-31"));
      }
test_case.class_method_signature: UtilitiesTest.testCompleteDate_onlyYM_shouldReturnCompletedDate()
test_case.full_signature: @Test public void testCompleteDate_onlyYM_shouldReturnCompletedDate()
test_case.identifier: testCompleteDate_onlyYM_shouldReturnCompletedDate
test_case.invocations: assertThat completeDate is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCompleteDate_onlyYM_shouldReturnCompletedDate()
focal_class.declarator: logger = LoggerFactory.getLogger(Utilities.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(Utilities.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: dates = new LinkedHashSet<String>()
focal_class.modifier: private static
focal_class.original_string: private static Set<String> dates = new LinkedHashSet<String>();
focal_class.type: Set<String>
focal_class.var_name: dates
focal_class.declarator: tmpPath
focal_class.modifier: private static
focal_class.original_string: private static String tmpPath;
focal_class.type: String
focal_class.var_name: tmpPath
focal_class.declarator: toDay = Calendar.getInstance()
focal_class.modifier: static
focal_class.original_string: static Calendar toDay = Calendar.getInstance();
focal_class.type: Calendar
focal_class.var_name: toDay
focal_class.declarator: todayYear = toDay.get(Calendar.YEAR)
focal_class.modifier: static
focal_class.original_string: static int todayYear = toDay.get(Calendar.YEAR);
focal_class.type: int
focal_class.var_name: todayYear
focal_class.declarator: minYear = 1900
focal_class.modifier: static
focal_class.original_string: static int minYear = 1900;
focal_class.type: int
focal_class.var_name: minYear
focal_class.declarator: fields
              = Arrays.asList("title", "term", "funder", "classCode", "p", "head", "figDesc", "item")
focal_class.modifier: private static
focal_class.original_string: private static List<String> fields
              = Arrays.asList("title", "term", "funder", "classCode", "p", "head", "figDesc", "item");
focal_class.type: List<String>
focal_class.var_name: fields
focal_class.file: anhalytics-commons/src/main/java/fr/inria/anhalytics/commons/utilities/Utilities.java
focal_class.identifier: Utilities
focal_class.class_method_signature: Utilities.setTmpPath(String tmp_path)
focal_class.full_signature: public static void setTmpPath(String tmp_path)
focal_class.identifier: setTmpPath
focal_class.modifiers: public static
focal_class.parameters: (String tmp_path)
focal_class.return: void
focal_class.signature: void setTmpPath(String tmp_path)
focal_class.class_method_signature: Utilities.getTmpPath()
focal_class.full_signature: public static String getTmpPath()
focal_class.identifier: getTmpPath
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getTmpPath()
focal_class.class_method_signature: Utilities.updateDates(String fromDate, String untilDate)
focal_class.full_signature: public static void updateDates(String fromDate, String untilDate)
focal_class.identifier: updateDates
focal_class.modifiers: public static
focal_class.parameters: (String fromDate, String untilDate)
focal_class.return: void
focal_class.signature: void updateDates(String fromDate, String untilDate)
focal_class.class_method_signature: Utilities.daysInMonth(int year, int month)
focal_class.full_signature: protected static int daysInMonth(int year, int month)
focal_class.identifier: daysInMonth
focal_class.modifiers: protected static
focal_class.parameters: (int year, int month)
focal_class.return: int
focal_class.signature: int daysInMonth(int year, int month)
focal_class.class_method_signature: Utilities.isValidDate(String dateString)
focal_class.full_signature: public static boolean isValidDate(String dateString)
focal_class.identifier: isValidDate
focal_class.modifiers: public static
focal_class.parameters: (String dateString)
focal_class.return: boolean
focal_class.signature: boolean isValidDate(String dateString)
focal_class.class_method_signature: Utilities.completeDate(String date)
focal_class.full_signature: public static String completeDate(String date)
focal_class.identifier: completeDate
focal_class.modifiers: public static
focal_class.parameters: (String date)
focal_class.return: String
focal_class.signature: String completeDate(String date)
focal_class.class_method_signature: Utilities.toString(Document doc)
focal_class.full_signature: public static String toString(Document doc)
focal_class.identifier: toString
focal_class.modifiers: public static
focal_class.parameters: (Document doc)
focal_class.return: String
focal_class.signature: String toString(Document doc)
focal_class.class_method_signature: Utilities.innerXmlToString(Node node)
focal_class.full_signature: public static String innerXmlToString(Node node)
focal_class.identifier: innerXmlToString
focal_class.modifiers: public static
focal_class.parameters: (Node node)
focal_class.return: String
focal_class.signature: String innerXmlToString(Node node)
focal_class.class_method_signature: Utilities.findNode(String attribut, String value, NodeList orgs)
focal_class.full_signature: public static Element findNode(String attribut, String value, NodeList orgs)
focal_class.identifier: findNode
focal_class.modifiers: public static
focal_class.parameters: (String attribut, String value, NodeList orgs)
focal_class.return: Element
focal_class.signature: Element findNode(String attribut, String value, NodeList orgs)
focal_class.class_method_signature: Utilities.generateIDs(Document doc)
focal_class.full_signature: public static void generateIDs(Document doc)
focal_class.identifier: generateIDs
focal_class.modifiers: public static
focal_class.parameters: (Document doc)
focal_class.return: void
focal_class.signature: void generateIDs(Document doc)
focal_class.class_method_signature: Utilities.generateID(NodeList theNodes)
focal_class.full_signature: private static void generateID(NodeList theNodes)
focal_class.identifier: generateID
focal_class.modifiers: private static
focal_class.parameters: (NodeList theNodes)
focal_class.return: void
focal_class.signature: void generateID(NodeList theNodes)
focal_class.class_method_signature: Utilities.trimEOL(Node node, Document doc)
focal_class.full_signature: public static void trimEOL(Node node, Document doc)
focal_class.identifier: trimEOL
focal_class.modifiers: public static
focal_class.parameters: (Node node, Document doc)
focal_class.return: void
focal_class.signature: void trimEOL(Node node, Document doc)
focal_class.class_method_signature: Utilities.clearTmpDirectory()
focal_class.full_signature: public static void clearTmpDirectory()
focal_class.identifier: clearTmpDirectory
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearTmpDirectory()
focal_class.class_method_signature: Utilities.storeTmpFile(InputStream inBinary)
focal_class.full_signature: public static String storeTmpFile(InputStream inBinary)
focal_class.identifier: storeTmpFile
focal_class.modifiers: public static
focal_class.parameters: (InputStream inBinary)
focal_class.return: String
focal_class.signature: String storeTmpFile(InputStream inBinary)
focal_class.class_method_signature: Utilities.storeToTmpXmlFile(InputStream inBinary)
focal_class.full_signature: public static String storeToTmpXmlFile(InputStream inBinary)
focal_class.identifier: storeToTmpXmlFile
focal_class.modifiers: public static
focal_class.parameters: (InputStream inBinary)
focal_class.return: String
focal_class.signature: String storeToTmpXmlFile(InputStream inBinary)
focal_class.class_method_signature: Utilities.getBinaryURLContent(File file, InputStream in)
focal_class.full_signature: public static void getBinaryURLContent(File file, InputStream in)
focal_class.identifier: getBinaryURLContent
focal_class.modifiers: public static
focal_class.parameters: (File file, InputStream in)
focal_class.return: void
focal_class.signature: void getBinaryURLContent(File file, InputStream in)
focal_class.class_method_signature: Utilities.formatDate(Date date)
focal_class.full_signature: public static String formatDate(Date date)
focal_class.identifier: formatDate
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: String
focal_class.signature: String formatDate(Date date)
focal_class.class_method_signature: Utilities.parseStringDate(String dateString)
focal_class.full_signature: public static Date parseStringDate(String dateString)
focal_class.identifier: parseStringDate
focal_class.modifiers: public static
focal_class.parameters: (String dateString)
focal_class.return: Date
focal_class.signature: Date parseStringDate(String dateString)
focal_class.class_method_signature: Utilities.getHalIDFromHalDocID(String halDocID)
focal_class.full_signature: public static String getHalIDFromHalDocID(String halDocID)
focal_class.identifier: getHalIDFromHalDocID
focal_class.modifiers: public static
focal_class.parameters: (String halDocID)
focal_class.return: String
focal_class.signature: String getHalIDFromHalDocID(String halDocID)
focal_class.class_method_signature: Utilities.getVersionFromURI(String uri)
focal_class.full_signature: public static String getVersionFromURI(String uri)
focal_class.identifier: getVersionFromURI
focal_class.modifiers: public static
focal_class.parameters: (String uri)
focal_class.return: String
focal_class.signature: String getVersionFromURI(String uri)
focal_class.class_method_signature: Utilities.getHalURIFromFilename(String filename)
focal_class.full_signature: public static String getHalURIFromFilename(String filename)
focal_class.identifier: getHalURIFromFilename
focal_class.modifiers: public static
focal_class.parameters: (String filename)
focal_class.return: String
focal_class.signature: String getHalURIFromFilename(String filename)
focal_class.class_method_signature: Utilities.getDates()
focal_class.full_signature: public static Set<String> getDates()
focal_class.identifier: getDates
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: Set<String>
focal_class.signature: Set<String> getDates()
focal_class.class_method_signature: Utilities.trimEncodedCharaters(String string)
focal_class.full_signature: public static String trimEncodedCharaters(String string)
focal_class.identifier: trimEncodedCharaters
focal_class.modifiers: public static
focal_class.parameters: (String string)
focal_class.return: String
focal_class.signature: String trimEncodedCharaters(String string)
focal_class.class_method_signature: Utilities.unzipIt(String file, String outPath)
focal_class.full_signature: public static void unzipIt(String file, String outPath)
focal_class.identifier: unzipIt
focal_class.modifiers: public static
focal_class.parameters: (String file, String outPath)
focal_class.return: void
focal_class.signature: void unzipIt(String file, String outPath)
focal_class.class_method_signature: Utilities.readFile(String fileName)
focal_class.full_signature: public static String readFile(String fileName)
focal_class.identifier: readFile
focal_class.modifiers: public static
focal_class.parameters: (String fileName)
focal_class.return: String
focal_class.signature: String readFile(String fileName)
focal_class.class_method_signature: Utilities.request(String request)
focal_class.full_signature: public static InputStream request(String request)
focal_class.identifier: request
focal_class.modifiers: public static
focal_class.parameters: (String request)
focal_class.return: InputStream
focal_class.signature: InputStream request(String request)
focal_class.class_method_signature: Utilities.getConnection(URL url)
focal_class.full_signature: private static final HttpURLConnection getConnection(URL url)
focal_class.identifier: getConnection
focal_class.modifiers: private static final
focal_class.parameters: (URL url)
focal_class.return: HttpURLConnection
focal_class.signature: HttpURLConnection getConnection(URL url)
focal_class.class_method_signature: Utilities.formatXMLString(String xmlString)
focal_class.full_signature: public static String formatXMLString(String xmlString)
focal_class.identifier: formatXMLString
focal_class.modifiers: public static
focal_class.parameters: (String xmlString)
focal_class.return: String
focal_class.signature: String formatXMLString(String xmlString)
focal_class.class_method_signature: Utilities.checkPath(String path)
focal_class.full_signature: public static void checkPath(String path)
focal_class.identifier: checkPath
focal_class.modifiers: public static
focal_class.parameters: (String path)
focal_class.return: void
focal_class.signature: void checkPath(String path)
focal_class.class_method_signature: Utilities.convertStreamToString(InputStream is)
focal_class.full_signature: static public String convertStreamToString(InputStream is)
focal_class.identifier: convertStreamToString
focal_class.modifiers: static public
focal_class.parameters: (InputStream is)
focal_class.return: String
focal_class.signature: String convertStreamToString(InputStream is)
focal_class.class_method_signature: Utilities.removeAccents(String input)
focal_class.full_signature: public final static String removeAccents(String input)
focal_class.identifier: removeAccents
focal_class.modifiers: public final static
focal_class.parameters: (String input)
focal_class.return: String
focal_class.signature: String removeAccents(String input)
focal_class.class_method_signature: Utilities.getElementByAttribute(String attr, String value, Element root)
focal_class.full_signature: public final static Element getElementByAttribute(String attr, String value, Element root)
focal_class.identifier: getElementByAttribute
focal_class.modifiers: public final static
focal_class.parameters: (String attr, String value, Element root)
focal_class.return: Element
focal_class.signature: Element getElementByAttribute(String attr, String value, Element root)
focal_class.class_method_signature: Utilities.matchAuthor(String fullname, NodeList authorsFromfulltextTeiHeader)
focal_class.full_signature: public static Element matchAuthor(String fullname, NodeList authorsFromfulltextTeiHeader)
focal_class.identifier: matchAuthor
focal_class.modifiers: public static
focal_class.parameters: (String fullname, NodeList authorsFromfulltextTeiHeader)
focal_class.return: Element
focal_class.signature: Element matchAuthor(String fullname, NodeList authorsFromfulltextTeiHeader)
focal_method.body: public static String completeDate(String date) {
          if (date.endsWith("-")) {
              date = date.substring(0, date.length()-1);
          }
  
          String val = "";
          if (date.length() < 4) {
              return val;
          } else if (date.length() == 4) {
              val = date + "-12-31";
          } else if ((date.length() == 7) || (date.length() == 6)) {
              int ind = date.indexOf("-");
              String monthStr = date.substring(ind + 1, date.length());
              if (monthStr.length() == 1) {
                  monthStr = "0" + monthStr;
              }
              if (monthStr.equals("02")) {
                  val = date.substring(0, 4) + "-" + monthStr + "-28";
              } else if ((monthStr.equals("04")) || (monthStr.equals("06")) || (monthStr.equals("09"))
                      || (monthStr.equals("11"))) {
                  val = date.substring(0, 4) + "-" + monthStr + "-30";
              } else {
                  int month = Integer.parseInt(monthStr);
                  if (month > 12 || month < 1) {
                      monthStr = "12";
                  }
                  val = date.substring(0, 4) + "-" + monthStr + "-31";
              }
          } else {
              int ind = date.indexOf("-");
              int ind2 = date.lastIndexOf("-");
              String monthStr = date.substring(ind + 1, ind + 3);
              try {
                  int month = Integer.parseInt(monthStr);
                  if (month > 12 || month < 1) {
                      val = date.substring(0, 4) + "-12" + date.substring(ind + 3, date.length());
                  }
                  String dayStr = date.substring(ind2 + 1, ind2 + 3);
                  int day = Integer.parseInt(dayStr);
                  if (day > 31 || day < 1) {
                      val = date.substring(0, 8) + "28";// so naif i know
                  }
              } catch (Exception e) {
              }
              val = date.trim();
              // we have the "lazy programmer" case where the month is 00, e.g. 2012-00-31
              // which means the month is unknown
  
              ///val = val.replace("-00-", "-12-");
          }
          val = val.replace(" ", "T"); // this is for the dateOptionalTime elasticSearch format 
  
          if (!val.matches("\\d{4}-\\d{2}-\\d{2}") || (Integer.parseInt(val.substring(0, 4)) < minYear || todayYear < Integer.parseInt(val.substring(0, 4)))) {
              val = "";
          }
          return val;
      }
focal_method.class_method_signature: Utilities.completeDate(String date)
focal_method.full_signature: public static String completeDate(String date)
focal_method.identifier: completeDate
focal_method.invocations: endsWith substring length length length length length indexOf substring length length equals substring equals equals equals equals substring parseInt substring indexOf lastIndexOf substring parseInt substring substring length substring parseInt substring trim replace matches parseInt substring parseInt substring
focal_method.modifiers: public static
focal_method.parameters: (String date)
focal_method.return: String
focal_method.signature: String completeDate(String date)