Author: sskracic Date: 2005-12-15 20:47:35 +0100 (Thu, 15 Dec 2005) New Revision: 1055 Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationApp.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationLoader.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationMetadataProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationTextContentProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/GeoAreaFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationHowForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationHowStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationResultsForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationResultsStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsFilter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsList.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsTable.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionConfirm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionForm.java contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/deleted.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/index.jsp contrib/ccm-ldn-camden-consultation/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xsl Log: NFC: TABs expanded into spaces, removed trailing whitespace on the end of line. Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-15 19:47:35 UTC (rev 1055) @@ -48,7 +48,7 @@ String methodology; String feedback; String title; - + do { select live.*, pa.* from cam_consultations live, cam_consultations draft, Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml 2005-12-15 19:47:35 UTC (rev 1055) @@ -2,38 +2,38 @@ <ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> <ctd:content-type label="Consultation" description="An content type for Camden consultations." objectType="com.arsdigita.camden.cms.contenttypes.Consultation" classname="com.arsdigita.camden.cms.contenttypes.Consultation"> <ctd:authoring-kit createComponent="com.arsdigita.camden.cms.contenttypes.ui.ConsultationCreate"> - <ctd:authoring-step - labelKey="cms.contenttypes.shared.basic_properties.title" + <ctd:authoring-step + labelKey="cms.contenttypes.shared.basic_properties.title" labelBundle="com.arsdigita.cms.ui.CMSResources" - descriptionKey="cms.contenttypes.shared.basic_properties.description" + descriptionKey="cms.contenttypes.shared.basic_properties.description" descriptionBundle="com.arsdigita.cms.ui.CMSResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationPropertiesStep"/> - <ctd:authoring-step - labelKey="about.title" + <ctd:authoring-step + labelKey="about.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="about.description" + descriptionKey="about.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationAboutStep"/> - <ctd:authoring-step - labelKey="who.title" + <ctd:authoring-step + labelKey="who.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="who.description" + descriptionKey="who.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationWhoStep"/> - <ctd:authoring-step - labelKey="how.title" + <ctd:authoring-step + labelKey="how.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="how.description" + descriptionKey="how.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationHowStep"/> - <ctd:authoring-step - labelKey="results.title" + <ctd:authoring-step + labelKey="results.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="results.description" + descriptionKey="results.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationResultsStep"/> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-15 19:47:35 UTC (rev 1055) @@ -6,8 +6,8 @@ --> <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> - <xrd:adapter objectType="com.arsdigita.camden.cms.contenttypes.Consultation" - extends="com.arsdigita.cms.ContentPage" + <xrd:adapter objectType="com.arsdigita.camden.cms.contenttypes.Consultation" + extends="com.arsdigita.cms.ContentPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:attributes rule="exclude"> <xrd:property name="/object/methodologyDocuments/ancestors"/> @@ -26,25 +26,25 @@ <xrd:property name="/object/feedbackDocuments"/> </xrd:associations> <xrd:formatter property="/object/startDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/completionDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/resultsDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> - <xrd:formatter property="/object/topic" + class="com.arsdigita.xml.formatters.DateFormatter"/> + <xrd:formatter property="/object/topic" class="com.arsdigita.camden.cms.contenttypes.TopicFormatter"/> - <xrd:formatter property="/object/consultationType" + <xrd:formatter property="/object/consultationType" class="com.arsdigita.camden.cms.contenttypes.TypeFormatter"/> - <xrd:formatter property="/object/targetAudience" + <xrd:formatter property="/object/targetAudience" class="com.arsdigita.camden.cms.contenttypes.TargetFormatter"/> - <xrd:formatter property="/object/geoArea" + <xrd:formatter property="/object/geoArea" class="com.arsdigita.camden.cms.contenttypes.GeoAreaFormatter"/> </xrd:adapter> </xrd:context> <xrd:context name="com.arsdigita.camden.cms.contenttypes.ConsultationMetadataProvider"> - <xrd:adapter - objectType="com.arsdigita.camden.cms.contenttypes.Consultation" + <xrd:adapter + objectType="com.arsdigita.camden.cms.contenttypes.Consultation" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:attributes rule="exclude"> <xrd:property name="/object/startDate"/> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-12-15 19:47:35 UTC (rev 1055) @@ -47,10 +47,10 @@ */ public class Consultation extends ContentPage { - private static final Logger s_log = + private static final Logger s_log = Logger.getLogger(Consultation.class.getName()); - public static final String versionId = "$Id: Consultation.java 25 2005-08-03 16:01:08Z clasohm $"; + public static final String versionId = "$Id: Consultation.java 25 2005-08-03 16:01:08Z clasohm $"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.camden.cms.contenttypes.Consultation"; @@ -75,31 +75,31 @@ public static final String ALERT_SENT = "alertSent"; private static final String SEPARATOR = "/"; - + private boolean m_wasNew = true; public Consultation() { - this(BASE_DATA_OBJECT_TYPE); - } + this(BASE_DATA_OBJECT_TYPE); + } - public Consultation(OID oid) throws DataObjectNotFoundException { - super(oid); - } + public Consultation(OID oid) throws DataObjectNotFoundException { + super(oid); + } - public Consultation(BigDecimal id) throws DataObjectNotFoundException { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); - } + public Consultation(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } - public Consultation(DataObject obj) { - super(obj); - } + public Consultation(DataObject obj) { + super(obj); + } - public Consultation(String type) { - super(type); - - setAlertSent(Boolean.FALSE); - } + public Consultation(String type) { + super(type); + setAlertSent(Boolean.FALSE); + } + /** * @return the base PDL object type for this item. Child classes * should override this method to return the correct value. @@ -125,119 +125,119 @@ } public String[] getTopic() { - String value = (String) get(TOPIC); - if (value == null) { - return null; - } - List topics = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(TOPIC); + if (value == null) { + return null; + } + List topics = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String topic = tok.nextToken(); - Integer.valueOf(topic); // integer check + String topic = tok.nextToken(); + Integer.valueOf(topic); // integer check topics.add(topic); } - return (String[]) topics.toArray(new String[0]); + return (String[]) topics.toArray(new String[0]); } - + public String getPrettyTopic() { - return internalGetPrettyTopics((String) get(TOPIC)); + return internalGetPrettyTopics((String) get(TOPIC)); } - + public static String internalGetPrettyTopics(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer topics = new StringBuffer(); - topics.append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - topics.append(", ").append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); - } - return topics.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer topics = new StringBuffer(); + topics.append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + topics.append(", ").append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + } + return topics.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyTopic(Integer i) { - return ConsultationUtil.globalize("topicOption" + i); + return ConsultationUtil.globalize("topicOption" + i); } - + public void setTopic(String[] topics) { - if (topics == null || topics.length == 0) { - set(TOPIC, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=topics.length-1; - for (int i=0; i<n; i++) { - String topic = topics[i]; - Integer.valueOf(topic); // integer check - value.append(topic).append(SEPARATOR); - } - String topic = topics[n]; - Integer.valueOf(topic); // integer check - value.append(topic); - set(TOPIC,value.toString()); + if (topics == null || topics.length == 0) { + set(TOPIC, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=topics.length-1; + for (int i=0; i<n; i++) { + String topic = topics[i]; + Integer.valueOf(topic); // integer check + value.append(topic).append(SEPARATOR); + } + String topic = topics[n]; + Integer.valueOf(topic); // integer check + value.append(topic); + set(TOPIC,value.toString()); } - + public String[] getConsultationType() { - String value = (String) get(CONSULTATION_TYPE); - if (value == null) { - return null; - } - List types = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(CONSULTATION_TYPE); + if (value == null) { + return null; + } + List types = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String type = tok.nextToken(); - Integer.valueOf(type); // integer check - types.add(type); + String type = tok.nextToken(); + Integer.valueOf(type); // integer check + types.add(type); } - return (String[]) types.toArray(new String[0]); + return (String[]) types.toArray(new String[0]); } public String getPrettyType() { - return internalGetPrettyTypes((String) get(CONSULTATION_TYPE)); + return internalGetPrettyTypes((String) get(CONSULTATION_TYPE)); } - + public static String internalGetPrettyTypes(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer types = new StringBuffer(); - types.append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - types.append(", ").append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); - } - return types.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer types = new StringBuffer(); + types.append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + types.append(", ").append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + } + return types.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyType(Integer i) { - return ConsultationUtil.globalize("typeOption" + i); + return ConsultationUtil.globalize("typeOption" + i); } - + public void setConsultationType(String[] types) { - if (types == null || types.length == 0) { - set(CONSULTATION_TYPE, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=types.length-1; - for (int i=0; i<n; i++) { - String type = types[i]; - Integer.valueOf(type); // integer check - value.append(type).append(SEPARATOR); - } - String type = types[n]; - Integer.valueOf(type); // integer check - value.append(type); - set(CONSULTATION_TYPE,value.toString()); + if (types == null || types.length == 0) { + set(CONSULTATION_TYPE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=types.length-1; + for (int i=0; i<n; i++) { + String type = types[i]; + Integer.valueOf(type); // integer check + value.append(type).append(SEPARATOR); + } + String type = types[n]; + Integer.valueOf(type); // integer check + value.append(type); + set(CONSULTATION_TYPE,value.toString()); } public Date getStartDate() { @@ -273,7 +273,7 @@ } public void setStatutory(boolean value) { - setStatutory(new Boolean(value)); + setStatutory(new Boolean(value)); } public Boolean getAlertSent() { @@ -285,119 +285,119 @@ } public String[] getTargetAudience() { - String value = (String) get(TARGET_AUDIENCE); - if (value == null) { - return null; - } - List targets = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(TARGET_AUDIENCE); + if (value == null) { + return null; + } + List targets = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String target = tok.nextToken(); - Integer.valueOf(target); // integer check - targets.add(target); + String target = tok.nextToken(); + Integer.valueOf(target); // integer check + targets.add(target); } - return (String[]) targets.toArray(new String[0]); + return (String[]) targets.toArray(new String[0]); } public String getPrettyTarget() { - return internalGetPrettyTargets((String) get(TARGET_AUDIENCE)); + return internalGetPrettyTargets((String) get(TARGET_AUDIENCE)); } - + public static String internalGetPrettyTargets(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer targets = new StringBuffer(); - targets.append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - targets.append(", ").append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); - } - return targets.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer targets = new StringBuffer(); + targets.append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + targets.append(", ").append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + } + return targets.toString(); + } else { + return " "; + } } private static GlobalizedMessage getPrettyTarget(Integer i) { - return ConsultationUtil.globalize("targetOption" + i); + return ConsultationUtil.globalize("targetOption" + i); } public void setTargetAudience(String[] targets) { - if (targets == null || targets.length == 0) { - set(TARGET_AUDIENCE, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=targets.length-1; - for (int i=0; i<n; i++) { - String target = targets[i]; - Integer.valueOf(target); // integer check - value.append(target).append(SEPARATOR); - } - String target = targets[n]; - Integer.valueOf(target); // integer check - value.append(target); - set(TARGET_AUDIENCE,value.toString()); + if (targets == null || targets.length == 0) { + set(TARGET_AUDIENCE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=targets.length-1; + for (int i=0; i<n; i++) { + String target = targets[i]; + Integer.valueOf(target); // integer check + value.append(target).append(SEPARATOR); + } + String target = targets[n]; + Integer.valueOf(target); // integer check + value.append(target); + set(TARGET_AUDIENCE,value.toString()); } public String[] getGeoArea() { - String value = (String) get(GEO_AREA); - if (value == null) { - return null; - } - List geos = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(GEO_AREA); + if (value == null) { + return null; + } + List geos = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String geo = tok.nextToken(); - Integer.valueOf(geo); // integer check - geos.add(geo); + String geo = tok.nextToken(); + Integer.valueOf(geo); // integer check + geos.add(geo); } - return (String[]) geos.toArray(new String[0]); + return (String[]) geos.toArray(new String[0]); } public String getPrettyGeoArea() { - return internalGetPrettyGeoAreas((String) get(GEO_AREA)); + return internalGetPrettyGeoAreas((String) get(GEO_AREA)); } public static String internalGetPrettyGeoAreas(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer geos = new StringBuffer(); - geos.append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - geos.append(", ").append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); - } - return geos.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer geos = new StringBuffer(); + geos.append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + geos.append(", ").append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + } + return geos.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyGeoArea(Integer i) { - return ConsultationUtil.globalize("geoOption" + i); + return ConsultationUtil.globalize("geoOption" + i); } - + public void setGeoArea(String[] geoAreas) { - if (geoAreas == null || geoAreas.length == 0) { - set(GEO_AREA, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=geoAreas.length-1; - for (int i=0; i<n; i++) { - String geoArea = geoAreas[i]; - Integer.valueOf(geoArea); // integer check - value.append(geoArea).append(SEPARATOR); - } - String geoArea = geoAreas[n]; - Integer.valueOf(geoArea); // integer check - value.append(geoArea); - set(GEO_AREA,value.toString()); + if (geoAreas == null || geoAreas.length == 0) { + set(GEO_AREA, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=geoAreas.length-1; + for (int i=0; i<n; i++) { + String geoArea = geoAreas[i]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea).append(SEPARATOR); + } + String geoArea = geoAreas[n]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea); + set(GEO_AREA,value.toString()); } public String getMethodology() { @@ -409,24 +409,24 @@ } public FileAssetCollection getMethodologyDocuments() { - DataCollection dataCollection = - (DataCollection)get(METHODOLOGY_DOCUMENTS); - - if (dataCollection == null) - return null; - - dataCollection.addOrder("name"); - return new FileAssetCollection(dataCollection); + DataCollection dataCollection = + (DataCollection)get(METHODOLOGY_DOCUMENTS); + + if (dataCollection == null) + return null; + + dataCollection.addOrder("name"); + return new FileAssetCollection(dataCollection); } - + public void addMethodologyDocument(FileAsset fileAsset) { - add(METHODOLOGY_DOCUMENTS, fileAsset); + add(METHODOLOGY_DOCUMENTS, fileAsset); } - + public void removeMethodologyDocument(FileAsset fileAsset) { - remove(METHODOLOGY_DOCUMENTS, fileAsset); + remove(METHODOLOGY_DOCUMENTS, fileAsset); } - + public String getFeedback() { return (String) get(FEEDBACK); } @@ -436,57 +436,57 @@ } public FileAssetCollection getFeedbackDocuments() { - DataCollection dataCollection = - (DataCollection)get(FEEDBACK_DOCUMENTS); - - if (dataCollection == null) - return null; - - return new FileAssetCollection(dataCollection); + DataCollection dataCollection = + (DataCollection)get(FEEDBACK_DOCUMENTS); + + if (dataCollection == null) + return null; + + return new FileAssetCollection(dataCollection); } - + public void addFeedbackDocument(FileAsset fileAsset) { - add(FEEDBACK_DOCUMENTS, fileAsset); + add(FEEDBACK_DOCUMENTS, fileAsset); } public void removeFeedbackDocument(FileAsset fileAsset) { - remove(FEEDBACK_DOCUMENTS, fileAsset); + remove(FEEDBACK_DOCUMENTS, fileAsset); } public static GlobalizedMessage getStatus(Date startDate, Date completionDate) { - if (startDate == null || completionDate == null) - return null; + if (startDate == null || completionDate == null) + return null; - Date currentDate = new Date(); - - if (startDate.after(currentDate)) - return ConsultationUtil.globalize("status.forthcoming"); - else if (completionDate.before(currentDate)) - return ConsultationUtil.globalize("status.past"); - else - return ConsultationUtil.globalize("status.current"); + Date currentDate = new Date(); + + if (startDate.after(currentDate)) + return ConsultationUtil.globalize("status.forthcoming"); + else if (completionDate.before(currentDate)) + return ConsultationUtil.globalize("status.past"); + else + return ConsultationUtil.globalize("status.current"); } - + public GlobalizedMessage getStatus() { - return Consultation.getStatus(getStartDate(), getCompletionDate()); + return Consultation.getStatus(getStartDate(), getCompletionDate()); } - public String getSearchSummary() { - return StringUtils.truncateString(getPurpose(), 200); - } + public String getSearchSummary() { + return StringUtils.truncateString(getPurpose(), 200); + } - /** - * Prevent copying of the ALERT_SENT field. We do not need it for live objects, - * and we must not copy it when a draft item is copied. Otherwise, no alerts would - * be sent when the copy is published. - */ - public boolean copyProperty(CustomCopy source, Property property, ItemCopier copier) { - if (property.getName().equals(ALERT_SENT)) { - setAlertSent(Boolean.FALSE); - return true; - } - - return super.copyProperty(source, property, copier); - } + /** + * Prevent copying of the ALERT_SENT field. We do not need it for live objects, + * and we must not copy it when a draft item is copied. Otherwise, no alerts would + * be sent when the copy is published. + */ + public boolean copyProperty(CustomCopy source, Property property, ItemCopier copier) { + if (property.getName().equals(ALERT_SENT)) { + setAlertSent(Boolean.FALSE); + return true; + } + return super.copyProperty(source, property, copier); + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-12-15 19:47:35 UTC (rev 1055) @@ -36,19 +36,19 @@ /** * Alert requests for the Camden Consultation content type. * Requests must be confirmed via email before they become - * active. Old pending requests are deleted periodically. - * + * active. Old pending requests are deleted periodically. + * * @author Carsten Clasohm * @version $Id: ConsultationAlert.java 25 2005-08-03 16:01:08Z clasohm $ */ public class ConsultationAlert extends ACSObject { - private static final Logger s_log = + private static final Logger s_log = Logger.getLogger(ConsultationAlert.class.getName()); public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.camden.cms.contenttypes.ConsultationAlert"; - + public static final String FIRST_NAMES = "firstNames"; public static final String LAST_NAME = "lastName"; public static final String EMAIL = "email"; @@ -56,35 +56,35 @@ public static final String CONFIRMATION_TOKEN = "confirmationToken"; public static final String CANCELLATION_TOKEN = "cancellationToken"; public static final String EMAIL_CONFIRMED = "emailConfirmed"; - public final static String CONFIRM_PATH = "/alert.jsp"; - public final static String CONFIRM_PARAMETER = "co"; - public final static String CANCEL_PARAMETER = "ca"; + public final static String CONFIRM_PATH = "/alert.jsp"; + public final static String CONFIRM_PARAMETER = "co"; + public final static String CANCEL_PARAMETER = "ca"; - public ConsultationAlert() { - this(BASE_DATA_OBJECT_TYPE); - } + public ConsultationAlert() { + this(BASE_DATA_OBJECT_TYPE); + } - public ConsultationAlert(OID oid) throws DataObjectNotFoundException { - super(oid); - } + public ConsultationAlert(OID oid) throws DataObjectNotFoundException { + super(oid); + } - public ConsultationAlert(BigDecimal id) throws DataObjectNotFoundException { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); - } + public ConsultationAlert(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } - public ConsultationAlert(DataObject obj) { - super(obj); - } + public ConsultationAlert(DataObject obj) { + super(obj); + } - public ConsultationAlert(String type) { - super(type); - - setConfirmationToken(getRandomString()); - setCancellationToken(getRandomString()); - setEmailConfirmed(Boolean.FALSE); - setCreationDate(new Date()); - } + public ConsultationAlert(String type) { + super(type); + setConfirmationToken(getRandomString()); + setCancellationToken(getRandomString()); + setEmailConfirmed(Boolean.FALSE); + setCreationDate(new Date()); + } + /** * @return the base PDL object type for this item. Child classes * should override this method to return the correct value. @@ -152,72 +152,72 @@ private String getRandomString() { byte[] salt = new byte[8]; try { - Crypto.getRandom().nextBytes(salt); + Crypto.getRandom().nextBytes(salt); } catch (GeneralSecurityException e) { - throw new RuntimeException(e); + throw new RuntimeException(e); } - + String result = new String((new Base64()).encode(salt)); - + // Convert characters which could be problematic in a URL. result = result.replace('+', 'p'). - replace('=', 'e'). - replace('/', 's'); + replace('=', 'e'). + replace('/', 's'); return result; } public static String confirm(String token) { - DataCollection alerts = - SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - alerts.addEqualsFilter(CONFIRMATION_TOKEN, token); + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(CONFIRMATION_TOKEN, token); - String result = null; - if (alerts.next()) { - ConsultationAlert alert = - new ConsultationAlert(alerts.getDataObject()); - alerts.close(); + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); - result = alert.getEmail(); + result = alert.getEmail(); - alert.setEmailConfirmed(Boolean.TRUE); - alert.save(); - } + alert.setEmailConfirmed(Boolean.TRUE); + alert.save(); + } - return result; + return result; } public static String cancel(String token) { - DataCollection alerts = - SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - alerts.addEqualsFilter(CANCELLATION_TOKEN, token); + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(CANCELLATION_TOKEN, token); - String result = null; - if (alerts.next()) { - ConsultationAlert alert = - new ConsultationAlert(alerts.getDataObject()); - alerts.close(); + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); - result = alert.getEmail(); + result = alert.getEmail(); - alert.delete(); - } + alert.delete(); + } - return result; + return result; } - + public static ConsultationAlert findByEmail(String email) { - DataCollection alerts = - SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - alerts.addEqualsFilter(EMAIL, email); - - ConsultationAlert alert = null; - if (alerts.next()) { - alert = new ConsultationAlert(alerts.getDataObject()); - alerts.close(); - } - - return alert; + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(EMAIL, email); + + ConsultationAlert alert = null; + if (alerts.next()) { + alert = new ConsultationAlert(alerts.getDataObject()); + alerts.close(); + } + + return alert; } /** @@ -225,222 +225,222 @@ * are older than 24h. */ public static void purgeUnconfirmed() { - Session dbSession = SessionManager.getSession(); - int dbType = dbSession.getDatabase(); - - DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); - - alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE); - alerts.addFilter("creationDate < current_date - 1"); - - while (alerts.next()) { - ConsultationAlert alert = - new ConsultationAlert(alerts.getDataObject()); - alert.delete(); - } + Session dbSession = SessionManager.getSession(); + int dbType = dbSession.getDatabase(); + + DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); + + alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE); + alerts.addFilter("creationDate < current_date - 1"); + + while (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alert.delete(); + } } - + /** * <p>Sends alert emails for all published Consultation items - * for which no alerts have been sent yet. Only sends an alert - * if the item has never been published before. This should be run + * for which no alerts have been sent yet. Only sends an alert + * if the item has never been published before. This should be run * once a day.</p> */ public static void sendAlerts() { - Session dbSession = SessionManager.getSession(); - Locale locale = Locale.getDefault(); - - // First get the list of consultations for which we should send alerts, - // and build the text common to all alerts. - DataQuery items = - dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newConsultations"); .. |