1. Content Class

First of all create a new package "custom" (or use any other path of your choice) and create a new class within it:

ROOT/WEB-INF/src/custom/Meeting.java

All you see below is very basic stuff if you're used to Java:

  • Simple getter/setters around the fields which are persisted by the object database.
  • overriden method #getFulltext() to provide content for the fulltext-search.
  • overriden method #replace() which allows search and replace functionality (esp. for rewriting internal links).
  • overriden method #copy() for creating controlled replicas of the content.

The Meeting-class needs to extend the Content-class which is the building block for the whole Content-Management-System:

package custom;

import java.util.Date;
import jease.cms.domain.Content;

public class Meeting extends Content {

    private String topic;
    private String location;
    private Date start;
    private Date stop;

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getStop() {
        return stop;
    }

    public void setStop(Date stop) {
        this.stop = stop;
    }

    public StringBuilder getFulltext() {
        return super.getFulltext().append("\n")
                      .append(topic).append("\n")
                      .append(location);
    }

    public void replace(String target, String replacement) {
       super.replace(target, replacement);
       setTopic(getTopic().replace(target, replacement));
       setLocation(getLocation().replace(target, replacement));
    }

    public Meeting copy(boolean recursive) {
        Meeting meeting = (Meeting) super.copy(recursive);
        meeting.setTopic(getTopic());
        meeting.setLocation(getLocation());
        meeting.setStart(getStart());
        meeting.setStop(getStop());
        return meeting;
    }
}

Last modified on 2011-08-01 by Maik Jablonski

Want to contribute?

1970-01-01

Do you want to contribute to Jease? Writing documentation is a good place to get started and will help to get people becoming more familiar with Jease. Any contribution is appreciated.