Created
September 17, 2014 15:43
-
-
Save cfalzone/c957430b77deec73c151 to your computer and use it in GitHub Desktop.
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
| Gson gson = new Gson(); | |
| String agentQuery = "+structureName:Agents +Agents.email:"+agentEmail; | |
| List<Contentlet> conts = conAPI.search(agentQuery, 1, 0, "modDate desc", sysUser, false); | |
| if(conts.size() > 0) { | |
| agent = conts.get(0); | |
| Contentlet newAgent = conAPI.checkout(agent.getInode(), sysUser, false); | |
| // ** Social Media Links ** | |
| Map<String, String> socialMap = new HashMap<String, String>(); | |
| for(int i=0; i<=5; i++) { | |
| if(UtilMethods.isSet(params.get("social_link"+i)) && UtilMethods.isSet(params.get("social_link_label"+i))) { | |
| String key = params.get("social_link_label"+i); | |
| String val = params.get("social_link"+i); | |
| Logger.debug(this, "social"+i+"="+key+":"+val); | |
| socialMap.put(key, val); | |
| } | |
| } | |
| newAgent.setProperty("socialMediaLinks", gson.toJson(socialMap)); | |
| // ** Testimonials ** | |
| Map<String, String> testMap = new HashMap<String, String>(); | |
| for(int i=0; i<=3; i++) { | |
| if(UtilMethods.isSet(params.get("testimonial_text"+i)) && UtilMethods.isSet(params.get("testimonial_author"+i))) { | |
| String key = params.get("testimonial_author"+i); | |
| String val = params.get("testimonial_text"+i); | |
| Logger.debug(this, "testimonial"+i+"="+key+":"+val); | |
| testMap.put(key, val); | |
| } | |
| } | |
| newAgent.setProperty("testimonials", gson.toJson(testMap)); | |
| // checkin .. yada yada | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment