Navigation Menu

Skip to content

Commit

Permalink
Data model and services for chatroom messages generated by ServiceBui…
Browse files Browse the repository at this point in the history
…lder
  • Loading branch information
azzazzel committed Jan 3, 2011
1 parent d832c26 commit 63b77b5
Show file tree
Hide file tree
Showing 34 changed files with 4,809 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docroot/WEB-INF/service.xml
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 5.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_5_2_0.dtd">

<!--
This file is part of CustomGlobalMarkup Liferay plug-in.
CustomGlobalMarkup Liferay plug-in is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
CustomGlobalMarkup Liferay plug-in is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with CustomGlobalMarkup Liferay plug-in. If not, see <http://www.gnu.org/licenses/lgpl.html>.
-->

<service-builder package-path="com.commsen.sample.portlet.chatrooms">
<!--
Author will be inserted into Java Doc comments in generated classes
-->
<author>Milen Dyankov</author>

<!--
Tables in the database will have their names prepended with "<namespace>"
-->
<namespace>Chatrooms</namespace>

<entity name="Message" local-service="true" remote-service="false">
<!-- Primary key column -->
<column name="id" type="long" primary="true" />

<!-- Other columns -->
<column name="time" type="Date" />
<column name="chatroom" type="String" />
<column name="user" type="String" />
<column name="message" type="String" />

<order by="asc">
<order-column name="time"></order-column>
</order>

<!-- Finder Methods -->
<finder name="Chatroom" return-type="Collection">
<finder-column name="chatroom" />
</finder>

</entity>

</service-builder>
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.commsen.sample.portlet.chatrooms;

import com.liferay.portal.NoSuchModelException;

/**
* @author Milen Dyankov
*/
public class NoSuchMessageException extends NoSuchModelException {

public NoSuchMessageException() {
super();
}

public NoSuchMessageException(String msg) {
super(msg);
}

public NoSuchMessageException(String msg, Throwable cause) {
super(msg, cause);
}

public NoSuchMessageException(Throwable cause) {
super(cause);
}

}
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.commsen.sample.portlet.chatrooms.model;

/**
* The model interface for the Message service. Represents a row in the &quot;Chatrooms_Message&quot; database table, with each column mapped to a property of this class.
*
* <p>
* Never modify this interface directly. Add methods to {@link com.commsen.sample.portlet.chatrooms.model.impl.MessageImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
* </p>
*
* <p>
* Never reference this interface directly. All methods that expect a message model instance should use the {@link Message} interface instead.
* </p>
*
* @author Milen Dyankov
* @see MessageModel
* @see com.commsen.sample.portlet.chatrooms.model.impl.MessageImpl
* @see com.commsen.sample.portlet.chatrooms.model.impl.MessageModelImpl
* @generated
*/
public interface Message extends MessageModel {
}
@@ -0,0 +1,205 @@
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.commsen.sample.portlet.chatrooms.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.DateUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.Date;

/**
* @author Milen Dyankov
*/
public class MessageClp extends BaseModelImpl<Message> implements Message {
public MessageClp() {
}

public long getPrimaryKey() {
return _id;
}

public void setPrimaryKey(long pk) {
setId(pk);
}

public Serializable getPrimaryKeyObj() {
return new Long(_id);
}

public long getId() {
return _id;
}

public void setId(long id) {
_id = id;
}

public Date getTime() {
return _time;
}

public void setTime(Date time) {
_time = time;
}

public String getChatroom() {
return _chatroom;
}

public void setChatroom(String chatroom) {
_chatroom = chatroom;
}

public String getUser() {
return _user;
}

public void setUser(String user) {
_user = user;
}

public String getMessage() {
return _message;
}

public void setMessage(String message) {
_message = message;
}

public Message toEscapedModel() {
if (isEscapedModel()) {
return this;
}
else {
return (Message)Proxy.newProxyInstance(Message.class.getClassLoader(),
new Class[] { Message.class }, new AutoEscapeBeanHandler(this));
}
}

public Object clone() {
MessageClp clone = new MessageClp();

clone.setId(getId());
clone.setTime(getTime());
clone.setChatroom(getChatroom());
clone.setUser(getUser());
clone.setMessage(getMessage());

return clone;
}

public int compareTo(Message message) {
int value = 0;

value = DateUtil.compareTo(getTime(), message.getTime());

if (value != 0) {
return value;
}

return 0;
}

public boolean equals(Object obj) {
if (obj == null) {
return false;
}

MessageClp message = null;

try {
message = (MessageClp)obj;
}
catch (ClassCastException cce) {
return false;
}

long pk = message.getPrimaryKey();

if (getPrimaryKey() == pk) {
return true;
}
else {
return false;
}
}

public int hashCode() {
return (int)getPrimaryKey();
}

public String toString() {
StringBundler sb = new StringBundler(11);

sb.append("{id=");
sb.append(getId());
sb.append(", time=");
sb.append(getTime());
sb.append(", chatroom=");
sb.append(getChatroom());
sb.append(", user=");
sb.append(getUser());
sb.append(", message=");
sb.append(getMessage());
sb.append("}");

return sb.toString();
}

public String toXmlString() {
StringBundler sb = new StringBundler(19);

sb.append("<model><model-name>");
sb.append("com.commsen.sample.portlet.chatrooms.model.Message");
sb.append("</model-name>");

sb.append(
"<column><column-name>id</column-name><column-value><![CDATA[");
sb.append(getId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>time</column-name><column-value><![CDATA[");
sb.append(getTime());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>chatroom</column-name><column-value><![CDATA[");
sb.append(getChatroom());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>user</column-name><column-value><![CDATA[");
sb.append(getUser());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>message</column-name><column-value><![CDATA[");
sb.append(getMessage());
sb.append("]]></column-value></column>");

sb.append("</model>");

return sb.toString();
}

private long _id;
private Date _time;
private String _chatroom;
private String _user;
private String _message;
}

0 comments on commit 63b77b5

Please sign in to comment.