Created
February 6, 2014 19:02
-
-
Save cfalzone/8850507 to your computer and use it in GitHub Desktop.
Code to import from feed with multiple languages [not working]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean hasEN; // Set by feed | |
boolean hasFR; // Set by feed | |
boolean hasJP; // Set by Feed | |
String stInode; // Getting earlier in code | |
Host stHost; // Getting earlier in code | |
Contentlet contentlet=new Contentlet(); | |
contentlet.setStructureInode(stInode); | |
contentlet.setHost(stHost.getIdentifier()); | |
// Now I set all the contentlet properties from the feed | |
// I set up some related content here | |
Map<Relationship, List<Contentlet>> cRels = new HashMap<Relationship, List<Contentlet>>(); | |
// I set up some categories here | |
List<Category> cats = new ArrayList<Category>(); | |
// Check in the contentlet | |
boolean checkedIn = false; | |
if(hasEN) { | |
contentlet.setLanguageId(1); | |
contentlet = conAPI.checkin(contentlet, cRels, cats, new ArrayList<Permission>(), userAPI.getSystemUser(), false); | |
conAPI.publish(contentlet, userAPI.getSystemUser(), false); | |
checkedIn = true; | |
} | |
if(hasFR) { | |
if(checkedIn) contentlet = conAPI.checkout(contentlet.getInode(), userAPI.getSystemUser(), false); | |
contentlet.setLanguageId(3); | |
contentlet = conAPI.checkin(contentlet, cRels, cats, new ArrayList<Permission>(), userAPI.getSystemUser(), false); | |
conAPI.publish(contentlet, userAPI.getSystemUser(), false); | |
checkedIn = true; | |
} | |
if(hasJP) { | |
if(checkedIn) contentlet = conAPI.checkout(contentlet.getInode(), userAPI.getSystemUser(), false); | |
contentlet.setLanguageId(4); | |
contentlet = conAPI.checkin(contentlet, cRels, cats, new ArrayList<Permission>(), userAPI.getSystemUser(), false); | |
conAPI.publish(contentlet, userAPI.getSystemUser(), false); | |
checkedIn = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment