Getting Started with Entry List Screenlet

Like Guestbook List Screenlet, you’ll create Entry List Screenlet in a new package inside your app’s project. Get started by creating the package Once you have this package, you’re ready to start writing the Screenlet.

Creating the Model Class for Entries

Recall that you need a model class to represent entities retrieved from Liferay Portal. The model class you’ll create for guestbook entries, EntryModel, creates EntryModel objects that serve as guestbook entries retrieved from the Guestbook portlet.

Create the following EntryModel class alongside the GuestbookModel class in the package:


import android.os.Parcel;
import android.os.Parcelable;

import java.util.Date;
import java.util.Map;

public class EntryModel implements Parcelable {

    private Map values;
    private long entryId;
    private long groupId;
    private long companyId;
    private long userId;
    private String userName;
    private long createDate;
    private long modifiedDate;
    private String name;
    private String email;
    private String message;
    private long guestbookId;

    public static final Creator<EntryModel> CREATOR = new Creator<EntryModel>() {
        public EntryModel createFromParcel(Parcel in) {
            return new EntryModel(in);

        public EntryModel[] newArray(int size) {
            return new EntryModel[size];

    public EntryModel() {

    protected EntryModel(Parcel in) {
        entryId = in.readLong();
        groupId = in.readLong();
        companyId = in.readLong();
        userId = in.readLong();
        userName = in.readString();
        createDate = in.readLong();
        modifiedDate = in.readLong();
        name = in.readString();
        email = in.readString();
        message = in.readString();
        guestbookId = in.readLong();

    public EntryModel(Map<String, Object> stringObjectMap) {
        values = stringObjectMap;
        entryId = ((Integer) stringObjectMap.get("entryId")).longValue();
        groupId = ((Integer) stringObjectMap.get("groupId")).longValue();
        companyId = ((Integer) stringObjectMap.get("companyId")).longValue();
        userId = ((Integer) stringObjectMap.get("userId")).longValue();
        userName = (String) stringObjectMap.get("userName");
        createDate = (long) stringObjectMap.get("createDate");
        modifiedDate = (long) stringObjectMap.get("modifiedDate");
        name = (String) stringObjectMap.get("name");
        email = (String) stringObjectMap.get("email");
        message = (String) stringObjectMap.get("message");
        guestbookId = ((Integer) stringObjectMap.get("guestbookId")).longValue();

    public void writeToParcel(Parcel dest, int flags) {

    public int describeContents() {
        return 0;

    public Map getValues() {
        return values;

    public void setValues(Map values) {
        this.values = values;

    public long getEntryId() {
        return entryId;

    public long getGroupId() {
        return groupId;

    public long getCompanyId() {
        return companyId;

    public long getUserId() {
        return userId;

    public String getUserName() {
        return userName;

    public Date getCreateDate() {
        return new Date(createDate);

    public Date getModifiedDate() {
        return new Date(modifiedDate);

    public String getName() {
        return name;

    public String getEmail() {
        return email;

    public String getMessage() {
        return message;

    public long getGuestbookId() {
        return guestbookId;


Besides working with entries instead of guestbooks, this class works the same as GuestbookModel. For an explanation of the code, see the article on getting started with Guestbook List Screenlet.

Next, you’ll create the Screenlet’s UI.

« Creating Entry List ScreenletCreating Entry List Screenlet's UI »
Was this article helpful?
0 out of 0 found this helpful