4Sep/100
Due date today

Due date today, things are happening. We're currently kicking it at Denny's. Contractions started yesterday mornings and something appears afoot. This morning Amber indicated that the pain level with her contractions is greater than it was yesterday and she's just updated me that their frequency is increasing. I'm gonna go out on a limb and wager that this will be the last time we come to Denny's requesting a table for 2
20Apr/100
dotCMS Structure Inserter from Chris Falzone
This is the code cfalzone gave me to accomplish the eating XML and inserting into a structure. He originally posted it on pastebin here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | package com.cfalzone.jobs; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import com.dotmarketing.business.APILocator; import com.dotmarketing.cache.FieldsCache; import com.dotmarketing.cache.StructureCache; import com.dotmarketing.cms.factories.PublicUserFactory; import com.dotmarketing.portlets.contentlet.business.ContentletAPI; import com.dotmarketing.portlets.contentlet.model.Contentlet; import com.dotmarketing.portlets.languagesmanager.business.LanguageAPI; import com.dotmarketing.portlets.structure.model.Field; import com.dotmarketing.portlets.structure.model.Structure; import com.dotmarketing.util.Logger; public class SimpleContentCreator implements Job { @SuppressWarnings("unchecked") public void execute(JobExecutionContext arg0) throws JobExecutionException { Logger.info(this, "SimpleContentCreator Starting up"); /* Get the importStructure */ Structure importStructure = StructureCache.getStructureByType('Import Structure'); if (importStructure == null || importStructure.getName() == null) { Logger.error(this, "Could not find the Import Structure: " + importStructureStr); exit; } /* Get the Fields */ Field myField = null; Field anotherField = null; List<Field> fields = FieldsCache.getFieldsByStructureInode(importStructure.getInode()); for (Field f : fields) { if (f.getVelocityVarName().equals('myField')) { myField = f; } if (f.getVelocityVarName().equals('anotherField')) { anotherField = f; } } if (myField == null) { Logger.error(this, "myField not found in " + importStructure.getName()); exit; } if (anotherField == null) { Logger.error(this, "anotherField not found in " + importStructure.getName()); exit; } /* Create A New Contentlet */ Contentlet con2 = new Contentlet(); con2.setStructureInode(importStructure.getInode()); LanguageAPI lAPI = APILocator.getLanguageAPI(); con2.setArchived(false); con2.setWorking(true); con2.setLive(autoPub); con2.setLanguageId(lAPI.getDefaultLanguage().getId()); conAPI.setContentletProperty(con2, myField, 'A Value'); conAPI.setContentletProperty(con2, anotherField, 'Another Value'); /* Now check the contentlet back in */ try { conAPI.checkin(con2, PublicUserFactory.getSystemUser(), true); } catch (Exception e) { Logger.error(this, "Unable checkin the Contentlet. " + e.getMessage(), e); exit; } Logger.info(this, "SimpleContentCreator Finished"); return; } } |