Klasse TextPage eleminiert. Alle Funktionen in GenericArticle übernommen. Alle von TextPage abgeleiteten Klassen werden nun von GenericArticle abgeleitet. Alle Verwendungen von TextPage wurden aud GenericArticle geändert.
git-svn-id: https://svn.libreccm.org/ccm/trunk@672 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a76bf6287f
commit
ba902a0081
|
|
@ -23,7 +23,7 @@ import com.arsdigita.cms.*;
|
|||
|
||||
// object type to hold extended attributes of agenda content type
|
||||
|
||||
object type Agenda extends TextPage {
|
||||
object type Agenda extends GenericArticle {
|
||||
// The date and time for the agenda
|
||||
Date [0..1] agendaDate = ct_agendas.agenda_date TIMESTAMP;
|
||||
// The location for the agenda
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
-->
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Agenda" extends="com.arsdigita.cms.TextPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Agenda" extends="com.arsdigita.cms.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:formatter property="/object/creationDate"
|
||||
class="com.arsdigita.xml.formatters.DateFormatter"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -52,7 +50,7 @@ import java.util.Date;
|
|||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
public class Agenda extends TextPage {
|
||||
public class Agenda extends GenericArticle {
|
||||
|
||||
/** PDL property name for summary */
|
||||
public static final String SUMMARY = "summary";
|
||||
|
|
@ -68,12 +66,9 @@ public class Agenda extends TextPage {
|
|||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** PDL property name for creation date */
|
||||
public static final String CREATION_DATE = "creationDate";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Agenda";
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Agenda";
|
||||
/** Data object type for this domain object (for CMS compatibility) */
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(Logger.class);
|
||||
|
||||
/**
|
||||
|
|
@ -136,7 +131,7 @@ public class Agenda extends TextPage {
|
|||
*/
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
|
|
@ -145,11 +140,11 @@ public class Agenda extends TextPage {
|
|||
return (Date) get(AGENDA_DATE);
|
||||
}
|
||||
|
||||
public String getDisplayAgendaDate () {
|
||||
public String getDisplayAgendaDate() {
|
||||
Date d = getAgendaDate();
|
||||
return (d != null) ? DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(d) : null;
|
||||
return (d != null) ? DateFormat.getDateInstance(DateFormat.LONG).format(d) : null;
|
||||
}
|
||||
|
||||
public void setAgendaDate(Date agendaDate) {
|
||||
set(AGENDA_DATE, agendaDate);
|
||||
}
|
||||
|
|
@ -163,7 +158,7 @@ public class Agenda extends TextPage {
|
|||
}
|
||||
|
||||
public String getAttendees() {
|
||||
return (String) get(ATTENDEES);
|
||||
return (String) get(ATTENDEES);
|
||||
}
|
||||
|
||||
public void setAttendees(String attendees) {
|
||||
|
|
@ -171,7 +166,7 @@ public class Agenda extends TextPage {
|
|||
}
|
||||
|
||||
public String getSubjectItems() {
|
||||
return (String) get(SUBJECT_ITEMS);
|
||||
return (String) get(SUBJECT_ITEMS);
|
||||
}
|
||||
|
||||
public void setSubjectItems(String subjectItems) {
|
||||
|
|
@ -201,7 +196,6 @@ public class Agenda extends TextPage {
|
|||
public void setCreationDate(Date creationDate) {
|
||||
set(CREATION_DATE, creationDate);
|
||||
}
|
||||
|
||||
// Search stuff to allow the content type to be searchable
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
|
||||
|
|
@ -209,12 +203,11 @@ public class Agenda extends TextPage {
|
|||
TextAsset ta = getTextAsset();
|
||||
|
||||
if (ta != null) {
|
||||
return com.arsdigita.util.StringUtils.truncateString(ta.getText(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
return com.arsdigita.util.StringUtils.truncateString(ta.getText(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,6 @@
|
|||
<ctd:include href="/WEB-INF/content-types/edit-body-text-step.xml"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
<ctd:authoring-step label="Image" description="Image"
|
||||
labelKey="article.authoring.image.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ArticleResources"
|
||||
descriptionKey="article.authoring.image.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ArticleResources"
|
||||
component="com.arsdigita.cms.ui.authoring.ArticleImage"/>
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.cms.*;
|
|||
|
||||
// object type to hold extended attributes of event content type
|
||||
|
||||
object type Event extends TextPage {
|
||||
object type Event extends GenericArticle {
|
||||
// The starting date and time of the event, so the events content type
|
||||
// can be used by calendar
|
||||
Date [0..1] startDate = ct_events.start_date DATE;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- First off the adapters for ContentItemPanel -->
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Event" extends="com.arsdigita.cms.TextPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Event" extends="com.arsdigita.cms.GenericArticle" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter">
|
||||
<xrd:formatter property="/object/startDate"
|
||||
class="com.arsdigita.xml.formatters.DateFormatter"/>
|
||||
<xrd:formatter property="/object/endDate"
|
||||
|
|
|
|||
|
|
@ -18,16 +18,13 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
|
|
@ -40,7 +37,7 @@ import java.util.Date;
|
|||
* It represents an event object and provides methods for creating new event
|
||||
* objects, retrieving existing objects from the persistent storage and
|
||||
* retrieving and setting is properties.</p>
|
||||
* <p>This class extends {@link com.arsdigita.cms.TextPage content page} and
|
||||
* <p>This class extends {@link com.arsdigita.cms.contenttypes.GenericArticle content page} and
|
||||
* inherits title, name (filename), body (TextAsset), and metadata. It adds
|
||||
* extended attributes specific for an event:</p>
|
||||
* <dl>
|
||||
|
|
@ -70,21 +67,17 @@ import java.util.Date;
|
|||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
public class Event extends TextPage {
|
||||
public class Event extends GenericArticle {
|
||||
|
||||
private final static org.apache.log4j.Logger s_log =
|
||||
org.apache.log4j.Logger.getLogger(Event.class);
|
||||
|
||||
org.apache.log4j.Logger.getLogger(Event.class);
|
||||
/** PDL property name for lead (summary) */
|
||||
public static final String LEAD = "lead";
|
||||
|
||||
/** PDL property name for event date */
|
||||
public static final String START_DATE = "startDate";
|
||||
public static final String END_DATE = "endDate";
|
||||
|
||||
public static final String START_TIME = "startTime";
|
||||
public static final String END_TIME = "endTime";
|
||||
|
||||
public static final String EVENT_DATE = "eventDate";
|
||||
/** PDL property name for location */
|
||||
public static final String LOCATION = "location";
|
||||
|
|
@ -96,20 +89,17 @@ public class Event extends TextPage {
|
|||
public static final String MAP_LINK = "mapLink";
|
||||
/** PDL property name for cost */
|
||||
public static final String COST = "cost";
|
||||
|
||||
public static final String RECENT_EVENT = "com.arsdigita.cms.contenttypes.RecentEvent";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Event";
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Event";
|
||||
private static final EventConfig s_config = new EventConfig();
|
||||
|
||||
static {
|
||||
s_config.load();
|
||||
s_config.load();
|
||||
}
|
||||
public static final EventConfig getConfig()
|
||||
{
|
||||
return s_config;
|
||||
|
||||
public static final EventConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -172,48 +162,45 @@ public class Event extends TextPage {
|
|||
*/
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
public String formatDate (Date date) {
|
||||
return (date != null) ? DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(date) : null;
|
||||
public String formatDate(Date date) {
|
||||
return (date != null) ? DateFormat.getDateInstance(DateFormat.LONG).format(date) : null;
|
||||
}
|
||||
|
||||
|
||||
public String formatTime (Date time) {
|
||||
return (time != null) ? DateFormat.getTimeInstance(DateFormat.SHORT)
|
||||
.format(time) : null;
|
||||
public String formatTime(Date time) {
|
||||
return (time != null) ? DateFormat.getTimeInstance(DateFormat.SHORT).format(time) : null;
|
||||
}
|
||||
|
||||
/* accessors *****************************************************/
|
||||
public Date getStartTime () {
|
||||
return (Date)get(START_TIME);
|
||||
public Date getStartTime() {
|
||||
return (Date) get(START_TIME);
|
||||
}
|
||||
|
||||
public void setStartTime (Date startTime) {
|
||||
public void setStartTime(Date startTime) {
|
||||
set(START_TIME, startTime);
|
||||
}
|
||||
|
||||
public String getDisplayStartTime () {
|
||||
public String getDisplayStartTime() {
|
||||
return formatTime(getStartTime());
|
||||
}
|
||||
|
||||
public Date getEndTime () {
|
||||
return (Date)get(END_TIME);
|
||||
public Date getEndTime() {
|
||||
return (Date) get(END_TIME);
|
||||
}
|
||||
|
||||
public void setEndTime (Date endTime) {
|
||||
public void setEndTime(Date endTime) {
|
||||
set(END_TIME, endTime);
|
||||
}
|
||||
|
||||
public String getDisplayEndTime () {
|
||||
public String getDisplayEndTime() {
|
||||
return formatTime(getEndTime());
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
Date startDate = (Date) get (START_DATE);
|
||||
Date startDate = (Date) get(START_DATE);
|
||||
return startDate;
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +213,7 @@ public class Event extends TextPage {
|
|||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
Date endDate = (Date) get (END_DATE);
|
||||
Date endDate = (Date) get(END_DATE);
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +229,6 @@ public class Event extends TextPage {
|
|||
return (String) get(EVENT_DATE);
|
||||
}
|
||||
|
||||
|
||||
public void setEventDate(String eventDate) {
|
||||
set(EVENT_DATE, eventDate);
|
||||
}
|
||||
|
|
@ -294,13 +280,13 @@ public class Event extends TextPage {
|
|||
public void setCost(String cost) {
|
||||
set(COST, cost);
|
||||
}
|
||||
|
||||
// Search stuff to allow the content type to be searchable
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
|
||||
public String getSearchSummary() {
|
||||
return com.arsdigita.util.StringUtils.truncateString(getLead(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ model com.arsdigita.cms.contenttypes;
|
|||
import com.arsdigita.cms.*;
|
||||
|
||||
// object type to hold extended attributes of legal notice content type
|
||||
object type LegalNotice extends TextPage {
|
||||
object type LegalNotice extends GenericArticle {
|
||||
// The government issued UID for the legal notice
|
||||
String [0..1] governmentUID = ct_legal_notices.government_uid VARCHAR(100);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -35,16 +33,14 @@ import java.math.BigDecimal;
|
|||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
public class LegalNotice extends TextPage {
|
||||
public class LegalNotice extends GenericArticle {
|
||||
|
||||
/** PDL property name for government UID */
|
||||
public static final String GOVERNMENT_UID = "governmentUID";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.LegalNotice";
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.LegalNotice";
|
||||
private static final Logger s_log = Logger.getLogger(LegalNotice.class);
|
||||
|
||||
public LegalNotice() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
|
@ -67,7 +63,7 @@ public class LegalNotice extends TextPage {
|
|||
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +75,6 @@ public class LegalNotice extends TextPage {
|
|||
public void setGovernmentUID(String governmentUID) {
|
||||
set(GOVERNMENT_UID, governmentUID);
|
||||
}
|
||||
|
||||
// Search stuff to allow the content type to be searchable
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
|
||||
|
|
@ -88,11 +83,10 @@ public class LegalNotice extends TextPage {
|
|||
|
||||
if (ta != null) {
|
||||
return com.arsdigita.util.StringUtils.truncateString(ta.getText(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.cms.*;
|
|||
|
||||
// object type to hold extended attributes of minutes content type
|
||||
|
||||
object type Minutes extends TextPage {
|
||||
object type Minutes extends GenericArticle {
|
||||
// The minute number for the minutes
|
||||
String [0..1] minuteNumber = ct_minutes.minute_number VARCHAR(100);
|
||||
// The description of the minutes
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -34,11 +32,10 @@ import java.math.BigDecimal;
|
|||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
public class Minutes extends TextPage {
|
||||
public class Minutes extends GenericArticle {
|
||||
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(Minutes.class);
|
||||
|
||||
Logger.getLogger(Minutes.class);
|
||||
/** PDL property name for attendees */
|
||||
public static final String ATTENDEES = "attendees";
|
||||
/** PDL property name for description */
|
||||
|
|
@ -49,10 +46,8 @@ public class Minutes extends TextPage {
|
|||
public static final String MINUTE_NUMBER = "minuteNumber";
|
||||
/** PDL property name for description */
|
||||
public static final String DESCRIPTION_OF_MINUTES = "descriptionOfMinutes";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Minutes";
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Minutes";
|
||||
|
||||
public Minutes() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
@ -74,10 +69,9 @@ public class Minutes extends TextPage {
|
|||
super(type);
|
||||
}
|
||||
|
||||
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
|
|
@ -121,12 +115,11 @@ public class Minutes extends TextPage {
|
|||
public void setMinuteNumber(String minuteNumber) {
|
||||
set(MINUTE_NUMBER, minuteNumber);
|
||||
}
|
||||
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
|
||||
public String getSearchSummary() {
|
||||
return com.arsdigita.util.StringUtils.truncateString(getDescription(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.arsdigita.cms.*;
|
|||
|
||||
|
||||
|
||||
object type PressRelease extends TextPage {
|
||||
object type PressRelease extends GenericArticle {
|
||||
// contact information text for the press release
|
||||
String [0..1] contactInfo = ct_press_releases.contact_info VARCHAR(1000);
|
||||
// the text summary for the press release
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -34,26 +32,23 @@ import java.math.BigDecimal;
|
|||
* reference purposes. Reference code is an arbitrary string that is used for
|
||||
* out-of-system reference. The type inherits name (filename), title, body
|
||||
* (TextAsset), and metadata from
|
||||
* <code>com.arsdigita.aplaws.cms.TextPage</code>, and also provides the
|
||||
* <code>com.arsdigita.cms.contenttypes.Genericrticle</code>, and also provides the
|
||||
* capability to associate contact information with this press release.
|
||||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
public class PressRelease extends TextPage {
|
||||
public class PressRelease extends GenericArticle {
|
||||
|
||||
// is the CardBin sort of contact support needed here?
|
||||
// implements ContactSupport {
|
||||
|
||||
/** PDL property name for contact info */
|
||||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** PDL property name for summary */
|
||||
public static final String SUMMARY = "summary";
|
||||
/** PDL property name for reference code */
|
||||
public static final String REFERENCE_CODE = "referenceCode";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.PressRelease";
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.PressRelease";
|
||||
|
||||
public PressRelease() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
@ -77,7 +72,7 @@ public class PressRelease extends TextPage {
|
|||
|
||||
public void beforeSave() {
|
||||
super.beforeSave();
|
||||
|
||||
|
||||
Assert.exists(getContentType(), ContentType.class);
|
||||
}
|
||||
|
||||
|
|
@ -105,12 +100,11 @@ public class PressRelease extends TextPage {
|
|||
public void setReferenceCode(String refCode) {
|
||||
set(REFERENCE_CODE, refCode);
|
||||
}
|
||||
|
||||
public static final int SUMMARY_LENGTH = 200;
|
||||
|
||||
public String getSearchSummary() {
|
||||
return com.arsdigita.util.StringUtils.truncateString(getSummary(),
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
SUMMARY_LENGTH,
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,11 @@ model com.arsdigita.cms.contenttypes;
|
|||
import com.arsdigita.cms.*;
|
||||
import com.arsdigita.kernel.*;
|
||||
|
||||
object type GenericArticle extends TextPage {
|
||||
object type GenericArticle extends ContentPage {
|
||||
|
||||
component TextAsset[0..1] textAsset = join cms_text_pages.text_id to cms_text.text_id;
|
||||
|
||||
reference key (cms_articles.article_id);
|
||||
|
||||
}
|
||||
|
||||
//association {
|
||||
|
|
@ -33,12 +34,12 @@ object type GenericArticle extends TextPage {
|
|||
// component GenericArticleImageAssociation[0..n] imageCaptions = join cms_articles.article_id
|
||||
// to cms_article_image_map.article_id;
|
||||
//
|
||||
// GenericArticle[1..1] captionArticle = join cms_article_image_map.article_id to cms_articles.article_id;
|
||||
// GenericArticle[1..1] captionArticle = join cms_article_image_map.article_id to cms_articles.article_id;
|
||||
//
|
||||
//}
|
||||
//
|
||||
//object type GenericArticleImageAssociation extends ContentItem {
|
||||
// String[0..1] caption = cms_article_image_map.caption VARCHAR(4000);
|
||||
// String[0..1] caption = cms_article_image_map.caption VARCHAR(4000);
|
||||
//
|
||||
// // Only including these ID attributes for legacy purposes
|
||||
// BigDecimal[0..1] articleId = cms_article_image_map.article_id INTEGER;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -32,13 +33,14 @@ import java.math.BigDecimal;
|
|||
* @version $Revision: #28 $ $Date: 2004/08/17 $
|
||||
* @version $Id: Article.java 2070 2010-01-28 08:47:41Z pboy $
|
||||
*/
|
||||
public class GenericArticle extends TextPage {
|
||||
public class GenericArticle extends ContentPage {
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.GenericArticle";
|
||||
|
||||
"com.arsdigita.cms.contenttypes.GenericArticle";
|
||||
public static final String TEXT_ASSET = "textAsset";
|
||||
protected static final int SUMMARY_SIZE = 1024;
|
||||
private static org.apache.log4j.Logger s_log =
|
||||
org.apache.log4j.Logger.getLogger(GenericArticle.class);
|
||||
org.apache.log4j.Logger.getLogger(GenericArticle.class);
|
||||
|
||||
/**
|
||||
* Default constructor. This creates a new article.
|
||||
|
|
@ -60,7 +62,7 @@ public class GenericArticle extends TextPage {
|
|||
}
|
||||
|
||||
public GenericArticle(String type) {
|
||||
super(type);
|
||||
super(type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,4 +90,41 @@ public class GenericArticle extends TextPage {
|
|||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text asset for this <code>TextPage</code>. Could return
|
||||
* null if there is no text body actually associated with the page
|
||||
*/
|
||||
public TextAsset getTextAsset() {
|
||||
DataObject text = (DataObject) get(TEXT_ASSET);
|
||||
if (text == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new TextAsset(text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass in a null value to remove the text of this item.
|
||||
* Explicitly call text.delete() to remove the text from the database
|
||||
*/
|
||||
public void setTextAsset(TextAsset text) {
|
||||
setAssociation(TEXT_ASSET, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a short summary of the text body for search.
|
||||
* This method is WRONG, because the text body could actually
|
||||
* be extremely large, and doing substring on it is NOT safe
|
||||
*/
|
||||
public String getSearchSummary() {
|
||||
TextAsset a = getTextAsset();
|
||||
|
||||
if (a == null) {
|
||||
return "";
|
||||
}
|
||||
return com.arsdigita.util.StringUtils.truncateString(a.getText(),
|
||||
SUMMARY_SIZE,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,19 +20,20 @@ package com.arsdigita.cms.installer.xml;
|
|||
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.cms.contenttypes.GenericArticle;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* TextPageHelper
|
||||
* GenericArticleHelper
|
||||
*
|
||||
* @author <a href="mailto:jorris@redhat.com">Jon Orris</a>
|
||||
*
|
||||
*/
|
||||
public class TextPageHelper extends ContentPageHelper {
|
||||
public class GenericArticleHelper extends ContentPageHelper {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(TextPageHelper.class);
|
||||
public TextPageHelper(ContentSection section) {
|
||||
private static final Logger s_log = Logger.getLogger(GenericArticleHelper.class);
|
||||
|
||||
public GenericArticleHelper(ContentSection section) {
|
||||
super(section);
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ public class TextPageHelper extends ContentPageHelper {
|
|||
TextAsset asset = new TextAsset();
|
||||
asset.setText(body);
|
||||
|
||||
TextPage page = (TextPage) m_item;
|
||||
GenericArticle page = (GenericArticle) m_item;
|
||||
page.setTextAsset(asset);
|
||||
asset.setParent(page);
|
||||
asset.setName(page.getName() + "_text_" + page.getID());
|
||||
|
|
@ -28,7 +28,7 @@ import com.arsdigita.bebop.form.Option;
|
|||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.TextAsset;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.cms.contenttypes.GenericArticle;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
|
|
@ -44,15 +44,15 @@ import com.arsdigita.util.Assert;
|
|||
* this class.
|
||||
*
|
||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||
* @version $Id: TextPageBody.java 1949 2009-06-25 08:30:50Z terry $
|
||||
* @version $Id: GenericArticleBody.java 1949 2009-06-25 08:30:50Z terry $
|
||||
*/
|
||||
public class TextPageBody extends TextAssetBody {
|
||||
public class GenericArticleBody extends TextAssetBody {
|
||||
|
||||
private AuthoringKitWizard m_parent;
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
/**
|
||||
* Construct a new TextPageBody component
|
||||
* Construct a new GenericArticleBody component
|
||||
*
|
||||
* @param itemModel The {@link ItemSelectionModel} which will
|
||||
* be responsible for loading the current item
|
||||
|
|
@ -61,7 +61,7 @@ public class TextPageBody extends TextAssetBody {
|
|||
* may use the wizard's methods, such as stepForward and stepBack,
|
||||
* in its process listener.
|
||||
*/
|
||||
public TextPageBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
public GenericArticleBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
super(new ItemAssetModel(itemModel));
|
||||
m_itemModel = itemModel;
|
||||
m_parent = parent;
|
||||
|
|
@ -87,8 +87,9 @@ public class TextPageBody extends TextAssetBody {
|
|||
|
||||
/**
|
||||
* Adds the options for the mime type select widget of
|
||||
* <code>TextPageForm</code> and sets the default mime type.
|
||||
* <code>GenericArticleForm</code> and sets the default mime type.
|
||||
**/
|
||||
@Override
|
||||
protected void setMimeTypeOptions(SingleSelect mimeSelect) {
|
||||
mimeSelect.addOption(new Option("text/html", "HTML Text"));
|
||||
mimeSelect.setOptionSelected("text/html");
|
||||
|
|
@ -101,7 +102,7 @@ public class TextPageBody extends TextAssetBody {
|
|||
* @return a valid TextAsset
|
||||
*/
|
||||
protected TextAsset createTextAsset(PageState s) {
|
||||
TextPage item = getTextPage(s);
|
||||
GenericArticle item = getGenericArticle(s);
|
||||
TextAsset t = new TextAsset();
|
||||
t.setName(item.getName() + "_text_" + item.getID());
|
||||
// no need - cg. Text doesn't need a security context,
|
||||
|
|
@ -118,7 +119,7 @@ public class TextPageBody extends TextAssetBody {
|
|||
* @param a the new <code>TextAsset</code>
|
||||
*/
|
||||
protected void updateTextAsset(PageState s, TextAsset a) {
|
||||
TextPage t = getTextPage(s);
|
||||
GenericArticle t = getGenericArticle(s);
|
||||
Assert.exists(t);
|
||||
// no need - cg. Text doesn't need a security context,
|
||||
// and ownership of text is recorded in text_pages
|
||||
|
|
@ -130,10 +131,10 @@ public class TextPageBody extends TextAssetBody {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the current TextPage
|
||||
* Get the current GenericArticle
|
||||
*/
|
||||
protected TextPage getTextPage(PageState s) {
|
||||
return (TextPage)m_itemModel.getSelectedObject(s);
|
||||
protected GenericArticle getGenericArticle(PageState s) {
|
||||
return (GenericArticle)m_itemModel.getSelectedObject(s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -148,8 +149,9 @@ public class TextPageBody extends TextAssetBody {
|
|||
super(m);
|
||||
|
||||
m_asset = new RequestLocal() {
|
||||
@Override
|
||||
protected Object initialValue(PageState s) {
|
||||
TextPage t = (TextPage)
|
||||
GenericArticle t = (GenericArticle)
|
||||
((ItemSelectionModel)getSingleSelectionModel())
|
||||
.getSelectedObject(s);
|
||||
Assert.exists(t);
|
||||
|
|
@ -158,23 +160,28 @@ public class TextPageBody extends TextAssetBody {
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedKey(PageState s) {
|
||||
TextAsset a = (TextAsset)getSelectedObject(s);
|
||||
return (a == null) ? null : a.getID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainObject getSelectedObject(PageState s) {
|
||||
return (DomainObject)m_asset.get(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedObject(PageState s, DomainObject o) {
|
||||
m_asset.set(s, o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedKey(PageState s, Object key) {
|
||||
throw new UnsupportedOperationException( (String) GlobalizationUtil.globalize("cms.ui.authoring.not_implemented").localize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(PageState s) {
|
||||
return (getSelectedObject(s) != null);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ import weka.core.Instance;
|
|||
import weka.core.Instances;
|
||||
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.TextPage;
|
||||
import com.arsdigita.cms.contenttypes.GenericArticle;
|
||||
import com.arsdigita.london.terms.Domain;
|
||||
import com.arsdigita.london.terms.Term;
|
||||
import com.arsdigita.london.terms.indexing.Indexer;
|
||||
|
|
@ -63,7 +63,7 @@ public class IndexerService {
|
|||
|
||||
// Extract keyphrases
|
||||
StringBuffer txtStr = new StringBuffer();
|
||||
txtStr.append(((TextPage) item).getTextAsset().getText());
|
||||
txtStr.append(((GenericArticle) item).getTextAsset().getText());
|
||||
|
||||
double[] newInst = new double[2];
|
||||
newInst[0] = (double) data.attribute(0).addStringValue(txtStr.toString());
|
||||
|
|
|
|||
Loading…
Reference in New Issue