diff --git a/AH-TreeReader/.~lock.Categories.ods# b/AH-TreeReader/.~lock.Categories.ods# new file mode 100644 index 0000000..6b563a2 --- /dev/null +++ b/AH-TreeReader/.~lock.Categories.ods# @@ -0,0 +1 @@ +,tilman,tilman-ThinkPad-T420,14.05.2017 15:51,file:///home/tilman/.config/libreoffice/4; \ No newline at end of file diff --git a/AH-TreeReader/Categories.ods b/AH-TreeReader/Categories.ods new file mode 100644 index 0000000..39813e2 Binary files /dev/null and b/AH-TreeReader/Categories.ods differ diff --git a/AH-TreeReader/categories.txt b/AH-TreeReader/categories.txt new file mode 100644 index 0000000..d172a1d --- /dev/null +++ b/AH-TreeReader/categories.txt @@ -0,0 +1,577 @@ +;Advertising Media +;;Brands & Concepts CAP +;;;Advantage +;;;;2006 - Makeover Kit Packaging +;;;;2008 - Speed of Flea Kill +;;;;2010 - CAP Parasiticides +;;;;2012 - Rabbit Detailer +;;;;2013 - Advantage vs. Activyl Detailer +;;;;2013 - Flea Escape Game +;;;;2014 - Cat to the Vet Detailer +;;;;2015 - Toolbox +;;;;2016 - Cat Breeds Poster +;;;;FSM Detailer +;;;Advantix +;;;;Concepts - Toolkits +;;;;;2003 - Free the Dog - Toolkit +;;;;;2006 - Go to the Max - Toolkit +;;;;;2012 - Tape Campaign +;;;;;2016 - No Bite Campaign +;;;;;2017 - Advantix Toolbox +;;;;Detailer +;;;;;2004 - eDetailer & Virtual Detailer +;;;;;2007 - eDetailer & Virtual Detailer +;;;;;2008 - New evidence of efficacy +;;;;;2009 - Detailer Ehrlichosis +;;;;;2010 - Otranto Detailer +;;;;;2012 - LeishVet Detailer +;;;;;2013 - Detailer - Ehrlichia +;;;;;2013 - eDetailer +;;;;;2015 - H2H Detailer +;;;;;2016 - Advantix H2H eDetailer +;;;;Info Website +;;;Advocate +;;;;2006 - Technical Manual +;;;;2007 - Advocate Meets Advocate Toolkit +;;;;2007 - Launch Campaign Toolkit +;;;;2007 - New Indications +;;;;2008 - Lice Management +;;;;2008 - The Endectocide +;;;;2009 - Baermann Protocol +;;;;2009 - Detailer Angiostrongylus Vasorum +;;;;2009 Ferret +;;;;;Communication Strategy +;;;;;Market Research +;;;;;PR +;;;;;Veterinary Services Support +;;;;2009/2010 - Lifecycle Aelurostrongylus abstrusus +;;;;2010 - Lifecycle Crenosoma +;;;;2010/2011 - Detailers +;;;;2011 - Speed of Flea kill Detailer +;;;;2013 - Evolution Campaign +;;;;2014 - Advocate Advertorials +;;;;2014 - Advocate eDetailer +;;;;2015 - D. repens Detailer +;;;;2015 - Global website Localization Docs +;;;;2015 - Steady State Detailer +;;;;2016 - Advocate Vet Ad +;;;;2016 - Diagnosis of Mites +;;;;2017 - Advocate Poster +;;;Baytril +;;;;2000 - Intelligence at Work - Toolkit +;;;;2009 - New Branding Campaign Toolkit +;;;;2009 - Baytril Symposium Florence +;;;;2011 - Oral Suspension +;;;;2013/14 - Clinical Cases +;;;Bolfo/Bay-o-Pet +;;;CVBD +;;;;2009 - Risk Map +;;;;2010 - Canine Leishmaniosis +;;;;2010 - Clinic Manual +;;;;2011 - CVBD, Idexx +;;;;2012 - CVBD World Forum recommendations +;;;;2013 - CVBD Diagnostic Paths +;;;;2013 - CVBD Diagnostic Poster +;;;;2014 - CVBD Digest +;;;;CVBD Feline Clinical Cases +;;;;CVBD Symposia +;;;Drontal +;;;;2007 - Wormers +;;;;2010 - Giardia +;;;;2012 - Vet Detailer +;;;;2013 - Drontal Tasty Communication +;;;;2015 - Drontal eDetailer +;;;;2016 - Digital Game +;;;;2016 - Giardia +;;;;2017 - Drontal Tasty XL Images +;;;Procox +;;;;2011 - Procox Launch Communication Concept +;;;;;Packshots +;;;;2012 - Brand Guideline +;;;;2012 - Easy digest 1, Coccidia +;;;;2014 - Procox Positioning Video +;;;Profender +;;;;Profender Cat +;;;;;2005 - Launch Campaign - Toolkit +;;;;;2005 - Technical Manual +;;;;;2008 - Spot-on Toolkit +;;;;;2011 - Spot on Detailer +;;;;;2011 - Tapeworm Materials +;;;;;2011 - Vet Ad +;;;;;2012 - Comparative study vet detailer +;;;;;2013 - iPad eDetailer materials +;;;;;2016 - Cat Breeds Poster +;;;;;2016 - Happy Cat Campaign +;;;;Profender Dog +;;;;;2009 - Tablets Launch Concept +;;;;;2011 - Advocate MDR1 +;;;;;2011 - Toxocara canis in dogs +;;;;;2012 - Vet Detailer +;;;Seresto +;;;;Augmented Reality +;;;;Blogger Materials +;;;;;Blogger Box +;;;;;Guideline +;;;;;Microsite +;;;;Brand Guideline +;;;;Conference Material +;;;;;PowerPoint Templates +;;;;PR Material +;;;;Pet Owner Material +;;;;;Images TV Spot +;;;;;Key Visuals +;;;;Seresto Images +;;;;Technical Manual +;;;;Vet /Nurse Material +;;;;;Advertisements +;;;;;Print Detailer +;;;;;eDetailer +;;;Veraflox +;;;;2011 - Veraflox Brands +;;;;;Key Visuals +;;;;;Pictograms +;;;;2013 - Laboratory card +;;;;2013 - Product Manual +;;;;2014 - Concept "Reduce the risk of recurrens" +;;;;AI Symposium Proceedings +;;;;Clinical Cases +;;;;Veraflox Symposium +;;;miscellaneous +;;;;2009 - Symposium ESVD/ECVD +;;;;2011 - Dog Breed Poster +;;;;2013 - A. ceylanicum detailer for Asia +;;;;2013 - Egg Shedding Leaflet +;;;;2013 - WSAVA CE Ad +;;;;2014 - Worming Tool +;;;;2016 - Endo Book +;;;;Bayer Parasite Solutions +;;;;;2007 - UK / Lucy and Banjo +;;;;;2008 - Manual for small mammals +;;;;;2009 - BPS Poster +;;;;;2012 - BPS Finder +;;;;;2014 - BPS Advertisement +;;;;;2015 - BPS Finder for iPads +;;;;;BPS Artwork +;;;;;BPS Calendar +;;;;;BPS Screensaver +;;;;Dermatology Brochure +;;Brands & Concepts FAP +;;;Baycox +;;;;Baycox Bovis +;;;;;2012 - Toolkit +;;;;;2013 - iPad eDetailer +;;;;;2016 - Baycox Bovis Detailer +;;;;Baycox Lamb +;;;;Baycox Poultry +;;;;Baycox Swine +;;;;;2010 - Old Concept: Gain more by preventing coccidiosis +;;;;;2012 - Toolkit +;;;;;2015/16 - Baycox Iron Oral +;;;;;;Images +;;;;;2016 - Baycox Swine Detailer +;;;;Baycox Technical Information +;;;;Videos/Animations +;;;;;Baycox Bovis +;;;;;Baycox Lamb +;;;;;Baycox Swine +;;;Bayticol +;;;Baytril +;;;;Brand Guide +;;;;Cattle +;;;;;Advertisements +;;;;;Mastitis Technical Manual +;;;;MPC Concept +;;;;Poultry +;;;;;Advertisements +;;;;;Brochures & Manuals +;;;;Swine +;;;;;Advertisements +;;;;;Brochures & Manuals +;;;;;eDetailer +;;;Bayvarol +;;;;Bayvarol Perizin Checkmite - Toolkit +;;;;;Animated PowerPoint Presentation +;;;;;Give Aways +;;;Biosecurity +;;;;2014 - eDetailer +;;;Catosal +;;;;2008 - Trust Pink Toolkit +;;;;2011 - Metabolic Moments +;;;;Body Condition Score +;;;Ceffect +;;;Dairy Products +;;;Honey bee care +;;;;Images +;;;Polyvar +;;;Transforming Livestock Production +;;;;TLP Pictograms +;;;Victrio +;;;Zelnate +;;;;Brand Guide +;;;;Digital +;;;;Logo +;;;;Print +;;;;Videos +;;Copyright Templates +;;Guidelines +;;;AH Meeting Culture +;;;Agency Briefing Templates +;;;BAH eDetailer Template +;;;CAP Brand/Packaging Design +;;;;Advantage Family +;;;;Bolfo/Bayopet (OTC) +;;;;Drontal Product Family +;;;;Ethical Pack +;;;;Kiltix Products +;;;;Lifestyle Photography 2017 +;;;;Profender Products +;;;;Seresto Packaging +;;;FAP Brand/Packaging Design +;;;;Farm Animal Products +;;;;Farmhygiene Products +;;;Global Exhibit Design Manual +;;;Training Tools - MediaAssistant +;;Images +;;;Applications +;;;Different animals together +;;;Disease Symptoms +;;;;Organs +;;;;Skin +;;;Examination/Sampling +;;;Illustrations +;;;;Animals and people +;;;;Application +;;;;Art +;;;;;Cat and DogART, Portugal +;;;;;Cat and DogART, Prague +;;;;;CattleART +;;;;;PigART +;;;;;PoultryART +;;;;;SheepART +;;;;Cells and microorganisms +;;;;Lifecycles & Routes of infection +;;;;Maps +;;;;Parasites +;;;;Pictograms +;;;Insects and arachnids +;;;;Fleas +;;;;Flies +;;;;Lice +;;;;Mites +;;;;Mosquitoes +;;;;Ticks +;;;Laboratory +;;;Microorganism +;;;People +;;;People with animals +;;;Target animals +;;;;Birds +;;;;Cats +;;;;Cattle +;;;;Dogs +;;;;Honey bees +;;;;;Flowers +;;;;Horses +;;;;Poultry +;;;;Reptiles and turtles +;;;;Sheep +;;;;Small furry animals +;;;;Swine +;;;;Zoo and other animals +;;;Worms (Helminths) +;;;;Roundworms +;;;;Tapeworms +;;Logos +;;Packshots +;;;Advantage +;;;Advantix +;;;Advocate +;;;Baycox +;;;Baytril +;;;Bolfo/Bay-o-Pet +;;;Byemite +;;;Catosal +;;;Clavobay +;;;Droncit +;;;Drontal +;;;Procox +;;;Profender +;;;Seresto +;;;Veraflox +;;Video Library +;;;Events +;;;;CVBD +;;;Films by Brand +;;;;Advantage +;;;;Advantix / K9 Advantix +;;;;;No Bite +;;;;;Repel & Kill - 2014 +;;;;Advocate/Advantage Multi +;;;;Baycox +;;;;Bayer Parasite Solutions +;;;;Catosal +;;;;Drontal +;;;;Procox +;;;;Profender Cat +;;;;Profender Dog +;;;;Seresto +;;;;Veraflox +;;;;Victrio +;;;;Zelnate +;;;Films by Indication +;;;;Flea +;;;;Giardia +;;;;Mite +;;;;Mosquito +;;;;Tick +;;;;Worms +;;;;;Aelurostrongylus abstrusus +;;;;;Angiostrongylus vasorum +;;;;;Dirofilaria immitis +;;;;;Dirofilaria repens +;;;;;Toxocara +;;;;Zoonosis +;;;TV Commercials +;;;;Advantix / K9 Advantix +;;;;Advocate / Advantage Multi +;;;;Seresto +;BAH Image series +;;Image series 1 +;;Image series 2 +;BAH Internal Videos +;BAH Webshop +;;Advantage +;;Advantix +;;Advocate +;;BAH in general +;;Baycox +;;Bayer Parasite Solution +;;Bayticol +;;Baytril +;;Baytril CAP +;;Bayvarol +;;Bolfo +;;Byemite +;;CVBD Congress +;;Catosal +;;Cattle Art +;;Drontal +;;ESFM Congress +;;Foresto +;;IPVS Congress +;;Kiltix +;;NAVC +;;Pen +;;Perizin +;;Pig ART +;;Procox +;;Profender +;;Renalzin +;;Rompun +;;Sebacil +;;Seresto +;;TLP Transforming LIvestock Production +;;Technical Supplement +;;Veraflox +;;Veterinary Parasitology +;;WAAVP Congress +;;WBC Congress +;;Watches +;BAH archive +;;Advertising Media +;;;CAP +;;;;Acticam +;;;;Advantage +;;;;Advantix +;;;;;CVBD WebConference +;;;;;;2014 +;;;;;;2015 +;;;;Advocate +;;;;;Poster +;;;;BPS +;;;;Baytril +;;;;Catosal +;;;;Clavobay +;;;;Dermatology +;;;;Droncit +;;;;Drontal +;;;;Fuciderm, Fucidin, Conoptal +;;;;Hyonate +;;;;Kiltix +;;;;Miscellaneous +;;;;Profender +;;;;Renalzin +;;;;Seresto +;;;;;2012 - Client education +;;;;;2012 - Launch +;;;;;Augmented Reality +;;;;;OTC +;;;;;POM +;;;;;Seresto Profender +;;;;;Seresto e-detailer +;;;;Veraflox +;;;FAP +;;;;Baycox +;;;;;Baycox Bovis Toolkit (Old) +;;;;;;Awareness Campaign +;;;;;;Images Baycox bovis Toolkit +;;;;;;Launch Campaign +;;;;;Baycox Brand Communication 2009 +;;;;;;Key Visuals +;;;;;;Logos +;;;;;Baycox Lamb Toolkit +;;;;;;Images Baycox Lamb Toolkit +;;;;;Baycox Piglet Launch Campaign - Toolkit +;;;;;;Baycox Piglet Images +;;;;;Baycox Poultry +;;;;;;Images Baycox Poultry +;;;;;The European Campaigns +;;;;;;Awareness +;;;;;;Launch +;;;;Bayticol +;;;;;Images +;;;;Baytril +;;;;; Baytril International Communication Concepts +;;;;;;Images +;;;;;Baytril - Communication Concept 2011 +;;;;;;Images +;;;;;Baytril 1nject Concept +;;;;;;Images +;;;;;Baytril Eyecatcher Campaign +;;;;;;Images +;;;;;Baytril MPC Brochure +;;;;;;Images +;;;;;Baytril The right choice Toolkit +;;;;;;Images +;;;;;Baytril against Mastitis - Technical manual +;;;;;;Images +;;;;;Baytril max -Advertising Concept 1998 +;;;;;;Images +;;;;;;Technical Manual +;;;;;;;Images +;;;;Bayvarol +;;;;;Bayvarol Perizin Checkmite - Toolkit +;;;;;;Images +;;;;ByeMite +;;;;;ByeMite Say Goodbye to Red Mites - The Toolkit +;;;;;;Images +;;;;;Images +;;;;Catosal +;;;;;Metabolic Moments 2011 +;;;;;;Images +;;;;;Trust Pinkt Toolkit 2008 +;;;;;;Images +;;;;Dairy Products +;;;;Profitable Biosecurity Solutions - Toolkit +;;;;Prolongal +;;;;TLP +;;;;;Images +;;Give Aways +;;Graphics/tables +;;Guidelines +;;;Advocate Guideline 2009 +;;;CAP Brand Design +;;;;Advantage family +;;;;Drontal Plus +;;;;HOB 2000 +;;;;Kiltix +;;;;Packaging Design 1996 +;;;;Pet Care Products (OTC) +;;;;Profender +;;;;Seresto +;;;;;Packaging Images +;;;FAP Brand Design +;;;;Farm Animal Products +;;;;Farmhygiene Products +;;;Packaging +;;;;Absolut +;;;;Advantage +;;;;Advantix +;;;Training Tools MA +;;;eDetailer Template +;;Illustrations +;;Images +;;;Animals +;;;;Bees +;;;;Benelux Images black/white +;;;;Cats +;;;;Cattle +;;;;Dogs +;;;;Ectoparasites in pictures +;;;;Horses +;;;;Images from Mexico +;;;;Insects and arachnids +;;;;;Red bird mite +;;;;Poultry +;;;;Sheep ticks and control +;;;;Sheeps +;;;;Small furry animals +;;;;Swine +;;;;Ticks and tickborne +;;;;Worms +;;;Application +;;;Different animals together +;;;Disease symptoms +;;;;Myiases +;;;Events +;;;;CVBD symposium, Billesley 2006 +;;;;WSAVA 2006, Prag +;;;Microorganisms +;;;Microscope images +;;;;LM images +;;;;SEM images +;;;People +;;;People and animals +;;;;Advantix, 2003 - Free the dog Toolkit +;;Logos +;;PR & Congresses +;;;Congresses +;;;;Angio Forum +;;;;CVBD +;;;;ECVIM +;;;;ESFM +;;;;ESVD +;;;;IPVS, WBC +;;;Public Relations +;;;;Brand PR +;;;;Press Releases +;;Packshots +;;Videos +;;;CAP +;;;;Advantage +;;;;Advantix +;;;;Advocate +;;;;BPS +;;;;Baytril +;;;;Drontal +;;;;Profender +;;;;Renalzin +;;;;Rompun +;;;;Seresto +;;;;Worms +;;;Events +;;;;Baytril Symposium 2009 Florence +;;;;CVBD / Zoonosis +;;;;GM Workshop 2011, Krefeld +;;;;IPVS 2010 +;;;;Parasite Exhibition Museum +;;;;WBC +;;;FAP +;;;;Baycox +;;;;Baytril +;;;;Bye Mite +;;;Historical films +;;;Marketing Excellence +;;;TV Spots +;;;Webinars +;;Webshop +;;;Clothes +;;;Special Edition +;M-CAP-Links +;;AI Symposia +;;Advocate D repens SEM '16 +;;AngioSEM +;;Baytril CC +;;CVBD +;;Veraflox Det +;Medical Care diff --git a/AH-TreeReader/pom.xml b/AH-TreeReader/pom.xml index c29fb20..793ac99 100644 --- a/AH-TreeReader/pom.xml +++ b/AH-TreeReader/pom.xml @@ -16,6 +16,11 @@ httpmime 4.5.3 + + commons-io + commons-io + 2.5 + diff --git a/AH-TreeReader/src/de/tilman/AHTreeReader/AHTreeReader.java b/AH-TreeReader/src/de/tilman/AHTreeReader/AHTreeReader.java index a774976..8e2736b 100644 --- a/AH-TreeReader/src/de/tilman/AHTreeReader/AHTreeReader.java +++ b/AH-TreeReader/src/de/tilman/AHTreeReader/AHTreeReader.java @@ -1,6 +1,7 @@ package de.tilman.AHTreeReader; import java.io.ByteArrayInputStream; +import java.io.File; import java.nio.charset.StandardCharsets; import javax.xml.parsers.DocumentBuilder; @@ -10,6 +11,7 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; +import org.apache.commons.io.FileUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.client.methods.CloseableHttpResponse; @@ -37,6 +39,8 @@ public class AHTreeReader { DocumentBuilder builder; XPath xpath = XPathFactory.newInstance().newXPath(); + File file = new File("categories.txt"); + public AHTreeReader() { System.out.println("Aloha, funky time"); @@ -53,18 +57,26 @@ public class AHTreeReader { builder = factory.newDocumentBuilder(); getMainCategories(); - getSubcategories(tree.root); + getSubcategories(tree.root, 1); } catch (Exception e) { e.printStackTrace(); } } - private void getSubcategories(TreeNode node) throws Exception { + private void getSubcategories(TreeNode node, int level) throws Exception { for (TreeNode n : node.children) { - System.out.println("\n----------------"); - System.out.println("Looking for " + n.key + "\n"); + // 1. Write node into file + StringBuffer csvLine = new StringBuffer(); + for (int i=0; i < level; i++) { + csvLine.append(";"); + } + csvLine.append(n.value); + csvLine.append('\n'); + FileUtils.writeStringToFile(file, csvLine.toString(), StandardCharsets.UTF_8, true); + + // 2. Retrieve children and recurse httpPost = new HttpPost("https://media-assistant.animalhealth.bayer.com/assets/php/ajax_getCategoryFolderSubnavi.php"); httpPost.setHeader("Cookie", cookie); @@ -86,30 +98,19 @@ public class AHTreeReader { if (content.indexOf("