Skip to content

Commit

Permalink
Created project and added some model
Browse files Browse the repository at this point in the history
  • Loading branch information
aurasphere committed Dec 25, 2016
1 parent fe067fb commit 484f6d7
Show file tree
Hide file tree
Showing 10 changed files with 1,649 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>telegram-botmill</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
62 changes: 62 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>co.aurasphere.botmill</groupId>
<artifactId>telegram-botmill</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Telegram-BotMill</name>
<description>A Java framework for building bots on Telegram.</description>

<dependencies>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.2</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.4.Final</version>
</dependency>

<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
</dependency>

</dependencies>

</project>
260 changes: 260 additions & 0 deletions src/main/java/co/aurasphere/botmill/telegram/model/Chat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
package co.aurasphere.botmill.telegram.model;

import java.io.Serializable;

import com.google.gson.annotations.SerializedName;

/**
* This object represents a chat.
*
* @author Donato Rimenti
* @date Dec 25, 2016
*/
public class Chat implements Serializable {

/**
* The serial version UID.
*/
private static final long serialVersionUID = 1L;

/**
* Unique identifier for this chat. This number may be greater than 32 bits
* and some programming languages may have difficulty/silent defects in
* interpreting it. But it smaller than 52 bits, so a signed 64 bit integer
* or double-precision float type are safe for storing this identifier.
*/
private String id;

/**
* Type of chat, can be either “private”, “group”, “supergroup” or
* “channel”.
*/
private ChatType type;

/**
* Type of chat, can be either “private”, “group”, “supergroup” or “channel”.
*/
private String title;

/**
* Optional. Username, for private chats, supergroups and channels if available.
*/
private String username;

/**
* Optional. First name of the other party in a private chat.
*/
@SerializedName("first_name")
private String firstName;

/**
* Optional. Last name of the other party in a private chat.
*/
@SerializedName("last_name")
private String lastName;

/**
* Optional. True if a group has ‘All Members Are Admins’ enabled.
*/
@SerializedName("all_members_are_administrators")
private boolean allMembersAreAdministrators;

/**
* Gets the {@link #id}.
*
* @return the {@link #id}.
*/
public String getId() {
return id;
}

/**
* Sets the {@link #id}.
*
* @param id the {@link #id} to set.
*/
public void setId(String id) {
this.id = id;
}

/**
* Gets the {@link #type}.
*
* @return the {@link #type}.
*/
public ChatType getType() {
return type;
}

/**
* Sets the {@link #type}.
*
* @param type the {@link #type} to set.
*/
public void setType(ChatType type) {
this.type = type;
}

/**
* Gets the {@link #title}.
*
* @return the {@link #title}.
*/
public String getTitle() {
return title;
}

/**
* Sets the {@link #title}.
*
* @param title the {@link #title} to set.
*/
public void setTitle(String title) {
this.title = title;
}

/**
* Gets the {@link #username}.
*
* @return the {@link #username}.
*/
public String getUsername() {
return username;
}

/**
* Sets the {@link #username}.
*
* @param username the {@link #username} to set.
*/
public void setUsername(String username) {
this.username = username;
}

/**
* Gets the {@link #firstName}.
*
* @return the {@link #firstName}.
*/
public String getFirstName() {
return firstName;
}

/**
* Sets the {@link #firstName}.
*
* @param firstName the {@link #firstName} to set.
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}

/**
* Gets the {@link #lastName}.
*
* @return the {@link #lastName}.
*/
public String getLastName() {
return lastName;
}

/**
* Sets the {@link #lastName}.
*
* @param lastName the {@link #lastName} to set.
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}

/**
* Checks if is all members are administrators.
*
* @return true, if is all members are administrators
*/
public boolean isAllMembersAreAdministrators() {
return allMembersAreAdministrators;
}

/**
* Sets the {@link #allMembersAreAdministrators}.
*
* @param allMembersAreAdministrators the {@link #allMembersAreAdministrators} to set.
*/
public void setAllMembersAreAdministrators(boolean allMembersAreAdministrators) {
this.allMembersAreAdministrators = allMembersAreAdministrators;
}

/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (allMembersAreAdministrators ? 1231 : 1237);
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result
+ ((username == null) ? 0 : username.hashCode());
return result;
}

/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Chat other = (Chat) obj;
if (allMembersAreAdministrators != other.allMembersAreAdministrators)
return false;
if (firstName == null) {
if (other.firstName != null)
return false;
} else if (!firstName.equals(other.firstName))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
if (username == null) {
if (other.username != null)
return false;
} else if (!username.equals(other.username))
return false;
return true;
}

/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Chat [id=" + id + ", title=" + title + ", username=" + username
+ ", firstName=" + firstName + ", lastName=" + lastName
+ ", allMembersAreAdministrators="
+ allMembersAreAdministrators + "]";
}

}
Loading

0 comments on commit 484f6d7

Please sign in to comment.