file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
SmsMessagesDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/SmsMessagesDaoTest.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.mybatis;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.restcomm.connect.commons.dao.MessageError;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.SmsMessagesDao;
import org.restcomm.connect.dao.common.Sorting;
import org.restcomm.connect.dao.entities.SmsMessage;
import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URI;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Currency;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import org.restcomm.connect.dao.entities.SmsMessageFilter;
/**
* @author [email protected] (Thomas Quintana)
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public final class SmsMessagesDaoTest {
private static Logger logger = Logger.getLogger(SmsMessagesDaoTest.class);
private static MybatisDaoManager manager;
public SmsMessagesDaoTest() {
super();
}
@Before
public void before() {
final InputStream data = getClass().getResourceAsStream("/mybatis.xml");
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() {
manager.shutdown();
}
@Test
public void createReadUpdateDelete() {
final Sid sid = Sid.generate(Sid.Type.SMS_MESSAGE);
final Sid account = Sid.generate(Sid.Type.ACCOUNT);
final URI url = URI.create("2012-04-24/Accounts/Acoount/SMS/Messages/unique-id.json");
final SmsMessage.Builder builder = SmsMessage.builder();
builder.setSid(sid);
builder.setAccountSid(account);
builder.setApiVersion("2012-04-24");
builder.setRecipient("+12223334444");
builder.setSender("+17778889999");
builder.setBody("Hello World!");
builder.setStatus(SmsMessage.Status.SENDING);
builder.setDirection(SmsMessage.Direction.INBOUND);
builder.setPrice(new BigDecimal("0.00"));
builder.setPriceUnit(Currency.getInstance("USD"));
builder.setUri(url);
builder.setStatusCallback(url);
SmsMessage message = builder.build();
final SmsMessagesDao messages = manager.getSmsMessagesDao();
// Create a new sms message in the data store.
messages.addSmsMessage(message);
// Read the message from the data store.
SmsMessage result = messages.getSmsMessage(sid);
// Validate the results.
assertTrue(result.getSid().equals(message.getSid()));
assertTrue(result.getAccountSid().equals(message.getAccountSid()));
assertTrue(result.getApiVersion().equals(message.getApiVersion()));
assertTrue(result.getDateSent() == message.getDateSent());
assertTrue(result.getRecipient().equals(message.getRecipient()));
assertTrue(result.getSender().equals(message.getSender()));
assertTrue(result.getBody().equals(message.getBody()));
assertTrue(result.getStatus() == message.getStatus());
assertTrue(result.getDirection() == message.getDirection());
assertTrue(result.getPrice().equals(message.getPrice()));
assertTrue(result.getPriceUnit().equals(message.getPriceUnit()));
assertTrue(result.getUri().equals(message.getUri()));
assertTrue(result.getStatusCallback().equals(message.getStatusCallback()));
// Update the message.
final DateTime now = DateTime.now();
final SmsMessage.Builder builder2 = SmsMessage.builder();
builder2.copyMessage(message);
builder2.setDateSent(now);
builder2.setStatus(SmsMessage.Status.SENT);
messages.updateSmsMessage(builder2.build());
// Read the updated message from the data store.
result = messages.getSmsMessage(sid);
// Validate the results.
assertTrue(result.getDateSent().equals(now));
assertEquals(SmsMessage.Status.SENT, result.getStatus());
// Delete the message.
messages.removeSmsMessage(sid);
// Validate that the CDR was removed.
assertTrue(messages.getSmsMessage(sid) == null);
}
private SmsMessage createSms() {
return createSms(Sid.generate(Sid.Type.ACCOUNT), SmsMessage.Direction.OUTBOUND_API, 0, DateTime.now());
}
private SmsMessage createSms(Sid account, SmsMessage.Direction direction, int index, DateTime date) {
return createSms(account, direction, index, date, null);
}
private SmsMessage createSms(Sid account, SmsMessage.Direction direction, int index, DateTime date, String smppMessageId) {
final Sid sid = Sid.generate(Sid.Type.SMS_MESSAGE);
final URI url = URI.create("2012-04-24/Accounts/Acoount/SMS/Messages/unique-id.json");
return SmsMessage.builder()
.setSid(sid)
.setAccountSid(account)
.setApiVersion("2012-04-24")
.setRecipient("+12223334444")
.setSender("+17778889999")
.setBody("Hello World - " + index)
.setStatus(SmsMessage.Status.SENDING)
.setDirection(direction)
.setPrice(new BigDecimal("0.00"))
.setPriceUnit(Currency.getInstance("USD"))
.setUri(url)
.setDateCreated(date)
.setSmppMessageId(smppMessageId)
.build();
}
@Test
public void aaatestGetSmsMessagesLastMinute() throws InterruptedException, ParseException {
final SmsMessagesDao messages = manager.getSmsMessagesDao();
final Sid account = Sid.generate(Sid.Type.ACCOUNT);
DateTime oneMinuteAgo = DateTime.now().minusSeconds(58);
for (int i = 0; i < 2; i++) {
SmsMessage message = createSms(account, SmsMessage.Direction.OUTBOUND_API, i, oneMinuteAgo);
// Create a new sms message in the data store.
messages.addSmsMessage(message);
logger.info("Created message: " + message);
}
for (int i = 0; i < 2; i++) {
SmsMessage message = createSms(account, SmsMessage.Direction.OUTBOUND_CALL, i, oneMinuteAgo);
// Create a new sms message in the data store.
messages.addSmsMessage(message);
logger.info("Created message: " + message);
}
for (int i = 0; i < 2; i++) {
SmsMessage message = createSms(account, SmsMessage.Direction.OUTBOUND_REPLY, i, oneMinuteAgo);
// Create a new sms message in the data store.
messages.addSmsMessage(message);
logger.info("Created message: " + message);
}
int lastMessages = messages.getSmsMessagesPerAccountLastPerMinute(account.toString());
logger.info("SMS Messages last minutes: " + lastMessages);
assertEquals(6, lastMessages);
Thread.sleep(5000);
DateTime oneMinuteLater = DateTime.now();
for (int i = 0; i < 3; i++) {
SmsMessage message = createSms(account, SmsMessage.Direction.OUTBOUND_CALL, i, oneMinuteLater);
// Create a new sms message in the data store.
messages.addSmsMessage(message);
logger.info("Created message: " + message);
}
lastMessages = messages.getSmsMessagesPerAccountLastPerMinute(account.toString());
logger.info("SMS Messages last minutes: " + lastMessages);
assertEquals(3, lastMessages);
messages.removeSmsMessages(account);
}
@Test
public void testReadDeleteByAccount() {
final Sid sid = Sid.generate(Sid.Type.SMS_MESSAGE);
final Sid account = Sid.generate(Sid.Type.ACCOUNT);
DateTime now = DateTime.now();
final URI url = URI.create("2012-04-24/Accounts/Acoount/SMS/Messages/unique-id.json");
final SmsMessage.Builder builder = SmsMessage.builder();
builder.setSid(sid);
builder.setAccountSid(account);
builder.setApiVersion("2012-04-24");
builder.setDateSent(now);
builder.setRecipient("+12223334444");
builder.setSender("+17778889999");
builder.setBody("Hello World!");
builder.setStatus(SmsMessage.Status.SENDING);
builder.setDirection(SmsMessage.Direction.INBOUND);
builder.setPrice(new BigDecimal("0.00"));
builder.setPriceUnit(Currency.getInstance("GBP"));
builder.setUri(url);
SmsMessage message = builder.build();
final SmsMessagesDao messages = manager.getSmsMessagesDao();
// Create a new sms message in the data store.
messages.addSmsMessage(message);
// Validate the results.
assertTrue(messages.getSmsMessages(account).size() == 1);
// Delete the message.
messages.removeSmsMessages(account);
// Validate the results.
assertTrue(messages.getSmsMessages(account).size() == 0);
}
@Test
public void testUpdateSmsMessageDateSentAndStatusAndGetBySmppMsgId() {
final DateTime dateSent = DateTime.now();
final SmsMessage.Status status = SmsMessage.Status.SENT;
final String smppMessageId = "0000058049";
// add a new msg
SmsMessage smsMessage = createSms();
final SmsMessagesDao messages = manager.getSmsMessagesDao();
messages.addSmsMessage(smsMessage);
//set status and dateSent
final SmsMessage.Builder builder2 = SmsMessage.builder();
builder2.copyMessage(smsMessage);
builder2.setStatus(status).setDateSent(dateSent).setSmppMessageId(smppMessageId);
messages.updateSmsMessage(builder2.build());
//get SmsMessage By SmppMessageId
SmsMessage resultantSmsMessage = messages.getSmsMessageBySmppMessageId(smppMessageId);
//make assertions
assertEquals(smppMessageId, resultantSmsMessage.getSmppMessageId());
assertEquals(dateSent, resultantSmsMessage.getDateSent());
assertEquals(status, resultantSmsMessage.getStatus());
}
@Test
public void testSmsMessageError() {
// add a new msg
SmsMessage smsMessage = createSms();
final SmsMessagesDao messages = manager.getSmsMessagesDao();
messages.addSmsMessage(smsMessage);
//update error message
final SmsMessage.Builder builder2 = SmsMessage.builder();
builder2.copyMessage(smsMessage);
builder2.setError(MessageError.QUEUE_OVERFLOW);
messages.updateSmsMessage(builder2.build());
//get msg from DB
SmsMessage resultantSmsMessage = messages.getSmsMessage(smsMessage.getSid());
//make assertions
assertEquals(MessageError.QUEUE_OVERFLOW, resultantSmsMessage.getError());
}
public void testFindBySmppMessageIdAndDateCreatedGreaterOrEqualThanOrderedByDateCreatedDesc() {
// given
final SmsMessagesDao smsMessagesDao = manager.getSmsMessagesDao();
final Sid accountSid = Sid.generate(Sid.Type.ACCOUNT);
final String smppMessageId = "12345";
final DateTime fourDaysAgo = DateTime.now().minusDays(4);
final SmsMessage smsMessage1 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 0, fourDaysAgo, smppMessageId);
final SmsMessage smsMessage2 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 1, fourDaysAgo, smppMessageId);
final DateTime threeDaysAgo = DateTime.now().minusDays(3);
final SmsMessage smsMessage3 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 2, threeDaysAgo, smppMessageId);
final SmsMessage smsMessage4 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 3, threeDaysAgo, null);
final DateTime yesterday = DateTime.now().minusDays(1);
final SmsMessage smsMessage5 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 4, yesterday, smppMessageId);
final DateTime today = DateTime.now();
final SmsMessage smsMessage6 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 5, today, smppMessageId);
final SmsMessage smsMessage7 = createSms(accountSid, SmsMessage.Direction.OUTBOUND_API, 6, today, null);
// when
smsMessagesDao.addSmsMessage(smsMessage1);
smsMessagesDao.addSmsMessage(smsMessage2);
smsMessagesDao.addSmsMessage(smsMessage3);
smsMessagesDao.addSmsMessage(smsMessage4);
smsMessagesDao.addSmsMessage(smsMessage5);
smsMessagesDao.addSmsMessage(smsMessage6);
smsMessagesDao.addSmsMessage(smsMessage7);
final List<SmsMessage> messages = smsMessagesDao.findBySmppMessageId(smppMessageId);
// then
try {
assertEquals(5, messages.size());
for (SmsMessage message: messages) {
assertEquals(smppMessageId, message.getSmppMessageId());
}
} finally {
smsMessagesDao.removeSmsMessages(accountSid);
}
}
@Test
public void filterWithDateSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByDate(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
final DateTime min = DateTime.parse("2016-11-07T16:23:41.882");
final DateTime max = DateTime.parse("2016-11-07T16:23:42.389");
assertEquals(min.compareTo(smsMessages.get(0).getDateCreated()), 0);
assertEquals(max.compareTo(smsMessages.get(smsMessages.size() - 1).getDateCreated()), 0);
builder.sortedByDate(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals(max.compareTo(smsMessages.get(0).getDateCreated()), 0);
assertEquals(min.compareTo(smsMessages.get(smsMessages.size() - 1).getDateCreated()), 0);
}
@Test
public void filterWithFromSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByFrom(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("+17778889990", smsMessages.get(0).getSender());
assertEquals("+17778889995", smsMessages.get(smsMessages.size() - 1).getSender());
builder.sortedByFrom(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("+17778889995", smsMessages.get(0).getSender());
assertEquals("+17778889990", smsMessages.get(smsMessages.size() - 1).getSender());
}
@Test
public void filterWithToSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByTo(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("+12223334444", smsMessages.get(0).getRecipient());
assertEquals("+12223334449", smsMessages.get(smsMessages.size() - 1).getRecipient());
builder.sortedByTo(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("+12223334449", smsMessages.get(0).getRecipient());
assertEquals("+12223334444", smsMessages.get(smsMessages.size() - 1).getRecipient());
}
@Test
public void filterWithDirectionSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByDirection(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("outbound-api", smsMessages.get(0).getDirection().toString());
assertEquals("outbound-reply", smsMessages.get(smsMessages.size() - 1).getDirection().toString());
builder.sortedByDirection(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("outbound-reply", smsMessages.get(0).getDirection().toString());
assertEquals("outbound-api", smsMessages.get(smsMessages.size() - 1).getDirection().toString());
}
@Test
public void filterWithStatusSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByStatus(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("delivered", smsMessages.get(0).getStatus().toString());
assertEquals("undelivered", smsMessages.get(smsMessages.size() - 1).getStatus().toString());
builder.sortedByStatus(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("undelivered", smsMessages.get(0).getStatus().toString());
assertEquals("delivered", smsMessages.get(smsMessages.size() - 1).getStatus().toString());
}
@Test
public void filterWithBodySorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByBody(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("Hello World - 0", smsMessages.get(0).getBody().toString());
assertEquals("Hello World - 1", smsMessages.get(smsMessages.size() - 1).getBody().toString());
builder.sortedByBody(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("Hello World - 1", smsMessages.get(0).getBody().toString());
assertEquals("Hello World - 0", smsMessages.get(smsMessages.size() - 1).getBody().toString());
}
@Test
public void filterWithPriceSorting() throws ParseException {
SmsMessagesDao dao = manager.getSmsMessagesDao();
SmsMessageFilter.Builder builder = new SmsMessageFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("AC681caba993db40fd9166404f6a30e67d");
builder.byAccountSidSet(accountSidSet);
builder.sortedByPrice(Sorting.Direction.ASC);
SmsMessageFilter filter = builder.build();
List<SmsMessage> smsMessages = dao.getSmsMessages(filter);
assertEquals(6, smsMessages.size());
assertEquals("0.00", smsMessages.get(0).getPrice().toString());
assertEquals("120.00", smsMessages.get(smsMessages.size() - 1).getPrice().toString());
builder.sortedByPrice(Sorting.Direction.DESC);
filter = builder.build();
smsMessages = dao.getSmsMessages(filter);
assertEquals("120.00", smsMessages.get(0).getPrice().toString());
assertEquals("0.00", smsMessages.get(smsMessages.size() - 1).getPrice().toString());
}
}
| 21,949 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ExtensionConfigurationDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/ExtensionConfigurationDaoTest.java | package org.restcomm.connect.dao.mybatis;
import java.io.File;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.restcomm.connect.commons.annotations.UnstableTests;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.extension.api.ConfigurationException;
import org.restcomm.connect.extension.api.ExtensionConfiguration;
import java.io.InputStream;
import java.nio.file.Files;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
import java.util.List;
import java.util.Properties;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Rule;
import org.junit.rules.TestName;
/**
* Created by gvagenas on 21/10/2016.
*/
@Category(UnstableTests.class)
@Ignore
public class ExtensionConfigurationDaoTest {
private static MybatisDaoManager manager;
private MybatisExtensionsConfigurationDao extensionsConfigurationDao;
@Rule
public TestName name = new TestName();
private String validJsonObject = "{\n" +
" \"project\": \"Restcomm-Connect\",\n" +
" \"url\": \"http://restcomm.com\",\n" +
" \"open-source\": true,\n" +
" \"scm\": {\n" +
" \"url\": \"https://github.com/RestComm/Restcomm-Connect/\",\n" +
" \"issues\": \"https://github.com/RestComm/Restcomm-Connect/issues\"\n" +
" },\n" +
" \"ci\": {\n" +
" \"name\": \"Jenkins\",\n" +
" \"url\": \"https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/\"\n" +
" },\n" +
" \"active\": \"true\"\n" +
"}";
private String invalidJsonObject = "{\n" +
" project: Restcomm-Connect,\n" +
" \"url\": \"http://restcomm.com\",\n" +
" \"open-source\": true,\n" +
" \"scm\": {\n" +
" \"url\": \"https://github.com/RestComm/Restcomm-Connect/\",\n" +
" \"issues\": \"https://github.com/RestComm/Restcomm-Connect/issues\"\n" +
" }\n" +
" \"ci\": [\n" +
" {\n" +
" \"name\": \"Jenkins\",\n" +
" \"url\": \"https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/\"\n" +
" }\n" +
" \"active\": \"true\"\n" +
"}";
private String validXmlDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project>\n" +
" <name>Restcomm-Connect</name>\n" +
" <url>http://restcomm.com</url>\n" +
" <open-source>true</open-source>\n" +
" <scm>\n" +
" <url>https://github.com/RestComm/Restcomm-Connect/</url>\n" +
" <issues>https://github.com/RestComm/Restcomm-Connect/issues</issues>\n" +
" </scm>\n" +
" <ci>\n" +
" <name>Jenkins</name>\n" +
" <url>https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/</url>\n" +
" </ci>\n" +
"</project>";
private String invalidXmlDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project>\n" +
" <name>Restcomm-Connect</name>\n" +
" <url>http://restcomm.com</url>\n" +
" <open-source>true</open-source>\n" +
" <scm>\n" +
" <url>https://github.com/RestComm/Restcomm-Connect/</url>\n" +
" <issues>https://github.com/RestComm/Restcomm-Connect/issues</issues>\n" +
" </scm>\n" +
" <ci>\n" +
" <name>Jenkins</name>\n" +
" <url>https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/</url>\n" +
" </ci>";
private String updatedJsonObject = "{\n" +
" \"project\": \"Restcomm-Connect\",\n" +
" \"url\": \"http://restcomm.com\",\n" +
" \"open-source\": true,\n" +
" \"scm\": {\n" +
" \"url\": \"https://github.com/RestComm/Restcomm-Connect/\",\n" +
" \"issues\": \"https://github.com/RestComm/Restcomm-Connect/issues\"\n" +
" },\n" +
" \"ci\": {\n" +
" \"name\": \"Jenkins\",\n" +
" \"url\": \"https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/\"\n" +
" },\n" +
" \"active\": \"false\"\n" +
"}";
private String updatedXmlDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project>\n" +
" <name>Restcomm-Connect</name>\n" +
" <url>http://restcomm.com</url>\n" +
" <open-source>true</open-source>\n" +
" <scm>\n" +
" <url>https://github.com/RestComm/Restcomm-Connect/</url>\n" +
" <issues>https://github.com/RestComm/Restcomm-Connect/issues</issues>\n" +
" </scm>\n" +
" <ci>\n" +
" <name>Jenkins</name>\n" +
" <url>https://mobicents.ci.cloudbees.com/view/RestComm/job/RestComm/</url>\n" +
" </ci>\n" +
" <active>true</active>\n" +
"</project>";
@Before
public void before() throws Exception{
//use a different data dir for each test case to provide isolation
Properties properties = new Properties();
File srcFile = new File("./target/test-classes/data/restcomm.script");
File theDir = new File("./target/test-classes/data" + name.getMethodName());
theDir.mkdir();
File destFile = new File("./target/test-classes/data" + name.getMethodName() + "/restcomm.script");
Files.copy(srcFile.toPath(),
destFile.toPath(), REPLACE_EXISTING);
properties.setProperty("data", name.getMethodName());
final InputStream data = getClass().getResourceAsStream("/mybatis_pertest.xml");
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data,properties);
manager = new MybatisDaoManager();
manager.start(factory);
extensionsConfigurationDao = (MybatisExtensionsConfigurationDao) manager.getExtensionsConfigurationDao();
}
@After
public void after() {
manager.shutdown();
}
@Test
public void testValidJsonDoc() {
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
"testExt", true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
assertEquals(true, extensionsConfigurationDao.validate(validExtensionConfiguration));
}
@Test
public void testInvalidJsonDoc() {
ExtensionConfiguration invalidExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
"testExt", true, invalidJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
assertEquals(false, extensionsConfigurationDao.validate(invalidExtensionConfiguration));
}
@Test
public void testValidXmlDoc() {
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
"testExt", true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
assertEquals(true, extensionsConfigurationDao.validate(validExtensionConfiguration));
}
@Test
public void testInvalidXmlDoc() {
ExtensionConfiguration invalidExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
"testExt", true, invalidXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
assertEquals(false, extensionsConfigurationDao.validate(invalidExtensionConfiguration));
}
@Test
public void testStoreAndRetrieveConfigurationByNameJson() throws ConfigurationException {
String extName = "testExt";
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
extName, true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
extensionsConfigurationDao.deleteConfigurationByName(extName);
}
@Test
public void testStoreAndRetrieveConfigurationBySidJson() throws ConfigurationException {
Sid sid = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(sid,
"testExt", true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
extensionsConfigurationDao.deleteConfigurationBySid(sid);
}
@Test
public void testStoreUpdateAndRetrieveConfigurationByNameJson() throws ConfigurationException {
String extName = "testExt";
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
extName, true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
validExtensionConfiguration.setConfigurationData(updatedJsonObject, ExtensionConfiguration.configurationType.JSON);
extensionsConfigurationDao.updateConfiguration(validExtensionConfiguration);
retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertEquals(updatedJsonObject, retrievedConf.getConfigurationData());
extensionsConfigurationDao.deleteConfigurationByName(extName);
}
@Test
public void testStoreUpdateAndRetrieveConfigurationBySidJson() throws ConfigurationException {
Sid sid = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(sid,
"testExt", true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
validExtensionConfiguration.setConfigurationData(updatedJsonObject, ExtensionConfiguration.configurationType.JSON);
extensionsConfigurationDao.updateConfiguration(validExtensionConfiguration);
retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertEquals(updatedJsonObject, retrievedConf.getConfigurationData());
extensionsConfigurationDao.deleteConfigurationBySid(sid);
}
@Test
public void testStoreAndRetrieveConfigurationByNameXml() throws ConfigurationException {
String extName = "testExt";
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
extName, true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
extensionsConfigurationDao.deleteConfigurationByName(extName);
}
@Test
public void testStoreAndRetrieveConfigurationBySidXml() throws ConfigurationException {
Sid sid = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(sid,
"testExt", true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
extensionsConfigurationDao.deleteConfigurationBySid(sid);
}
@Test
public void testStoreUpdateAndRetrieveConfigurationByNameXml() throws ConfigurationException {
String extName = "testExt";
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
extName, true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
validExtensionConfiguration.setConfigurationData(updatedXmlDoc, ExtensionConfiguration.configurationType.XML);
extensionsConfigurationDao.updateConfiguration(validExtensionConfiguration);
retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertEquals(updatedXmlDoc, retrievedConf.getConfigurationData());
extensionsConfigurationDao.deleteConfigurationByName(extName);
}
@Test
public void testStoreUpdateAndRetrieveConfigurationBySidXml() throws ConfigurationException {
Sid sid = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration validExtensionConfiguration = new ExtensionConfiguration(sid,
"testExt", true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), validExtensionConfiguration.getConfigurationData().toString());
validExtensionConfiguration.setConfigurationData(updatedXmlDoc, ExtensionConfiguration.configurationType.XML);
extensionsConfigurationDao.updateConfiguration(validExtensionConfiguration);
retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertEquals(updatedXmlDoc, retrievedConf.getConfigurationData());
extensionsConfigurationDao.deleteConfigurationBySid(sid);
}
@Test
public void testStoreAndGetAllConfiguration() throws ConfigurationException {
Sid sid1 = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
Sid sid2 = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration validExtensionConfigurationXml = new ExtensionConfiguration(sid1,
"testExtXml", true, validXmlDoc, ExtensionConfiguration.configurationType.XML, DateTime.now());
ExtensionConfiguration validExtensionConfigurationJson = new ExtensionConfiguration(sid2,
"testExtJson", true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(validExtensionConfigurationXml);
extensionsConfigurationDao.addConfiguration(validExtensionConfigurationJson);
List<ExtensionConfiguration> confs = extensionsConfigurationDao.getAllConfiguration();
assertEquals(2, confs.size());
extensionsConfigurationDao.deleteConfigurationBySid(sid1);
extensionsConfigurationDao.deleteConfigurationBySid(sid2);
confs = extensionsConfigurationDao.getAllConfiguration();
assertEquals(0, confs.size());
}
@Test
public void testStoreUpdateAndRetrieveConfigurationByNameCheckVersionJson() throws ConfigurationException {
String extName = "testExt";
ExtensionConfiguration originalExtensionConfiguration = new ExtensionConfiguration(Sid.generate(Sid.Type.EXTENSION_CONFIGURATION),
extName, true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(originalExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationByName(extName);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), originalExtensionConfiguration.getConfigurationData().toString());
DateTime originalDateUpdated = retrievedConf.getDateUpdated();
boolean isUpdated = extensionsConfigurationDao.isLatestVersionByName(extName, originalDateUpdated);
assertEquals(isUpdated , false);
originalExtensionConfiguration.setConfigurationData(updatedJsonObject, ExtensionConfiguration.configurationType.JSON);
extensionsConfigurationDao.updateConfiguration(originalExtensionConfiguration);
isUpdated = extensionsConfigurationDao.isLatestVersionByName(extName, originalDateUpdated);
assertEquals(isUpdated , true);
extensionsConfigurationDao.deleteConfigurationByName(extName);
}
@Test
public void testStoreUpdateAndRetrieveConfigurationBySidCheckVersionJson() throws ConfigurationException {
String extName = "testExt";
Sid sid = Sid.generate(Sid.Type.EXTENSION_CONFIGURATION);
ExtensionConfiguration originalExtensionConfiguration = new ExtensionConfiguration(sid,
extName, true, validJsonObject, ExtensionConfiguration.configurationType.JSON, DateTime.now());
extensionsConfigurationDao.addConfiguration(originalExtensionConfiguration);
ExtensionConfiguration retrievedConf = extensionsConfigurationDao.getConfigurationBySid(sid);
assertNotNull(retrievedConf);
assertEquals(retrievedConf.getConfigurationData().toString(), originalExtensionConfiguration.getConfigurationData().toString());
DateTime originalDateUpdated = retrievedConf.getDateUpdated();
boolean isUpdated = extensionsConfigurationDao.isLatestVersionBySid(sid, originalDateUpdated);
assertEquals(isUpdated , false);
originalExtensionConfiguration.setConfigurationData(updatedJsonObject, ExtensionConfiguration.configurationType.JSON);
extensionsConfigurationDao.updateConfiguration(originalExtensionConfiguration);
isUpdated = extensionsConfigurationDao.isLatestVersionBySid(sid, originalDateUpdated);
assertEquals(isUpdated , true);
extensionsConfigurationDao.deleteConfigurationBySid(sid);
}
}
| 20,224 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ProfileAssociationsDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/ProfileAssociationsDaoTest.java | package org.restcomm.connect.dao.mybatis;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.Calendar;
import java.util.List;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.ProfileAssociationsDao;
import org.restcomm.connect.dao.entities.ProfileAssociation;
import static org.junit.Assert.assertEquals;
import org.restcomm.connect.dao.ProfilesDao;
import org.restcomm.connect.dao.entities.Profile;
public class ProfileAssociationsDaoTest extends DaoTest {
private static MybatisDaoManager manager;
private static final String jsonProfile = "{}";
public ProfileAssociationsDaoTest() {
super();
}
@Before
public void before() throws Exception {
sandboxRoot = createTempDir("organizationsTest");
String mybatisFilesPath = getClass().getResource("/organizationsDao").getFile();
setupSandbox(mybatisFilesPath, sandboxRoot);
String mybatisXmlPath = sandboxRoot.getPath() + "/mybatis_updated.xml";
final InputStream data = new FileInputStream(mybatisXmlPath);
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() throws Exception {
manager.shutdown();
removeTempDir(sandboxRoot.getAbsolutePath());
}
@Test
public void profileAssociationsCRUDTest() throws IllegalArgumentException, URISyntaxException {
ProfileAssociationsDao dao = manager.getProfileAssociationsDao();
//TODO: update profile sid type below after merge from master
Sid profileSid = Sid.generate(Sid.Type.ORGANIZATION);
Sid targetSid = Sid.generate(Sid.Type.ACCOUNT);
ProfileAssociation profileAssociation = new ProfileAssociation(profileSid, targetSid, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
//Add ProfileAssociation
dao.addProfileAssociation(profileAssociation);
//Read ProfileAssociation ByTargetSid
ProfileAssociation resultantProfileAssociation = dao.getProfileAssociationByTargetSid(targetSid.toString());
Assert.assertNotNull(resultantProfileAssociation);
Assert.assertEquals(profileAssociation.getProfileSid(), resultantProfileAssociation.getProfileSid());
//Read ProfileAssociation ByTargetSid
List<ProfileAssociation> resultantProfileAssociations = dao.getProfileAssociationsByProfileSid(profileSid.toString());
Assert.assertNotNull(resultantProfileAssociations);
Assert.assertEquals(1, resultantProfileAssociations.size());
Assert.assertEquals(profileAssociation.toString(), resultantProfileAssociations.get(0).toString());
// Add another ProfileAssociation with same profile
Sid targetSid2 = Sid.generate(Sid.Type.ACCOUNT);
ProfileAssociation profileAssociation2 = new ProfileAssociation(profileSid, targetSid2, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
dao.addProfileAssociation(profileAssociation2);
resultantProfileAssociations = dao.getProfileAssociationsByProfileSid(profileSid.toString());
Assert.assertNotNull(resultantProfileAssociations);
Assert.assertEquals(2, resultantProfileAssociations.size());
//Update Associated Profile Of All Such ProfileSid
//TODO: update profile sid type below after merge from master
Sid newProfileSid = Sid.generate(Sid.Type.ORGANIZATION);
dao.updateAssociatedProfileOfAllSuchProfileSid(profileSid.toString(), newProfileSid.toString());
Assert.assertEquals(0, dao.getProfileAssociationsByProfileSid(profileSid.toString()).size());
Assert.assertEquals(2, dao.getProfileAssociationsByProfileSid(newProfileSid.toString()).size());
//Update ProfileAssociation of target
//TODO: update profile sid type below after merge from master
Sid newProfileSid2 = Sid.generate(Sid.Type.ORGANIZATION);
profileAssociation = dao.getProfileAssociationsByProfileSid(newProfileSid.toString()).get(0);
ProfileAssociation updatedProfileAssociation = profileAssociation.setProfileSid(newProfileSid2);
dao.updateProfileAssociationOfTargetSid(updatedProfileAssociation);
ProfileAssociation resultantProfileAssociationdao = dao.getProfileAssociationByTargetSid(updatedProfileAssociation.getTargetSid().toString());
Assert.assertNotNull(resultantProfileAssociationdao);
Assert.assertEquals(updatedProfileAssociation.getProfileSid().toString(), resultantProfileAssociationdao.getProfileSid().toString());
//Delete ByTargetSid
int removed = dao.deleteProfileAssociationByTargetSid(resultantProfileAssociationdao.getTargetSid().toString(),
resultantProfileAssociationdao.getProfileSid().toString());
assertEquals(1, removed);
ProfileAssociation profileAssociationByTargetSid = dao.getProfileAssociationByTargetSid(resultantProfileAssociationdao.getTargetSid().toString());
Assert.assertNull(profileAssociationByTargetSid);
//Delete ByProfileSid
dao.deleteProfileAssociationByProfileSid(newProfileSid2.toString());
Assert.assertEquals(0, dao.getProfileAssociationsByProfileSid(newProfileSid2.toString()).size());
}
/**
* changep rofile for an account.
*
* Simlaute disorder of unlink7link in network
* @throws IllegalArgumentException
* @throws URISyntaxException
*/
@Test
public void changeProfile() throws IllegalArgumentException, URISyntaxException {
ProfileAssociationsDao dao = manager.getProfileAssociationsDao();
ProfilesDao profileDao = manager.getProfilesDao();
Sid targetSid = Sid.generate(Sid.Type.ACCOUNT);
Profile profile = new Profile(Sid.generate(Sid.Type.PROFILE).toString(), jsonProfile, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
Profile profile2 = new Profile(Sid.generate(Sid.Type.PROFILE).toString(), jsonProfile, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
profileDao.addProfile(profile);
profileDao.addProfile(profile2);
ProfileAssociation profileAssociation = new ProfileAssociation(new Sid(profile.getSid()), targetSid, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
dao.addProfileAssociation(profileAssociation);
//linking to new profile comes before unlinking to previous
ProfileAssociation profileAssociation2 = new ProfileAssociation(new Sid(profile2.getSid()), targetSid, Calendar.getInstance().getTime(), Calendar.getInstance().getTime());
dao.deleteProfileAssociationByTargetSid(targetSid.toString());
dao.addProfileAssociation(profileAssociation2);
//unlinking to previous comes after
int removed = dao.deleteProfileAssociationByTargetSid(targetSid.toString(), profile.getSid());
//the association was removed in last linking
assertEquals(0, removed);
}
}
| 7,397 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
IncomingPhoneNumbersDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/IncomingPhoneNumbersDaoTest.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.mybatis;
import java.io.InputStream;
import java.net.URI;
import java.util.List;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.After;
import static org.junit.Assert.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.restcomm.connect.dao.IncomingPhoneNumbersDao;
import org.restcomm.connect.dao.entities.IncomingPhoneNumber;
import org.restcomm.connect.dao.entities.IncomingPhoneNumberFilter;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.common.Sorting;
import org.restcomm.connect.dao.entities.SearchFilterMode;
/**
* @author [email protected] (Thomas Quintana)
*/
public class IncomingPhoneNumbersDaoTest {
private static MybatisDaoManager manager;
public IncomingPhoneNumbersDaoTest() {
super();
}
@Before
public void before() {
final InputStream data = getClass().getResourceAsStream("/mybatis.xml");
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() {
manager.shutdown();
}
@Test
public void createReadUpdateDelete() {
final Sid sid = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account = Sid.generate(Sid.Type.ACCOUNT);
Sid application = Sid.generate(Sid.Type.APPLICATION);
URI url = URI.create("http://127.0.0.1:8080/restcomm/demos/hello-world.xml");
String method = "GET";
final IncomingPhoneNumber.Builder builder = IncomingPhoneNumber.builder();
builder.setSid(sid);
builder.setFriendlyName("Incoming Phone Number Test");
builder.setAccountSid(account);
builder.setPhoneNumber("+12223334444");
builder.setApiVersion("2012-04-24");
builder.setHasVoiceCallerIdLookup(false);
builder.setVoiceUrl(url);
builder.setCost("0.50");
builder.setVoiceMethod(method);
builder.setVoiceFallbackUrl(url);
builder.setVoiceFallbackMethod(method);
builder.setStatusCallback(url);
builder.setStatusCallbackMethod(method);
builder.setVoiceApplicationSid(application);
builder.setSmsUrl(url);
builder.setSmsMethod(method);
builder.setSmsFallbackUrl(url);
builder.setSmsFallbackMethod(method);
builder.setSmsApplicationSid(application);
builder.setUri(url);
builder.setOrganizationSid(Sid.generate(Sid.Type.ORGANIZATION));
IncomingPhoneNumber number = builder.build();
final IncomingPhoneNumbersDao numbers = manager.getIncomingPhoneNumbersDao();
// Create a new incoming phone number in the data store.
numbers.addIncomingPhoneNumber(number);
// Read the incoming phone number from the data store.
IncomingPhoneNumber result = numbers.getIncomingPhoneNumber(sid);
// Validate the results.
assertTrue(result.getSid().equals(number.getSid()));
assertTrue(result.getFriendlyName().equals(number.getFriendlyName()));
assertTrue(result.getAccountSid().equals(number.getAccountSid()));
assertTrue(result.getPhoneNumber().equals(number.getPhoneNumber()));
assertTrue(result.getApiVersion().equals(number.getApiVersion()));
assertFalse(result.hasVoiceCallerIdLookup());
assertTrue(result.getVoiceUrl().equals(number.getVoiceUrl()));
assertTrue(result.getVoiceMethod().equals(number.getVoiceMethod()));
assertTrue(result.getVoiceFallbackUrl().equals(number.getVoiceFallbackUrl()));
assertTrue(result.getVoiceFallbackMethod().equals(number.getVoiceFallbackMethod()));
assertTrue(result.getStatusCallback().equals(number.getStatusCallback()));
assertTrue(result.getStatusCallbackMethod().equals(number.getStatusCallbackMethod()));
assertTrue(result.getVoiceApplicationSid().equals(number.getVoiceApplicationSid()));
assertTrue(result.getSmsUrl().equals(number.getSmsUrl()));
assertTrue(result.getSmsMethod().equals(number.getSmsMethod()));
assertTrue(result.getSmsFallbackUrl().equals(number.getSmsFallbackUrl()));
assertTrue(result.getSmsFallbackMethod().equals(number.getSmsFallbackMethod()));
assertTrue(result.getSmsApplicationSid().equals(number.getSmsApplicationSid()));
assertTrue(result.getUri().equals(number.getUri()));
// Update the incoming phone number.
application = Sid.generate(Sid.Type.APPLICATION);
url = URI.create("http://127.0.0.1:8080/restcomm/demos/world-hello.xml");
method = "POST";
number.setFriendlyName("Test Application");
number.setHasVoiceCallerIdLookup(true);
number.setVoiceUrl(url);
number.setVoiceMethod(method);
number.setVoiceFallbackUrl(url);
number.setVoiceFallbackMethod(method);
number.setStatusCallback(url);
number.setStatusCallbackMethod(method);
number.setVoiceApplicationSid(application);
number.setSmsUrl(url);
number.setCost("0.50");
number.setSmsMethod(method);
number.setSmsFallbackUrl(url);
number.setSmsFallbackMethod(method);
number.setSmsApplicationSid(application);
Sid newOrganizationSid = Sid.generate(Sid.Type.ORGANIZATION);
number.setOrganizationSid(newOrganizationSid);
numbers.updateIncomingPhoneNumber(number);
// Read the updated application from the data store.
result = numbers.getIncomingPhoneNumber(sid);
// Validate the results.
assertTrue(result.getSid().equals(number.getSid()));
assertTrue(result.getFriendlyName().equals(number.getFriendlyName()));
assertTrue(result.getAccountSid().equals(number.getAccountSid()));
assertTrue(result.getPhoneNumber().equals(number.getPhoneNumber()));
assertTrue(result.getApiVersion().equals(number.getApiVersion()));
assertTrue(result.hasVoiceCallerIdLookup());
assertTrue(result.getVoiceUrl().equals(number.getVoiceUrl()));
assertTrue(result.getVoiceMethod().equals(number.getVoiceMethod()));
assertTrue(result.getVoiceFallbackUrl().equals(number.getVoiceFallbackUrl()));
assertTrue(result.getVoiceFallbackMethod().equals(number.getVoiceFallbackMethod()));
assertTrue(result.getStatusCallback().equals(number.getStatusCallback()));
assertTrue(result.getStatusCallbackMethod().equals(number.getStatusCallbackMethod()));
assertTrue(result.getVoiceApplicationSid().equals(number.getVoiceApplicationSid()));
assertTrue(result.getSmsUrl().equals(number.getSmsUrl()));
assertTrue(result.getSmsMethod().equals(number.getSmsMethod()));
assertTrue(result.getSmsFallbackUrl().equals(number.getSmsFallbackUrl()));
assertTrue(result.getSmsFallbackMethod().equals(number.getSmsFallbackMethod()));
assertTrue(result.getSmsApplicationSid().equals(number.getSmsApplicationSid()));
assertTrue(result.getUri().equals(number.getUri()));
assertEquals(newOrganizationSid.toString(), result.getOrganizationSid().toString());
// Delete the incoming phone number.
numbers.removeIncomingPhoneNumber(sid);
// Validate that the incoming phone number was removed.
assertNull(numbers.getIncomingPhoneNumber(sid));
}
@Test
public void applicationFriendlyNameReturned() {
final IncomingPhoneNumbersDao dao = manager.getIncomingPhoneNumbersDao();
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
filterBuilder.byAccountSid("ACae6e420f425248d6a26948c17a9e2acf");
filterBuilder.sortedByPhoneNumber(Sorting.Direction.ASC);
filterBuilder.limited(50, 0);
List<IncomingPhoneNumber> phoneNumbers = dao.getIncomingPhoneNumbersByFilter(filterBuilder.build());
Assert.assertEquals("Only a single phone number expected",1, phoneNumbers.size());
IncomingPhoneNumber number = phoneNumbers.get(0);
Assert.assertEquals("app0", number.getVoiceApplicationName());
Assert.assertEquals("app1", number.getSmsApplicationName());
Assert.assertEquals("app2", number.getUssdApplicationName());
}
@Test
public void getByPhoneNumber() {
final Sid sid = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account = Sid.generate(Sid.Type.ACCOUNT);
Sid application = Sid.generate(Sid.Type.APPLICATION);
URI url = URI.create("http://127.0.0.1:8080/restcomm/demos/hello-world.xml");
String method = "GET";
final IncomingPhoneNumber.Builder builder = IncomingPhoneNumber.builder();
builder.setSid(sid);
builder.setFriendlyName("Incoming Phone Number Test");
builder.setAccountSid(account);
builder.setPhoneNumber("+12223334444");
builder.setApiVersion("2012-04-24");
builder.setHasVoiceCallerIdLookup(false);
builder.setVoiceUrl(url);
builder.setVoiceMethod(method);
builder.setVoiceFallbackUrl(url);
builder.setVoiceFallbackMethod(method);
builder.setStatusCallback(url);
builder.setStatusCallbackMethod(method);
builder.setVoiceApplicationSid(application);
builder.setSmsUrl(url);
builder.setSmsMethod(method);
builder.setSmsFallbackUrl(url);
builder.setSmsFallbackMethod(method);
builder.setSmsApplicationSid(application);
builder.setUri(url);
builder.setOrganizationSid(Sid.generate(Sid.Type.ORGANIZATION));
IncomingPhoneNumber number = builder.build();
final IncomingPhoneNumbersDao numbers = manager.getIncomingPhoneNumbersDao();
// Create a new incoming phone number in the data store.
numbers.addIncomingPhoneNumber(number);
// Read the incoming phone number from the data store.
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
filterBuilder.byPhoneNumber("+12223334444");
filterBuilder.byAccountSid(account.toString());
filterBuilder.sortedByfriendly(Sorting.Direction.ASC);
List<IncomingPhoneNumber> incomingPhoneNumbers = numbers.getIncomingPhoneNumbersByFilter(filterBuilder.build());
assertNotNull (incomingPhoneNumbers);
assertEquals (1, incomingPhoneNumbers.size());
IncomingPhoneNumber result = incomingPhoneNumbers.get(0);
assertEquals(number.getSid(), result.getSid());
//use wildcard mode now
filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
filterBuilder.byPhoneNumber("2223334444");
filterBuilder.byAccountSid(account.toString());
filterBuilder.usingMode(SearchFilterMode.WILDCARD_MATCH);
filterBuilder.sortedByPhoneNumber(Sorting.Direction.DESC);
incomingPhoneNumbers = numbers.getIncomingPhoneNumbersByFilter(filterBuilder.build());
assertNotNull (incomingPhoneNumbers);
assertEquals (1, incomingPhoneNumbers.size());
// Delete the incoming phone number.
numbers.removeIncomingPhoneNumber(sid);
// Validate that the incoming phone number was removed.
assertNull(numbers.getIncomingPhoneNumber(sid) );
}
@Test
public void getByPhoneNumberUAndOrg() {
final Sid sid = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account = Sid.generate(Sid.Type.ACCOUNT);
Sid org1 = Sid.generate(Sid.Type.ORGANIZATION);
final Sid sid2 = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account2 = Sid.generate(Sid.Type.ACCOUNT);
Sid org2 = Sid.generate(Sid.Type.ORGANIZATION);
Sid application = Sid.generate(Sid.Type.APPLICATION);
URI url = URI.create("http://127.0.0.1:8080/restcomm/demos/hello-world.xml");
String method = "GET";
final IncomingPhoneNumber.Builder builder = IncomingPhoneNumber.builder();
builder.setSid(sid);
builder.setFriendlyName("Incoming Phone Number Test");
builder.setAccountSid(account);
builder.setPhoneNumber("+12223334444");
builder.setApiVersion("2012-04-24");
builder.setHasVoiceCallerIdLookup(false);
builder.setVoiceUrl(url);
builder.setVoiceMethod(method);
builder.setVoiceFallbackUrl(url);
builder.setVoiceFallbackMethod(method);
builder.setStatusCallback(url);
builder.setStatusCallbackMethod(method);
builder.setVoiceApplicationSid(application);
builder.setSmsUrl(url);
builder.setSmsMethod(method);
builder.setSmsFallbackUrl(url);
builder.setSmsFallbackMethod(method);
builder.setSmsApplicationSid(application);
builder.setUri(url);
builder.setOrganizationSid(org1);
builder.setPureSip(Boolean.FALSE);
IncomingPhoneNumber number = builder.build();
final IncomingPhoneNumber.Builder builder2 = IncomingPhoneNumber.builder();
builder2.setSid(sid2);
builder2.setFriendlyName("Incoming Phone Number Test");
builder2.setAccountSid(account2);
builder2.setPhoneNumber("+12223334444");
builder2.setApiVersion("2012-04-24");
builder2.setHasVoiceCallerIdLookup(false);
builder2.setVoiceUrl(url);
builder2.setVoiceMethod(method);
builder2.setVoiceFallbackUrl(url);
builder2.setVoiceFallbackMethod(method);
builder2.setStatusCallback(url);
builder2.setStatusCallbackMethod(method);
builder2.setVoiceApplicationSid(application);
builder2.setSmsUrl(url);
builder2.setSmsMethod(method);
builder2.setSmsFallbackUrl(url);
builder2.setSmsFallbackMethod(method);
builder2.setSmsApplicationSid(application);
builder2.setUri(url);
builder2.setOrganizationSid(org2);
builder2.setPureSip(Boolean.FALSE);
IncomingPhoneNumber number2 = builder2.build();
final IncomingPhoneNumbersDao numbers = manager.getIncomingPhoneNumbersDao();
// Create a new incoming phone number in the data store.
numbers.addIncomingPhoneNumber(number2);
numbers.addIncomingPhoneNumber(number);
// Read the incoming phone number from the data store.
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
filterBuilder.byPhoneNumber("+12223334444");
filterBuilder.byOrgSid(org2.toString());
filterBuilder.byPureSIP(Boolean.FALSE);
IncomingPhoneNumberFilter numFilter = filterBuilder.build();
List<IncomingPhoneNumber> incomingPhoneNumbers = numbers.getIncomingPhoneNumbersByFilter(numFilter);
assertNotNull(incomingPhoneNumbers);
assertEquals(1, incomingPhoneNumbers.size());
assertEquals(Integer.valueOf(1), numbers.getTotalIncomingPhoneNumbers(numFilter));
}
@Test
public void getRegexes() {
final Sid sid = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account = Sid.generate(Sid.Type.ACCOUNT);
Sid org1 = Sid.generate(Sid.Type.ORGANIZATION);
final Sid sid2 = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account2 = Sid.generate(Sid.Type.ACCOUNT);
Sid org2 = Sid.generate(Sid.Type.ORGANIZATION);
Sid application = Sid.generate(Sid.Type.APPLICATION);
URI url = URI.create("http://127.0.0.1:8080/restcomm/demos/hello-world.xml");
String method = "GET";
final IncomingPhoneNumber.Builder builder = IncomingPhoneNumber.builder();
builder.setSid(sid);
builder.setFriendlyName("Incoming Phone Number Test");
builder.setAccountSid(account);
builder.setPhoneNumber("+12.*");
builder.setApiVersion("2012-04-24");
builder.setHasVoiceCallerIdLookup(false);
builder.setVoiceUrl(url);
builder.setVoiceMethod(method);
builder.setVoiceFallbackUrl(url);
builder.setVoiceFallbackMethod(method);
builder.setStatusCallback(url);
builder.setStatusCallbackMethod(method);
builder.setVoiceApplicationSid(application);
builder.setSmsUrl(url);
builder.setSmsMethod(method);
builder.setSmsFallbackUrl(url);
builder.setSmsFallbackMethod(method);
builder.setSmsApplicationSid(application);
builder.setUri(url);
builder.setOrganizationSid(org1);
builder.setPureSip(Boolean.TRUE);
IncomingPhoneNumber number = builder.build();
final IncomingPhoneNumber.Builder builder2 = IncomingPhoneNumber.builder();
builder2.setSid(sid2);
builder2.setFriendlyName("Incoming Phone Number Test");
builder2.setAccountSid(account2);
builder2.setPhoneNumber("+12223334444");
builder2.setApiVersion("2012-04-24");
builder2.setHasVoiceCallerIdLookup(false);
builder2.setVoiceUrl(url);
builder2.setVoiceMethod(method);
builder2.setVoiceFallbackUrl(url);
builder2.setVoiceFallbackMethod(method);
builder2.setStatusCallback(url);
builder2.setStatusCallbackMethod(method);
builder2.setVoiceApplicationSid(application);
builder2.setSmsUrl(url);
builder2.setSmsMethod(method);
builder2.setSmsFallbackUrl(url);
builder2.setSmsFallbackMethod(method);
builder2.setSmsApplicationSid(application);
builder2.setUri(url);
builder2.setOrganizationSid(org2);
builder2.setPureSip(Boolean.FALSE);
IncomingPhoneNumber number2 = builder2.build();
final IncomingPhoneNumbersDao numbers = manager.getIncomingPhoneNumbersDao();
// Create a new incoming phone number in the data store.
numbers.addIncomingPhoneNumber(number2);
numbers.addIncomingPhoneNumber(number);
// Read the incoming phone number from the data store.
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
filterBuilder.byOrgSid(org1.toString());
filterBuilder.byPureSIP(Boolean.TRUE);
filterBuilder.sortedByfriendly(Sorting.Direction.DESC);
IncomingPhoneNumberFilter numFilter = filterBuilder.build();
List<IncomingPhoneNumber> incomingPhoneNumbers = numbers.getIncomingPhoneNumbersRegex(numFilter);
assertNotNull(incomingPhoneNumbers);
assertEquals(1, incomingPhoneNumbers.size());
}
@Test
public void removeByAccountSid() {
final Sid sid = Sid.generate(Sid.Type.PHONE_NUMBER);
Sid account = Sid.generate(Sid.Type.ACCOUNT);
Sid application = Sid.generate(Sid.Type.APPLICATION);
URI url = URI.create("http://127.0.0.1:8080/restcomm/demos/hello-world.xml");
String method = "GET";
final IncomingPhoneNumber.Builder builder = IncomingPhoneNumber.builder();
builder.setSid(sid);
builder.setFriendlyName("Incoming Phone Number Test");
builder.setAccountSid(account);
builder.setPhoneNumber("+12223334444");
builder.setApiVersion("2012-04-24");
builder.setHasVoiceCallerIdLookup(false);
builder.setVoiceUrl(url);
builder.setVoiceMethod(method);
builder.setVoiceFallbackUrl(url);
builder.setVoiceFallbackMethod(method);
builder.setStatusCallback(url);
builder.setStatusCallbackMethod(method);
builder.setVoiceApplicationSid(application);
builder.setSmsUrl(url);
builder.setSmsMethod(method);
builder.setSmsFallbackUrl(url);
builder.setSmsFallbackMethod(method);
builder.setSmsApplicationSid(application);
builder.setUri(url);
builder.setOrganizationSid(Sid.generate(Sid.Type.ORGANIZATION));
IncomingPhoneNumber number = builder.build();
final IncomingPhoneNumbersDao numbers = manager.getIncomingPhoneNumbersDao();
// Create a new incoming phone number in the data store.
numbers.addIncomingPhoneNumber(number);
assertEquals(1, numbers.getIncomingPhoneNumbers(account).size());
// Delete the incoming phone number.
numbers.removeIncomingPhoneNumbers(account);
assertTrue(numbers.getIncomingPhoneNumbers(account).isEmpty());
}
} | 21,243 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AccountsDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/AccountsDaoTest.java | package org.restcomm.connect.dao.mybatis;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import junit.framework.Assert;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.restcomm.connect.dao.exceptions.AccountHierarchyDepthCrossed;
import org.restcomm.connect.dao.AccountsDao;
import org.restcomm.connect.dao.entities.Account;
import org.restcomm.connect.commons.dao.Sid;
public class AccountsDaoTest extends DaoTest {
private static MybatisDaoManager manager;
public AccountsDaoTest() {
super();
}
@Before
public void before() throws Exception {
sandboxRoot = createTempDir("accountsTest");
String mybatisFilesPath = getClass().getResource("/accountsDao").getFile();
setupSandbox(mybatisFilesPath, sandboxRoot);
String mybatisXmlPath = sandboxRoot.getPath() + "/mybatis_updated.xml";
final InputStream data = new FileInputStream(mybatisXmlPath);
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() throws Exception {
manager.shutdown();
removeTempDir(sandboxRoot.getAbsolutePath());
}
@Test
public void addAccountTest() throws IllegalArgumentException, URISyntaxException {
AccountsDao dao = manager.getAccountsDao();
Sid sid = Sid.generate(Sid.Type.ACCOUNT);
dao.addAccount(new Account(sid, new DateTime(), new DateTime(), "[email protected]", "Top Level Account", new Sid("AC00000000000000000000000000000000"),Account.Type.FULL,Account.Status.ACTIVE,"77f8c12cc7b8f8423e5c38b035249166","Administrator",new URI("/2012-04-24/Accounts/AC00000000000000000000000000000000"), new Sid("ORafbe225ad37541eba518a74248f0ac4c")));
Account account = dao.getAccount(sid);
Assert.assertNotNull("Account not found",account);
Assert.assertNotNull(account.getOrganizationSid());
}
@Test
public void readAccount() {
AccountsDao dao = manager.getAccountsDao();
Account account = dao.getAccount(new Sid("AC00000000000000000000000000000000"));
Assert.assertNotNull("Account not found",account);
}
@Test
public void nestedSubAccountRetrieval() {
// retrieve all sub-accounts of AC00000000000000000000000000000000
AccountsDao dao = manager.getAccountsDao();
Sid parentSid = new Sid("AC00000000000000000000000000000000");
List<String> sidList = dao.getSubAccountSidsRecursive(parentSid);
Assert.assertEquals("Invalid number of subaccounts returned",5, sidList.size());
// a parent with no sub-accounts should get zero
parentSid = new Sid("AC99999999999999999999999999999999");
sidList = dao.getSubAccountSidsRecursive(parentSid);
Assert.assertEquals("No sub-account sids should be returned", 0, sidList.size());
// check 2nd-level parents too
parentSid = new Sid("AC10000000000000000000000000000000");
sidList = dao.getSubAccountSidsRecursive(parentSid);
Assert.assertEquals("Invalid number of sub-account for 2nd level perent", 3, sidList.size());
// check third-level perent too
parentSid = new Sid("AC11000000000000000000000000000000");
sidList = dao.getSubAccountSidsRecursive(parentSid);
Assert.assertEquals("Invalid number of sub-account for 3rd level perent", 1, sidList.size());
// test behaviour for non-existing parents. An empty list should be returned
parentSid = new Sid("AC59494830204948392023934839392092"); // this does not exist
sidList = dao.getSubAccountSidsRecursive(parentSid);
Assert.assertEquals("Invalid number of sub-account for 3rd level perent", 0, sidList.size());
}
@Test
public void accountAncestorsRetrieval() throws AccountHierarchyDepthCrossed {
AccountsDao dao = manager.getAccountsDao();
List<String> ancestorSids = dao.getAccountLineage(new Sid("AC11000000000000000000000000000000"));
Assert.assertEquals(2, ancestorSids.size());
// check last account returned is the top-level
Assert.assertEquals("AC00000000000000000000000000000000", ancestorSids.get(ancestorSids.size()-1));
// also check the overloaded version
Account account = dao.getAccount("AC11000000000000000000000000000000");
ancestorSids = dao.getAccountLineage(account);
Assert.assertEquals(2, ancestorSids.size());
Assert.assertEquals("AC00000000000000000000000000000000", ancestorSids.get(ancestorSids.size()-1));
// for top level accounts an empty list should be returned
ancestorSids = dao.getAccountLineage(new Sid("AC00000000000000000000000000000000"));
Assert.assertEquals(0, ancestorSids.size());
Account topLevelAccount = dao.getAccount("AC00000000000000000000000000000000");
ancestorSids = dao.getAccountLineage(topLevelAccount);
Assert.assertEquals(0, ancestorSids.size());
Assert.assertNull(dao.getAccountLineage((Sid)null));
}
@Test(expected=AccountHierarchyDepthCrossed.class)
public void checkAccountRecursionLimit() throws AccountHierarchyDepthCrossed {
AccountsDao dao = manager.getAccountsDao();
// try to retrieve the lineage for an account that is in the forth level
List<String> ancestorSids = dao.getAccountLineage(new Sid("AC11100000000000000000000000000000"));
}
}
| 5,805 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RecordingsDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/RecordingsDaoTest.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.mybatis;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.restcomm.connect.dao.RecordingsDao;
import org.restcomm.connect.dao.common.Sorting;
import org.restcomm.connect.dao.entities.Recording;
import org.restcomm.connect.dao.entities.RecordingFilter;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
/**
* @author [email protected] (Thomas Quintana)
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public final class RecordingsDaoTest {
private static Logger logger = Logger.getLogger(RecordingsDaoTest.class);
private static MybatisDaoManager manager;
public RecordingsDaoTest() {
super();
}
@Before
public void before() {
final InputStream data = getClass().getResourceAsStream("/mybatis.xml");
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() {
manager.shutdown();
}
// TODO: need to add unit tests to exercise creation, query, update, removal
@Test
public void filterWithDateSorting() throws ParseException {
RecordingsDao dao = manager.getRecordingsDao();
RecordingFilter.Builder builder = new RecordingFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("ACe4462e9eb95b4cf8ae17001ab2f520af");
builder.byAccountSidSet(accountSidSet);
builder.sortedByDate(Sorting.Direction.ASC);
RecordingFilter filter = builder.build();
List<Recording> recordings = dao.getRecordings(filter);
assertEquals(9, recordings.size());
final DateTime min = DateTime.parse("2017-04-05T12:57:35.535");
final DateTime max = DateTime.parse("2017-04-13T12:57:48.535");
assertEquals(0, min.compareTo(recordings.get(0).getDateCreated()));
assertEquals(0, max.compareTo(recordings.get(recordings.size() - 1).getDateCreated()));
builder.sortedByDate(Sorting.Direction.DESC);
filter = builder.build();
recordings = dao.getRecordings(filter);
assertEquals(0, max.compareTo(recordings.get(0).getDateCreated()));
assertEquals(0, min.compareTo(recordings.get(recordings.size() - 1).getDateCreated()));
}
@Test
public void filterWithDurationSorting() throws ParseException {
RecordingsDao dao = manager.getRecordingsDao();
RecordingFilter.Builder builder = new RecordingFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("ACe4462e9eb95b4cf8ae17001ab2f520af");
builder.byAccountSidSet(accountSidSet);
builder.sortedByDuration(Sorting.Direction.ASC);
RecordingFilter filter = builder.build();
List<Recording> recordings = dao.getRecordings(filter);
assertEquals(9, recordings.size());
assertEquals("3.0", recordings.get(0).getDuration().toString());
assertEquals("52.0", recordings.get(recordings.size() - 1).getDuration().toString());
builder.sortedByDuration(Sorting.Direction.DESC);
filter = builder.build();
recordings = dao.getRecordings(filter);
assertEquals("52.0", recordings.get(0).getDuration().toString());
assertEquals("3.0", recordings.get(recordings.size() - 1).getDuration().toString());
}
@Test
public void filterWithCallSidSorting() throws ParseException {
RecordingsDao dao = manager.getRecordingsDao();
RecordingFilter.Builder builder = new RecordingFilter.Builder();
List<String> accountSidSet = new ArrayList<String>();
accountSidSet.add("ACe4462e9eb95b4cf8ae17001ab2f520af");
builder.byAccountSidSet(accountSidSet);
builder.sortedByCallSid(Sorting.Direction.ASC);
RecordingFilter filter = builder.build();
List<Recording> recordings = dao.getRecordings(filter);
assertEquals(9, recordings.size());
assertEquals("CA2d0f6354e75e46b3ac76f534129ff511", recordings.get(0).getCallSid().toString());
assertEquals("CA2d9f6354e75e46b3ac76f534129ff511", recordings.get(recordings.size() - 1).getCallSid().toString());
builder.sortedByCallSid(Sorting.Direction.DESC);
filter = builder.build();
recordings = dao.getRecordings(filter);
assertEquals("CA2d9f6354e75e46b3ac76f534129ff511", recordings.get(0).getCallSid().toString());
assertEquals("CA2d0f6354e75e46b3ac76f534129ff511", recordings.get(recordings.size() - 1).getCallSid().toString());
}
}
| 5,863 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RegistrationsDaoTest.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/test/java/org/restcomm/connect/dao/mybatis/RegistrationsDaoTest.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.mybatis;
import static org.junit.Assert.*;
import java.io.InputStream;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.restcomm.connect.dao.RegistrationsDao;
import org.restcomm.connect.dao.entities.Registration;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public final class RegistrationsDaoTest {
private static MybatisDaoManager manager;
public RegistrationsDaoTest() {
super();
}
@Before
public void before() {
final InputStream data = getClass().getResourceAsStream("/mybatis.xml");
final SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
final SqlSessionFactory factory = builder.build(data);
manager = new MybatisDaoManager();
manager.start(factory);
}
@After
public void after() {
manager.shutdown();
}
@Test
public void createReadUpdateDelete() {
final Sid sid = Sid.generate(Sid.Type.REGISTRATION);
final Sid orgSid = Sid.generate(Sid.Type.ORGANIZATION);
final DateTime now = DateTime.now();
String username = "tom_" + now;
String displayName = "Tom_" + now;
Registration registration = new Registration(sid, "instanceId", now, now, now, "sip:[email protected]", displayName, username,
"TestUserAgent/1.0", 3600, "sip:[email protected]", true, false, orgSid);
final RegistrationsDao registrations = manager.getRegistrationsDao();
// Create a new registration in the data store.
assertFalse(registrations.hasRegistration(registration));
registrations.addRegistration(registration);
assertTrue(registrations.hasRegistration(registration));
// Read the registration from the data store.
Registration result = registrations.getRegistration(username, orgSid);
// Validate the results.
assertTrue(registrations.getRegistrations().size() >= 1);
assertTrue(result.getSid().equals(registration.getSid()));
assertTrue(result.getDateCreated().equals(registration.getDateCreated()));
assertTrue(result.getDateUpdated().equals(registration.getDateUpdated()));
assertTrue(result.getDateExpires().equals(registration.getDateExpires()));
assertTrue(result.getAddressOfRecord().equals(registration.getAddressOfRecord()));
assertTrue(result.getDisplayName().equals(registration.getDisplayName()));
assertTrue(result.getUserName().equals(registration.getUserName()));
assertTrue(result.getLocation().equals(registration.getLocation()));
assertTrue(result.getUserAgent().equals(registration.getUserAgent()));
assertTrue(result.getTimeToLive() == registration.getTimeToLive());
assertTrue(result.isWebRTC());
// Update the registration.
registration = registration.setTimeToLive(3600);
registrations.updateRegistration(registration);
// Read the updated registration from the data store.
result = registrations.getRegistration(username, orgSid);
// Validate the results.
assertTrue(result.getSid().equals(registration.getSid()));
assertTrue(result.getDateCreated().equals(registration.getDateCreated()));
assertTrue(result.getDateUpdated() != null);
assertTrue(result.getDateExpires().equals(registration.getDateExpires()));
assertTrue(result.getAddressOfRecord().equals(registration.getAddressOfRecord()));
assertTrue(result.getDisplayName().equals(registration.getDisplayName()));
assertTrue(result.getUserName().equals(registration.getUserName()));
assertTrue(result.getLocation().equals(registration.getLocation()));
assertTrue(result.getUserAgent().equals(registration.getUserAgent()));
assertTrue(result.getTimeToLive() == registration.getTimeToLive());
assertTrue(result.isWebRTC());
// Delete the registration.
registrations.removeRegistration(registration);
// Validate that the registration was removed.
assertTrue(registrations.getRegistrations().isEmpty());
}
@Test
public void checkHasRegistrationWithoutUA() {
final Sid sid = Sid.generate(Sid.Type.REGISTRATION);
final Sid orgSid = Sid.generate(Sid.Type.ORGANIZATION);
final DateTime now = DateTime.now();
String username = "tom_" + now;
String displayName = "Tom_" + now;
Registration registration = new Registration(sid, "instanceId", now, now, now, "sip:[email protected]", displayName, username, null,
3600, "sip:[email protected]", true, false, orgSid);
final RegistrationsDao registrations = manager.getRegistrationsDao();
// Create a new registration in the data store.
assertFalse(registrations.hasRegistration(registration));
registrations.addRegistration(registration);
assertTrue(registrations.getRegistrations().size() > 0);
assertNotNull(registrations.getRegistration(username, orgSid));
// Expected to fail if UA is null
assertFalse(registrations.hasRegistration(registration));
}
@Test
public void checkHasRegistrationWithoutDisplayName() {
final Sid sid = Sid.generate(Sid.Type.REGISTRATION);
final Sid orgSid = Sid.generate(Sid.Type.ORGANIZATION);
final DateTime now = DateTime.now();
String username = "tom_" + now;
String displayName = null;
Registration registration = new Registration(sid, "instanceId", now, now, now, "sip:[email protected]", displayName, username,
"TestUserAgent/1.0", 3600, "sip:[email protected]", false, false, orgSid);
final RegistrationsDao registrations = manager.getRegistrationsDao();
// Create a new registration in the data store.
assertFalse(registrations.hasRegistration(registration));
registrations.addRegistration(registration);
assertTrue(registrations.getRegistrations().size() > 0);
assertNotNull(registrations.getRegistration(username, orgSid));
// Expected to fail if Display Name is null
assertFalse(registrations.hasRegistration(registration));
}
}
| 7,242 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OrganizationsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/OrganizationsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Organization;
/**
* @author Maria Farooq
*/
public interface OrganizationsDao {
/**
* add new Organization
*
* @param organization
*/
void addOrganization(final Organization organization);
/**
* getOrganization by sid
* @param sid
* @return Organization entity
*/
Organization getOrganization(final Sid sid);
/**
* getOrganizationByDomainName
* @param domainName
* @return Organization entity
*/
Organization getOrganizationByDomainName(final String domainName);
/**
* getOrganizationByStatus
* @param status
* @return
*/
List<Organization> getOrganizationsByStatus(final Organization.Status status);
/**
* @return
*/
List<Organization> getAllOrganizations();
/**
* updateOrganization
* @param organization
*/
void updateOrganization(final Organization organization);
}
| 1,886 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
NotificationsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/NotificationsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.joda.time.DateTime;
import org.restcomm.connect.dao.entities.Notification;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.NotificationFilter;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface NotificationsDao {
void addNotification(Notification notification);
Notification getNotification(Sid sid);
List<Notification> getNotifications(Sid accountSid);
List<Notification> getNotificationsByCall(Sid callSid);
List<Notification> getNotificationsByLogLevel(int logLevel);
List<Notification> getNotificationsByMessageDate(DateTime messageDate);
void removeNotification(Sid sid);
void removeNotifications(Sid accountSid);
void removeNotificationsByCall(Sid callSid);
// Support for filtering of notification list result, Issue 1395
Integer getTotalNotification(NotificationFilter filter);
List<Notification> getNotifications(NotificationFilter filter);
}
| 1,859 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
IncomingPhoneNumbersDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/IncomingPhoneNumbersDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.IncomingPhoneNumber;
import org.restcomm.connect.dao.entities.IncomingPhoneNumberFilter;
/**
* @author [email protected] (Thomas Quintana)
* @author [email protected]
* @author [email protected] (Maria Farooq)
*/
public interface IncomingPhoneNumbersDao {
void addIncomingPhoneNumber(IncomingPhoneNumber incomingPhoneNumber);
IncomingPhoneNumber getIncomingPhoneNumber(Sid sid);
List<IncomingPhoneNumber> getIncomingPhoneNumbers(Sid accountSid);
List<IncomingPhoneNumber> getIncomingPhoneNumbersByFilter(IncomingPhoneNumberFilter incomingPhoneNumberFilter);
void removeIncomingPhoneNumber(Sid sid);
void removeIncomingPhoneNumbers(Sid accountSid);
void updateIncomingPhoneNumber(IncomingPhoneNumber incomingPhoneNumber);
List<IncomingPhoneNumber> getIncomingPhoneNumbersRegex(IncomingPhoneNumberFilter incomingPhoneNumberFilter);
Integer getTotalIncomingPhoneNumbers(IncomingPhoneNumberFilter filter);
}
| 1,934 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RegistrationsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/RegistrationsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Registration;
/**
* @author [email protected] (Thomas Quintana)
* @author [email protected] (Maria Farooq)
*/
public interface RegistrationsDao {
void addRegistration(Registration registration);
Registration getRegistration(String user, Sid organizationSid);
List<Registration> getRegistrationsByLocation(String user, String location);
Registration getRegistrationByInstanceId(String User, String instanceId);
List<Registration> getRegistrationsByInstanceId(String instanceId);
List<Registration> getRegistrations(String user, Sid organizationSid);
List<Registration> getRegistrations();
boolean hasRegistration(Registration registration);
void removeRegistration(Registration registration);
void updateRegistration(Registration registration);
}
| 1,771 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
DaoUtils.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/DaoUtils.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
import java.util.Currency;
import java.util.Date;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.ThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Account;
import org.restcomm.connect.dao.entities.Application;
import org.restcomm.connect.dao.entities.Geolocation;
import org.restcomm.connect.dao.entities.Organization;
/**
* @author [email protected] (Thomas Quintana)
*/
@ThreadSafe
public final class DaoUtils {
private DaoUtils() {
super();
}
public static Account.Status readAccountStatus(final Object object) {
if (object != null) {
return Account.Status.getValueOf((String) object);
} else {
return null;
}
}
public static Organization.Status readOrganizationStatus(final Object object) {
if (object != null) {
return Organization.Status.getValueOf((String) object);
} else {
return null;
}
}
public static Account.Type readAccountType(final Object object) {
if (object != null) {
return Account.Type.getValueOf((String) object);
} else {
return null;
}
}
public static BigDecimal readBigDecimal(final Object object) {
if (object != null) {
return new BigDecimal((String) object);
} else {
return null;
}
}
public static Boolean readBoolean(final Object object) {
if (object != null) {
return (Boolean) object;
} else {
return null;
}
}
public static DateTime readDateTime(final Object object) {
if (object != null) {
return new DateTime((Date) object);
} else {
return null;
}
}
public static Double readDouble(final Object object) {
if (object != null) {
return (Double) object;
} else {
return null;
}
}
public static Integer readInteger(final Object object) {
if (object != null) {
return (Integer) object;
} else {
return null;
}
}
public static BigInteger readBigInteger(final Object object) {
if (object != null) {
return (BigInteger) object;
} else {
return null;
}
}
public static Long readLong(final Object object) {
if (object != null) {
return (Long) object;
} else {
return null;
}
}
public static Sid readSid(final Object object) {
if (object != null) {
return new Sid((String) object);
} else {
return null;
}
}
public static String readString(final Object object) {
if (object != null) {
return (String) object;
} else {
return null;
}
}
public static URI readUri(final Object object) {
if (object != null) {
return URI.create((String) object);
} else {
return null;
}
}
public static Currency readCurrency(final Object object) {
if (object != null) {
return Currency.getInstance((String) object);
} else {
return null;
}
}
public static Application.Kind readApplicationKind(final Object object) {
if (object != null) {
return Application.Kind.getValueOf((String) object);
} else {
return null;
}
}
public static Geolocation.GeolocationType readGeolocationType(final Object object) {
if (object != null) {
return Geolocation.GeolocationType.getValueOf((String) object);
} else {
return null;
}
}
public static String writeAccountStatus(final Account.Status status) {
return status.toString();
}
public static String writeOrganizationStatus(final Organization.Status status) {
return status.toString();
}
public static String writeAccountType(final Account.Type type) {
return type.toString();
}
public static String writeBigDecimal(final BigDecimal bigDecimal) {
if (bigDecimal != null) {
return bigDecimal.toString();
} else {
return null;
}
}
public static Date writeDateTime(final DateTime dateTime) {
if (dateTime != null) {
return dateTime.toDate();
} else {
return null;
}
}
public static String writeSid(final Sid sid) {
if (sid != null) {
return sid.toString();
} else {
return null;
}
}
public static String writeUri(final URI uri) {
if (uri != null) {
return uri.toString();
} else {
return null;
}
}
public static String writeCurrency(final Currency currency) {
if (currency != null) {
return currency.getCurrencyCode();
} else {
return null;
}
}
public static String writeApplicationKind(Application.Kind kind) {
if (kind != null) {
return kind.toString();
} else {
return null;
}
}
}
| 6,270 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ProfilesDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ProfilesDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.sql.SQLException;
import java.util.List;
import org.restcomm.connect.dao.entities.Profile;
/**
* @author [email protected] (Maria Farooq)
*/
public interface ProfilesDao {
/**
* @param sid
* @return a single profile as per provided profile sid
* @throws SQLException
*/
Profile getProfile(String sid) throws SQLException;
/**
* @return List of all profiles in the system
* @throws SQLException
*/
List<Profile> getAllProfiles() throws SQLException;
/**
* @param profile
* @return
*/
int addProfile(Profile profile);
/**
* @param profile
*/
void updateProfile(Profile profile);
/**
* @param profile
*/
void deleteProfile(String sid);
}
| 1,620 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ShortCodesDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ShortCodesDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.ShortCode;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface ShortCodesDao {
void addShortCode(ShortCode shortCode);
ShortCode getShortCode(Sid sid);
List<ShortCode> getShortCodes(Sid accountSid);
void removeShortCode(Sid sid);
void removeShortCodes(Sid accountSid);
void updateShortCode(ShortCode shortCode);
}
| 1,328 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ApplicationsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ApplicationsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Application;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface ApplicationsDao {
void addApplication(Application application);
Application getApplication(Sid sid);
Application getApplication(String friendlyName);
List<Application> getApplications(Sid accountSid);
// this may optionally return related numbers as part of an Application
List<Application> getApplicationsWithNumbers(Sid accountSid);
void removeApplication(Sid sid);
void removeApplications(Sid accountSid);
void updateApplication(Application application);
}
| 1,553 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ClientsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ClientsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.Client;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface ClientsDao {
void addClient(Client client);
Client getClient(Sid sid);
Client getClient(String user, Sid organizationSid);
List<Client> getClients(Sid accountSid);
List<Client> getAllClients();
List<Client> getClientsByOrg(Sid organizationSid);
void removeClient(Sid sid);
void removeClients(Sid accountSid);
void updateClient(Client client);
}
| 1,434 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
HttpCookiesDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/HttpCookiesDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.apache.http.cookie.Cookie;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface HttpCookiesDao {
void addCookie(Sid sid, Cookie cookie);
List<Cookie> getCookies(Sid sid);
boolean hasCookie(Sid sid, Cookie cookie);
boolean hasExpiredCookies(Sid sid);
void removeCookies(Sid sid);
void removeExpiredCookies(Sid sid);
void updateCookie(Sid sid, Cookie cookie);
}
| 1,349 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CallDetailRecordsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/CallDetailRecordsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.text.ParseException;
import java.util.List;
import org.joda.time.DateTime;
import org.restcomm.connect.dao.entities.CallDetailRecordFilter;
import org.restcomm.connect.dao.entities.CallDetailRecord;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface CallDetailRecordsDao {
void addCallDetailRecord(CallDetailRecord cdr);
CallDetailRecord getCallDetailRecord(Sid sid);
List<CallDetailRecord> getCallDetailRecordsByAccountSid(Sid accountSid);
List<CallDetailRecord> getCallDetailRecordsByRecipient(String recipient);
List<CallDetailRecord> getCallDetailRecordsBySender(String sender);
List<CallDetailRecord> getCallDetailRecordsByStatus(String status);
List<CallDetailRecord> getCallDetailRecordsByStartTime(DateTime startTime);
List<CallDetailRecord> getCallDetailRecordsByEndTime(DateTime endTime);
List<CallDetailRecord> getCallDetailRecordsByStarTimeAndEndTime(DateTime endTime);
List<CallDetailRecord> getCallDetailRecordsByParentCall(Sid parentCallSid);
List<CallDetailRecord> getCallDetailRecordsByConferenceSid(Sid conferenceSid);
List<CallDetailRecord> getRunningCallDetailRecordsByConferenceSid(Sid conferenceSid);
Integer getTotalRunningCallDetailRecordsByConferenceSid(Sid conferenceSid);
List<CallDetailRecord> getCallDetailRecordsByInstanceId(Sid instanceId);
List<CallDetailRecord> getInCompleteCallDetailRecordsByInstanceId(Sid instanceId);
List<CallDetailRecord> getCallDetailRecordsByMsId(String msId);
Double getAverageCallDurationLast24Hours(Sid instanceId) throws ParseException;
Double getAverageCallDurationLastHour(Sid instanceId) throws ParseException;
void removeCallDetailRecord(Sid sid);
void removeCallDetailRecords(Sid accountSid);
void updateCallDetailRecord(CallDetailRecord cdr);
void updateInCompleteCallDetailRecordsToCompletedByInstanceId(Sid instanceId);
// Support for filtering of calls list result, Issue 153
List<CallDetailRecord> getCallDetailRecords(CallDetailRecordFilter filter);
Integer getTotalCallDetailRecords(CallDetailRecordFilter filter);
Integer getInProgressCallsByClientName(String client);
Integer getInProgressCallsByAccountSid(String accountSid);
}
| 3,172 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AvailablePhoneNumbersDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/AvailablePhoneNumbersDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.AvailablePhoneNumber;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface AvailablePhoneNumbersDao {
void addAvailablePhoneNumber(AvailablePhoneNumber availablePhoneNumber);
List<AvailablePhoneNumber> getAvailablePhoneNumbers();
List<AvailablePhoneNumber> getAvailablePhoneNumbersByAreaCode(String areaCode);
List<AvailablePhoneNumber> getAvailablePhoneNumbersByPattern(String pattern);
List<AvailablePhoneNumber> getAvailablePhoneNumbersByRegion(String region);
List<AvailablePhoneNumber> getAvailablePhoneNumbersByPostalCode(int postalCode);
void removeAvailablePhoneNumber(String phoneNumber);
}
| 1,573 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ConferenceDetailRecordsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ConferenceDetailRecordsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import java.util.Map;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.ConferenceDetailRecord;
import org.restcomm.connect.dao.entities.ConferenceDetailRecordFilter;
import org.restcomm.connect.dao.entities.ConferenceRecordCountFilter;
/**
* @author [email protected] (Maria Farooq)
*/
public interface ConferenceDetailRecordsDao {
ConferenceDetailRecord getConferenceDetailRecord(Sid sid);
List<ConferenceDetailRecord> getConferenceDetailRecords(Sid accountSid);
List<ConferenceDetailRecord> getConferenceDetailRecordsByStatus(String status);
List<ConferenceDetailRecord> getConferenceDetailRecords(ConferenceDetailRecordFilter filter);
List<ConferenceDetailRecord> getConferenceDetailRecordsByDateCreated(DateTime dateCreated);
List<ConferenceDetailRecord> getConferenceDetailRecordsByDateUpdated(DateTime dateUpdated);
Integer getTotalConferenceDetailRecords(ConferenceDetailRecordFilter filter);
Integer countByFilter(ConferenceRecordCountFilter filter);
int addConferenceDetailRecord(ConferenceDetailRecord cdr);
void removeConferenceDetailRecord(Sid sid);
void removeConferenceDetailRecords(Sid accountSid);
void updateConferenceDetailRecordStatus(ConferenceDetailRecord cdr);
void updateConferenceDetailRecordMasterEndpointID(ConferenceDetailRecord cdr);
void updateMasterPresent(ConferenceDetailRecord cdr);
void updateConferenceDetailRecordMasterBridgeEndpointID(ConferenceDetailRecord cdr);
void updateModeratorPresent(ConferenceDetailRecord cdr);
/**
* @param params
* {sid, mode=IN, jdbcType=VARCHAR}
* {status, mode=IN, jdbcType=VARCHAR}
* {slaveMsId, mode=IN, jdbcType=VARCHAR}
* {dateUpdated, mode=IN, jdbcType=TIMESTAMP}
* {amIMaster, mode=IN, jdbcType=BOOLEAN}
* {completed, mode=OUT, jdbcType=BOOLEAN}
* @return true/false depending on if calling agent was able to complete the conference or not.
*/
boolean completeConferenceDetailRecord(Map params);
}
| 2,950 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
SmsMessagesDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/SmsMessagesDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.SmsMessage;
import org.restcomm.connect.dao.entities.SmsMessageFilter;
import java.text.ParseException;
import java.util.List;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface SmsMessagesDao {
void addSmsMessage(SmsMessage smsMessage);
SmsMessage getSmsMessage(Sid sid);
/**
* @param smppMessageId
* @return
*/
SmsMessage getSmsMessageBySmppMessageId(String smppMessageId);
List<SmsMessage> getSmsMessages(final Sid accountSid);
void removeSmsMessage(Sid sid);
void removeSmsMessages(Sid accountSid);
void updateSmsMessage(SmsMessage smsMessage);
int getSmsMessagesPerAccountLastPerMinute(String accountSid) throws ParseException;
// Support for filtering of message list result, Issue 1395
Integer getTotalSmsMessage(SmsMessageFilter filter);
List<SmsMessage> getSmsMessages(SmsMessageFilter filter);
List<SmsMessage> findBySmppMessageId(String smppMessageId);
}
| 1,905 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RecordingsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/RecordingsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Recording;
import org.restcomm.connect.dao.entities.RecordingFilter;
import java.util.List;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface RecordingsDao {
void addRecording(Recording recording);
Recording getRecording(Sid sid);
// otsakir: is this really needed?
Recording getRecordingByCall(Sid callSid);
List<Recording> getRecordingsByCall(Sid callSid);
List<Recording> getRecordings(Sid accountSid);
void removeRecording(Sid sid);
void removeRecordings(Sid accountSid);
// Support for filtering of recording list result, Issue 1395
Integer getTotalRecording(RecordingFilter filter);
List<Recording> getRecordings(RecordingFilter filter);
void updateRecording(Recording recording);
}
| 1,709 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
TranscriptionsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/TranscriptionsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Transcription;
import org.restcomm.connect.dao.entities.TranscriptionFilter;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface TranscriptionsDao {
void addTranscription(Transcription transcription);
Transcription getTranscription(Sid sid);
Transcription getTranscriptionByRecording(Sid recordingSid);
List<Transcription> getTranscriptions(Sid accountSid);
void removeTranscription(Sid sid);
void removeTranscriptions(Sid accountSid);
void updateTranscription(Transcription transcription);
// Support for filtering of notification list result, Issue 1395
Integer getTotalTranscription(TranscriptionFilter filter);
List<Transcription> getTranscriptions(TranscriptionFilter filter);
}
| 1,716 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
GeolocationDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/GeolocationDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.Geolocation;
import org.restcomm.connect.commons.dao.Sid;;
/**
* @author Fernando Mendioroz ([email protected])
*
*/
public interface GeolocationDao {
void addGeolocation(Geolocation gl);
Geolocation getGeolocation(Sid sid);
List<Geolocation> getGeolocations(Sid sid);
void removeGeolocation(Sid sid);
void removeGeolocations(Sid sid);
void updateGeolocation(Geolocation gl);
}
| 1,445 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
GatewaysDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/GatewaysDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.Gateway;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface GatewaysDao {
void addGateway(Gateway gateway);
Gateway getGateway(Sid sid);
List<Gateway> getGateways();
void removeGateway(Sid sid);
void updateGateway(Gateway gateway);
}
| 1,244 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaResourceBrokerDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/MediaResourceBrokerDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.MediaResourceBrokerEntity;
import org.restcomm.connect.dao.entities.MediaResourceBrokerEntityFilter;
/**
* @author [email protected] (Maria Farooq)
*/
public interface MediaResourceBrokerDao {
void addMediaResourceBrokerEntity(MediaResourceBrokerEntity ms);
List<MediaResourceBrokerEntity> getMediaResourceBrokerEntities();
List<MediaResourceBrokerEntity> getConnectedSlaveEntitiesByConfSid(Sid conferenceSid);
void removeMediaResourceBrokerEntity(MediaResourceBrokerEntityFilter filter);
void updateMediaResource(MediaResourceBrokerEntity ms);
}
| 1,539 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AnnouncementsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/AnnouncementsDao.java | package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.Announcement;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author <a href="mailto:[email protected]">George Vagenas</a>
*/
public interface AnnouncementsDao {
void addAnnouncement(Announcement announcement);
Announcement getAnnouncement(Sid sid);
List<Announcement> getAnnouncements(Sid accountSid);
void removeAnnouncement(Sid sid);
void removeAnnouncements(Sid accountSid);
}
| 514 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaServersDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/MediaServersDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.MediaServerEntity;
/**
* @author [email protected] (Maria Farooq)
*/
public interface MediaServersDao {
void addMediaServer(MediaServerEntity ms);
List<MediaServerEntity> getMediaServerEntityByIP(String msIPAddres);
List<MediaServerEntity> getMediaServers();
MediaServerEntity getMediaServer(String msId);
void removeMediaServerEntity(String msId);
void updateMediaServer(MediaServerEntity ms);
}
| 1,349 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OutgoingCallerIdsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/OutgoingCallerIdsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.OutgoingCallerId;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface OutgoingCallerIdsDao {
void addOutgoingCallerId(OutgoingCallerId outgoingCallerId);
OutgoingCallerId getOutgoingCallerId(Sid sid);
List<OutgoingCallerId> getOutgoingCallerIds(Sid accountSid);
void removeOutgoingCallerId(Sid sid);
void removeOutgoingCallerIds(Sid accountSid);
void updateOutgoingCallerId(OutgoingCallerId outgoingCallerId);
}
| 1,426 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
DaoManager.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/DaoManager.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import org.restcomm.connect.commons.Configurable;
import org.restcomm.connect.commons.LifeCycle;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface DaoManager extends Configurable, LifeCycle {
AccountsDao getAccountsDao();
ApplicationsDao getApplicationsDao();
AnnouncementsDao getAnnouncementsDao();
AvailablePhoneNumbersDao getAvailablePhoneNumbersDao();
CallDetailRecordsDao getCallDetailRecordsDao();
ConferenceDetailRecordsDao getConferenceDetailRecordsDao();
ClientsDao getClientsDao();
HttpCookiesDao getHttpCookiesDao();
IncomingPhoneNumbersDao getIncomingPhoneNumbersDao();
NotificationsDao getNotificationsDao();
OutgoingCallerIdsDao getOutgoingCallerIdsDao();
RegistrationsDao getRegistrationsDao();
RecordingsDao getRecordingsDao();
ShortCodesDao getShortCodesDao();
SmsMessagesDao getSmsMessagesDao();
UsageDao getUsageDao();
TranscriptionsDao getTranscriptionsDao();
GatewaysDao getGatewaysDao();
InstanceIdDao getInstanceIdDao();
MediaServersDao getMediaServersDao();
MediaResourceBrokerDao getMediaResourceBrokerDao();
ExtensionsConfigurationDao getExtensionsConfigurationDao();
GeolocationDao getGeolocationDao();
ProfileAssociationsDao getProfileAssociationsDao();
OrganizationsDao getOrganizationsDao();
ProfilesDao getProfilesDao();
}
| 2,261 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
UsageDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/UsageDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Usage;
import java.util.List;
/**
* @author [email protected] (Alexandre Mendonca)
*/
public interface UsageDao {
List<Usage> getUsage(final Sid accountSid);
List<Usage> getUsageDaily(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageMonthly(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageYearly(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageAllTime(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsage(final Sid accountSid, String uri);
List<Usage> getUsageDaily(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate, String uri);
List<Usage> getUsageMonthly(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate, String uri);
List<Usage> getUsageYearly(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate, String uri);
List<Usage> getUsageAllTime(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate, String uri);
/*
List<Usage> getUsageToday(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageYesterday(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageThisMonth(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
List<Usage> getUsageLastMonth(final Sid accountSid, Usage.Category category, DateTime startDate, DateTime endDate);
*/
}
| 2,649 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
InstanceIdDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/InstanceIdDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao;
import org.restcomm.connect.dao.entities.InstanceId;
/**
* @author <a href="mailto:[email protected]">gvagenas</a>
*
*/
public interface InstanceIdDao {
InstanceId getInstanceId();
InstanceId getInstanceIdByHost(String host);
void addInstancecId(InstanceId instanceId);
void updateInstanceId(InstanceId instanceId);
}
| 1,292 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AccountsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/AccountsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.entities.Account;
import org.restcomm.connect.dao.exceptions.AccountHierarchyDepthCrossed;
/**
* @author [email protected] (Thomas Quintana)
*/
public interface AccountsDao {
void addAccount(Account account);
Account getAccount(Sid sid);
Account getAccount(String name);
/**
* Created to separate the method used to authenticate from
* the method used to obtain an account from the database, using a ordinary
* String parameter.
* Once authentication cannot allow friendly name as username, this
* method can be similar to getAccount(String name), but without
* 'getAccountByFriendlyName' selector.
* @param name
* @return Account to authenticate
*/
Account getAccountToAuthenticate(String name);
List<Account> getChildAccounts(Sid parentSid);
void removeAccount(Sid sid);
void updateAccount(Account account);
/**
* Returns a list of all sub-accounts under a parent account. All nested sub-accounts in
* any level will be returned. Note:
* a) The parent account is not included in the results.
* b) The sub-account order in the returned list follows a top-down logic. So, higher hierarchy account list elements
* always go before lower hierarchy accounts.
*
* It will return an empty array in case the parent has no children or the parent does
* not exist.
*
* @param parentAccountSid
* @return list of account sid or null
*/
List<String> getSubAccountSidsRecursive(Sid parentAccountSid);
/**
* Returns a list of all the ancestor account SIDs of an Account all the way up to the
* top-level account. It currently works in an iterative way digging through the parentSid property
* until it reaches the top.
*
* The order of the returned list is significant starting with child accounts first and
* ending with the top-level account.
*
* Note, the list does NOT contain the account passed as a parameter.
*
* Examples:
*
* getAccountLineage(toplevelAccount) -> []
*
* parentAccoun is the direct child of toplevelAccount:
* getAccontLineage(parentAccount) -> [toplevelAccount]
*
* [email protected] is the child of [email protected]:
* getAccountLineage(childAccount) -> [[email protected], [email protected]]
*
* [email protected] is the child of [email protected]:
* getAccountLineage(grandchildAccount) -> AccountHierarchyDepthCrossed exctption thrown
*
* @param accountSid
* @return
*/
List<String> getAccountLineage(Sid accountSid) throws AccountHierarchyDepthCrossed;
/**
* Overloaded version of getAccontLineage(Sid) that won't retrieve current account since
* it's already there. Helps having cleaner concepts in the case when the starting child
* account is already loaded.
*
* @param account
* @return
* @throws AccountHierarchyDepthCrossed
*/
List<String> getAccountLineage(Account account) throws AccountHierarchyDepthCrossed;
/**
* @param sid of organization
* @return
*/
List<Account> getAccountsByOrganization(Sid organizationSid);
}
| 4,202 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ProfileAssociationsDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ProfileAssociationsDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao;
import java.util.List;
import org.restcomm.connect.dao.entities.ProfileAssociation;
/**
* @author [email protected] (Maria Farooq)
*/
public interface ProfileAssociationsDao {
/**
* @param targetSid
* @return ProfileAssociation as per provided target sid
*/
ProfileAssociation getProfileAssociationByTargetSid(String targetSid);
/**
* @param profileSid
* @return List of all ProfileAssociation with a give profile sid
*/
List<ProfileAssociation> getProfileAssociationsByProfileSid(String profileSid);
/**
* @param profileAssociation
* @return
*/
int addProfileAssociation(ProfileAssociation profileAssociation);
/**
* update ProfileAssociation Of TargetSid to new Profile Sid.
* @param profileAssociation
*/
void updateProfileAssociationOfTargetSid(ProfileAssociation profileAssociation);
/**
* update Associated Profile Of All Such ProfileSid
* @param oldProfileSid
* @param newProfileSid
*/
void updateAssociatedProfileOfAllSuchProfileSid(String oldProfileSid, String newProfileSid);
/**
* will delete all associations of given profile sid
* @param profileSid
*/
void deleteProfileAssociationByProfileSid(String profileSid);
/**
* will delete all associations of given target sid
* @param targetSid
* @return number of associations removed
*
*/
int deleteProfileAssociationByTargetSid(String targetSid);
/**
* will delete all associations of given target sid
* @param targetSid
* @return number of associations removed
*
*/
int deleteProfileAssociationByTargetSid(String targetSid, String profileSid);
}
| 2,581 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ExtensionsConfigurationDao.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/ExtensionsConfigurationDao.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2016, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package org.restcomm.connect.dao;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.extension.api.ConfigurationException;
import org.restcomm.connect.extension.api.ExtensionConfiguration;
import java.util.List;
/**
* Created by gvagenas on 11/10/2016.
*/
public interface ExtensionsConfigurationDao {
/**
* Add a new ExtensionConfiguration
* @param extensionConfiguration
*/
void addConfiguration(ExtensionConfiguration extensionConfiguration) throws ConfigurationException;
/**
* Update an existing ExtensionConfiguration
* @param extensionConfiguration
*/
void updateConfiguration(ExtensionConfiguration extensionConfiguration) throws ConfigurationException;
/**
* Get extension configuration by extension name
* @param extensionName
* @return ExtensionConfiguration
*/
ExtensionConfiguration getConfigurationByName(String extensionName);
/**
* Get extension configuration by Sid
* @param extensionSid
* @return ExtensionConfiguration
*/
ExtensionConfiguration getConfigurationBySid(Sid extensionSid);
/**
* Get all extension configuration
* @return List<ExtensionConfiguration>
*/
List<ExtensionConfiguration> getAllConfiguration();
/**
* Delete extension configuration by extension name
* @param extensionName
*/
void deleteConfigurationByName(String extensionName);
/**
* Delete extension configuration by Sid
* @param extensionSid
*/
void deleteConfigurationBySid(Sid extensionSid);
/**
* Check if there is a newer version of the configuration in the DB using extension name
* @param extensionName
* @param dateTime
* @return
*/
boolean isLatestVersionByName(String extensionName, DateTime dateTime);
/**
* Check if there is a newer version of the configuration in the DB using extension sid
* @param extensionSid
* @param dateTime
* @return
*/
boolean isLatestVersionBySid(Sid extensionSid, DateTime dateTime);
/**
* Validate extension configuration based on the type of the configuration data
* @param extensionConfiguration
* @return
*/
boolean validate(ExtensionConfiguration extensionConfiguration);
/**
* Get account specific ExtensionConfiguration
* @param accountSid
* @param extensionSid
* @return ExtensionConfiguration
*/
ExtensionConfiguration getAccountExtensionConfiguration(String accountSid, String extensionSid);
/**
* Add a new account specific ExtensionConfiguration
* @param extensionConfiguration
* @param accountSid
*/
void addAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid) throws ConfigurationException;
/**
* Update an existing account specific ExtensionConfiguration
* @param extensionConfiguration
* @param accountSid
*/
void updateAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid) throws ConfigurationException;
/**
* Delete account specific ExtensionConfiguration
* @param accountSid
* @param extensionSid
*/
void deleteAccountExtensionConfiguration(String accountSid, String extensionSid);
}
| 4,193 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AccountHierarchyDepthCrossed.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/exceptions/AccountHierarchyDepthCrossed.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.exceptions;
import org.restcomm.connect.commons.exceptions.RestcommRuntimeException;
/**
* Thrown when an operation needs to process account hierarchies with greater
* depth then the one allowed.
*
* @author [email protected] - Orestis Tsakiridis
*/
public class AccountHierarchyDepthCrossed extends RestcommRuntimeException {
public AccountHierarchyDepthCrossed() {
}
public AccountHierarchyDepthCrossed(String message) {
super(message);
}
public AccountHierarchyDepthCrossed(String message, Throwable cause) {
super(message, cause);
}
public AccountHierarchyDepthCrossed(Throwable cause) {
super(cause);
}
public AccountHierarchyDepthCrossed(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| 1,743 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Sorting.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/common/Sorting.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.common;
import java.util.HashMap;
import java.util.Map;
/**
* Class to assist with Sorting facilities of the API
*/
public class Sorting {
public static final String SORT_BY_KEY = "sort-by";
public static final String SORT_DIRECTION_KEY = "sort-direction";
/**
* Sorting direction for various API Queries
*/
public enum Direction {
ASC,
DESC,
}
/**
* Parse the sorting part of the URI and return sortBy and sortDirection counterparts
* @param url String representing the sorting part of the URI, which is of the form SortBy=<field>:<direction>', for example: '?SortBy=date_created:asc'
* @return a map containing sortBy and sortDirection
* @throws Exception if there is a parsing error
*/
public static Map<String, String> parseUrl(String url) throws Exception {
final String[] values = url.split(":", 2);
HashMap<String, String> sortParameters = new HashMap<String, String>();
sortParameters.put(SORT_BY_KEY, values[0]);
if (values.length > 1) {
sortParameters.put(SORT_DIRECTION_KEY, values[1]);
if (sortParameters.get(SORT_BY_KEY).isEmpty()) {
throw new Exception("Error parsing the SortBy parameter: missing field to sort by");
}
if (!sortParameters.get(SORT_DIRECTION_KEY).equalsIgnoreCase(Direction.ASC.name()) && !sortParameters.get(SORT_DIRECTION_KEY).equalsIgnoreCase(Direction.DESC.name())) {
throw new Exception("Error parsing the SortBy parameter: sort direction needs to be either " + Direction.ASC + " or " + Direction.DESC);
}
}
else if (values.length == 1) {
// Default to ascending if only the sorting field has been passed without direction
sortParameters.put(SORT_DIRECTION_KEY, Direction.ASC.name());
}
return sortParameters;
}
}
| 2,765 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OrganizationUtil.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/common/OrganizationUtil.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.common;
import javax.servlet.sip.SipURI;
import org.apache.log4j.Logger;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.dao.DaoManager;
import org.restcomm.connect.dao.entities.Organization;
/**
* @author [email protected] (Maria Farooq)
*/
public class OrganizationUtil {
private static Logger logger = Logger.getLogger(OrganizationUtil.class);
/**
* getOrganizationSidBySipURIHost
*
* @param sipURI
* @return Sid of Organization
*/
public static Sid getOrganizationSidBySipURIHost(DaoManager storage, final SipURI sipURI) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("getOrganizationSidBySipURIHost sipURI = %s", sipURI));
}
final String organizationDomainName = sipURI.getHost();
Organization organization = storage.getOrganizationsDao().getOrganizationByDomainName(organizationDomainName);
return organization == null ? null : organization.getSid();
}
/**
* getOrganizationSidByAccountSid
*
* @param accountSid
* @return Sid of Organization
*/
public static Sid getOrganizationSidByAccountSid(DaoManager storage, final Sid accountSid) {
return storage.getAccountsDao().getAccount(accountSid).getOrganizationSid();
}
}
| 2,164 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Account.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Account.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* Represent a user Account
*
* @author [email protected] (Thomas Quintana)
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class Account {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String emailAddress;
private final String friendlyName;
private final Sid parentSid;
private final Type type;
private final Status status;
private final String authToken;
private final String role;
private final URI uri;
private final Sid organizationSid;
public Account(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String emailAddress,
final String friendlyName, final Sid parentSid, final Type type, final Status status, final String authToken,
final String role, final URI uri, final Sid organizationSid) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.emailAddress = emailAddress;
this.friendlyName = friendlyName;
this.parentSid = parentSid;
this.type = type;
this.status = status;
this.authToken = authToken;
this.role = role;
this.uri = uri;
this.organizationSid = organizationSid;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public String getEmailAddress() {
return emailAddress;
}
public String getFriendlyName() {
return friendlyName;
}
public Sid getParentSid() {
return parentSid;
}
public Type getType() {
return type;
}
public Status getStatus() {
return status;
}
public String getAuthToken() {
return authToken;
}
public String getRole() {
return role;
}
public URI getUri() {
return uri;
}
public Sid getOrganizationSid() {
return organizationSid;
}
public Account setEmailAddress(final String emailAddress) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setFriendlyName(final String friendlyName) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setType(final Type type) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setStatus(final Status status) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setAuthToken(final String authToken) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setRole(final String role) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public Account setOrganizationSid(final Sid organizationSid) {
return new Account(sid, dateCreated, DateTime.now(), emailAddress, friendlyName, parentSid, type, status, authToken,
role, uri, organizationSid);
}
public enum Status {
ACTIVE("active"), CLOSED("closed"), SUSPENDED("suspended"), INACTIVE("inactive"), UNINITIALIZED("uninitialized");
private final String text;
private Status(final String text) {
this.text = text;
}
public static Status getValueOf(final String text) {
Status[] values = values();
for (final Status value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid account status.");
}
@Override
public String toString() {
return text;
}
};
public enum Type {
FULL("Full"), TRIAL("Trial");
private final String text;
private Type(final String text) {
this.text = text;
}
public static Type getValueOf(final String text) {
Type[] values = values();
for (final Type value : values) {
if (value.text.equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid account type.");
}
@Override
public String toString() {
return text;
}
};
public static final class Builder {
private Sid sid;
private String emailAddress;
private String friendlyName;
private Sid parentSid;
private Type type;
private Status status;
private String authToken;
private String role;
private URI uri;
private Sid organizationSid;
private Builder() {
super();
}
public Builder copy(Account account) {
sid = account.getSid();
parentSid = account.getParentSid();
organizationSid = account.getOrganizationSid();
type = account.getType();
uri = account.getUri();
authToken = account.getAuthToken();
emailAddress = account.getEmailAddress();
friendlyName = account.getFriendlyName();
role = account.getRole();
status = account.getStatus();
return this;
}
public Account build() {
final DateTime now = DateTime.now();
return new Account(sid, now, now, emailAddress, friendlyName, parentSid, type, status, authToken, role, uri, organizationSid);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setEmailAddress(final String emailAddress) {
this.emailAddress = emailAddress;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setParentSid(final Sid parentSid) {
this.parentSid = parentSid;
}
public void setOrganizationSid(final Sid organizationSid) {
this.organizationSid = organizationSid;
}
public void setType(final Type type) {
this.type = type;
}
public void setStatus(final Status status) {
this.status = status;
}
public void setAuthToken(final String authToken) {
this.authToken = authToken;
}
public void setRole(final String role) {
this.role = role;
}
public void setUri(final URI uri) {
this.uri = uri;
}
}
}
| 8,472 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Recording.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Recording.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.commons.stream.StreamEvent;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Recording implements StreamEvent {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final Sid callSid;
private final Double duration;
private final String apiVersion;
private URI uri;
private URI fileUri;
private URI s3Uri;
public Recording(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final Sid accountSid,
final Sid callSid, final Double duration, final String apiVersion, final URI uri, final URI fileUri, final URI s3Uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.callSid = callSid;
this.duration = duration;
this.apiVersion = apiVersion;
this.uri = uri;
this.fileUri = fileUri;
this.s3Uri = s3Uri;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public Sid getCallSid() {
return callSid;
}
public Double getDuration() {
return duration;
}
public String getApiVersion() {
return apiVersion;
}
public URI getUri() {
return uri;
}
public Recording updateUri(URI newUri) {
this.uri = newUri;
return this;
}
public URI getFileUri() {
return fileUri;
}
public Recording updateFileUri(URI newFileUri) {
this.fileUri = newFileUri;
return this;
}
public Recording setS3Uri(URI s3Uri) {
this.s3Uri = s3Uri;
return this;
}
public URI getS3Uri() {
return s3Uri;
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private Sid accountSid;
private Sid callSid;
private Double duration;
private String apiVersion;
private URI uri;
private URI fileUri;
private URI s3Uri;
private Builder() {
super();
}
public Recording build() {
final DateTime now = DateTime.now();
return new Recording(sid, now, now, accountSid, callSid, duration, apiVersion, uri, fileUri, s3Uri);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setCallSid(final Sid callSid) {
this.callSid = callSid;
}
public void setDuration(final double duration) {
this.duration = duration;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setFileUri(final URI uri) {
this.fileUri = uri;
}
public void setS3Uri(final URI s3Uri) { this.s3Uri = s3Uri; }
}
}
| 4,553 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AvailablePhoneNumberList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/AvailablePhoneNumberList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class AvailablePhoneNumberList {
private final List<AvailablePhoneNumber> availablePhoneNumbers;
public AvailablePhoneNumberList(final List<AvailablePhoneNumber> availablePhoneNumbers) {
super();
this.availablePhoneNumbers = availablePhoneNumbers;
}
public List<AvailablePhoneNumber> getAvailablePhoneNumbers() {
return availablePhoneNumbers;
}
}
| 1,439 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
GatewayList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/GatewayList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class GatewayList {
private final List<Gateway> gateways;
public GatewayList(final List<Gateway> gateways) {
super();
this.gateways = gateways;
}
public List<Gateway> getGateways() {
return gateways;
}
}
| 1,296 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ApplicationNumberSummary.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ApplicationNumberSummary.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
/**
* A summary entity for IncomingPhoneNumber to be nested inside the application
*/
public class ApplicationNumberSummary {
String sid;
String friendlyName;
String phoneNumber;
String voiceApplicationSid;
String smsApplicationSid;
String ussdApplicationSid;
String referApplicationSid;
public ApplicationNumberSummary(String sid, String friendlyName, String phoneNumber, String voiceApplicationSid, String smsApplicationSid, String ussdApplicationSid, String referApplicationSid) {
this.sid = sid;
this.friendlyName = friendlyName;
this.phoneNumber = phoneNumber;
this.voiceApplicationSid = voiceApplicationSid;
this.smsApplicationSid = smsApplicationSid;
this.ussdApplicationSid = ussdApplicationSid;
this.referApplicationSid = referApplicationSid;
}
public String getSid() {
return sid;
}
public String getFriendlyName() {
return friendlyName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public String getVoiceApplicationSid() {
return voiceApplicationSid;
}
public String getSmsApplicationSid() {
return smsApplicationSid;
}
public String getUssdApplicationSid() {
return ussdApplicationSid;
}
public String getReferApplicationSid() {
return referApplicationSid;
}
}
| 2,255 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AccountList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/AccountList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class AccountList {
private final List<Account> accounts;
public AccountList(final List<Account> accounts) {
super();
this.accounts = accounts;
}
public List<Account> getAccounts() {
return accounts;
}
}
| 1,296 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
InstanceId.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/InstanceId.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao.entities;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author <a href="mailto:[email protected]">gvagenas</a>
*
*/
public class InstanceId {
private Sid instanceId;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String host;
public InstanceId(final Sid instanceId, final String host, final DateTime dateCreated, final DateTime dateUpdated) {
this.instanceId = instanceId;
this.host = host;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
}
public Sid getId() {
return instanceId;
}
public String getHost() { return host; }
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public InstanceId setInstanceId(final Sid instanceId, final String host) {
return new InstanceId(instanceId, host, this.dateCreated, DateTime.now());
}
@Override
public String toString() {
return this.instanceId+"/"+this.host;
}
}
| 2,070 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
TranscriptionFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/TranscriptionFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author <a href="mailto:[email protected]">vunguyen</a>
*/
@Immutable
public class TranscriptionFilter {
private final String accountSid;
private final List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private final Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private final Date endTime;
private final String transcriptionText;
private final Integer limit;
private final Integer offset;
private final String instanceid;
public TranscriptionFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime,
String transcriptionText, Integer limit, Integer offset) throws ParseException {
this(accountSid, accountSidSet, startTime,endTime, transcriptionText, limit,offset,null);
}
public TranscriptionFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime,
String transcriptionText, Integer limit, Integer offset, String instanceId) throws ParseException {
this.accountSid = accountSid;
this.accountSidSet = accountSidSet;
this.transcriptionText = transcriptionText;
this.limit = limit;
this.offset = offset;
if (startTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(startTime);
this.startTime = date;
} else
this.startTime = null;
if (endTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(endTime);
this.endTime = date;
} else {
this.endTime = null;
}
if (instanceId != null && !instanceId.isEmpty()) {
this.instanceid = instanceId;
} else {
this.instanceid = null;
}
}
public String getSid() {
return accountSid;
}
public List<String> getAccountSidSet() {
return accountSidSet;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public String getTranscriptionText() {
return transcriptionText;
}
public int getLimit() {
return limit;
}
public int getOffset() {
return offset;
}
public String getInstanceid() { return instanceid; }
}
| 3,547 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ApplicationList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ApplicationList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class ApplicationList {
private final List<Application> applications;
public ApplicationList(final List<Application> applications) {
super();
this.applications = applications;
}
public List<Application> getApplications() {
return applications;
}
}
| 1,340 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Geolocation.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Geolocation.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author <a href="mailto:[email protected]"> Fernando Mendioroz </a>
*
*/
public final class Geolocation {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final DateTime dateExecuted;
private final Sid accountSid;
private final String source;
private final String deviceIdentifier;
private final GeolocationType geolocationType;
private final String responseStatus;
private final String cellId;
private final String locationAreaCode;
private final Integer mobileCountryCode;
private final String mobileNetworkCode;
private final Long networkEntityAddress;
private final Integer ageOfLocationInfo;
private final String deviceLatitude;
private final String deviceLongitude;
private final Long accuracy;
private final String physicalAddress;
private final String internetAddress;
private final String formattedAddress;
private final DateTime locationTimestamp;
private final String eventGeofenceLatitude;
private final String eventGeofenceLongitude;
private final Long radius;
private final String geolocationPositioningType;
private final String lastGeolocationResponse;
private final String cause;
private final String apiVersion;
private final URI uri;
public Geolocation(Sid sid, DateTime dateCreated, DateTime dateUpdated, DateTime dateExecuted, Sid accountSid,
String source, String deviceIdentifier, GeolocationType geolocationType, String responseStatus, String cellId,
String locationAreaCode, Integer mobileCountryCode, String mobileNetworkCode, Long networkEntityAddress,
Integer ageOfLocationInfo, String deviceLatitude, String deviceLongitude, Long accuracy, String physicalAddress,
String internetAddress, String formattedAddress, DateTime locationTimestamp, String eventGeofenceLatitude,
String eventGeofenceLongitude, Long radius, String geolocationPositioningType, String lastGeolocationResponse,
String cause, String apiVersion, URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.dateExecuted = dateExecuted;
this.accountSid = accountSid;
this.source = source;
this.deviceIdentifier = deviceIdentifier;
this.geolocationType = geolocationType;
this.responseStatus = responseStatus;
this.cellId = cellId;
this.locationAreaCode = locationAreaCode;
this.mobileCountryCode = mobileCountryCode;
this.mobileNetworkCode = mobileNetworkCode;
this.networkEntityAddress = networkEntityAddress;
this.ageOfLocationInfo = ageOfLocationInfo;
this.deviceLatitude = deviceLatitude;
this.deviceLongitude = deviceLongitude;
this.accuracy = accuracy;
this.physicalAddress = physicalAddress;
this.internetAddress = internetAddress;
this.formattedAddress = formattedAddress;
this.locationTimestamp = locationTimestamp;
this.eventGeofenceLatitude = eventGeofenceLatitude;
this.eventGeofenceLongitude = eventGeofenceLongitude;
this.radius = radius;
this.geolocationPositioningType = geolocationPositioningType;
this.lastGeolocationResponse = lastGeolocationResponse;
this.cause = cause;
this.apiVersion = apiVersion;
this.uri = uri;
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public DateTime getDateExecuted() {
return dateExecuted;
}
public Sid getAccountSid() {
return accountSid;
}
public String getSource() {
return source;
}
public String getDeviceIdentifier() {
return deviceIdentifier;
}
public GeolocationType getGeolocationType() {
return geolocationType;
}
public String getResponseStatus() {
return responseStatus;
}
public String getCellId() {
return cellId;
}
public String getLocationAreaCode() {
return locationAreaCode;
}
public Integer getMobileCountryCode() {
return mobileCountryCode;
}
public String getMobileNetworkCode() {
return mobileNetworkCode;
}
public Long getNetworkEntityAddress() {
return networkEntityAddress;
}
public Integer getAgeOfLocationInfo() {
return ageOfLocationInfo;
}
public String getDeviceLatitude() {
return deviceLatitude;
}
public String getDeviceLongitude() {
return deviceLongitude;
}
public Long getAccuracy() {
return accuracy;
}
public String getPhysicalAddress() {
return physicalAddress;
}
public String getInternetAddress() {
return internetAddress;
}
public String getFormattedAddress() {
return formattedAddress;
}
public DateTime getLocationTimestamp() {
return locationTimestamp;
}
public String getEventGeofenceLatitude() {
return eventGeofenceLatitude;
}
public String getEventGeofenceLongitude() {
return eventGeofenceLongitude;
}
public Long getRadius() {
return radius;
}
public String getGeolocationPositioningType() {
return geolocationPositioningType;
}
public String getLastGeolocationResponse() {
return lastGeolocationResponse;
}
public String getCause() {
return cause;
}
public String getApiVersion() {
return apiVersion;
}
public URI getUri() {
return uri;
}
public enum GeolocationType {
Immediate("Immediate"), Notification("Notification");
private final String glt;
private GeolocationType(final String glt) {
this.glt = glt;
}
public static GeolocationType getValueOf(final String glt) {
GeolocationType[] values = values();
for (final GeolocationType value : values) {
if (value.toString().equals(glt)) {
return value;
}
}
throw new IllegalArgumentException(glt + " is not a valid GeolocationType.");
}
@Override
public String toString() {
return glt;
}
};
public Geolocation setSid(Sid sid) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDateCreated(DateTime dateCreated) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDateUpdated(DateTime dateUpdated) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDateExecuted(DateTime dateExecuted) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setAccountSid(Sid accountSid) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setSource(String source) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDeviceIdentifier(String deviceIdentifier) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setGeolocationType(GeolocationType geolocationType) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setResponseStatus(String responseStatus) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setCellId(String cellId) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setLocationAreaCode(String locationAreaCode) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setLocationTimestamp(DateTime locationTimestamp) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setMobileCountryCode(Integer mobileCountryCode) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setMobileNetworkCode(String mobileNetworkCode) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setNetworkEntityAddress(Long networkEntityAddress) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setAgeOfLocationInfo(Integer ageOfLocationInfo) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDeviceLatitude(String deviceLatitude) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setDeviceLongitude(String deviceLongitude) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setAccuracy(Long accuracy) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setPhysicalAddress(String physicalAddress) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setInternetAddress(String internetAddress) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setFormattedAddress(String formattedAddress) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setEventGeofenceLatitude(String eventGeofenceLatitude) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setEventGeofenceLongitude(String eventGeofenceLongitude) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setRadius(Long radius) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setGeolocationPositioningType(String geolocationPositioningType) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setLastGeolocationResponse(String lastGeolocationResponse) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setCause(String cause) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setApiVersion(String apiVersion) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public Geolocation setUri(URI uri) {
return new Geolocation(sid, dateCreated, dateUpdated, dateExecuted, accountSid, source, deviceIdentifier,
geolocationType, responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode,
networkEntityAddress, ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress,
internetAddress, formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public static Builder builder() {
return new Builder();
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private DateTime dateUpdated;
private Sid accountSid;
private String source;
private String deviceIdentifier;
private GeolocationType geolocationType;
private String responseStatus;
private String cellId;
private String locationAreaCode;
private Integer mobileCountryCode;
private String mobileNetworkCode;
private Long networkEntityAddress;
private Integer ageOfLocationInfo;
private String deviceLatitude;
private String deviceLongitude;
private Long accuracy;
private String physicalAddress;
private String internetAddress;
private String formattedAddress;
private DateTime locationTimestamp;
private String eventGeofenceLatitude;
private String eventGeofenceLongitude;
private Long radius;
private String geolocationPositioningType;
private String lastGeolocationResponse;
private String cause;
private String apiVersion;
private URI uri;
private Builder() {
super();
}
public Geolocation build() {
final DateTime now = DateTime.now();
return new Geolocation(sid, now, dateUpdated, now, accountSid, source, deviceIdentifier, geolocationType,
responseStatus, cellId, locationAreaCode, mobileCountryCode, mobileNetworkCode, networkEntityAddress,
ageOfLocationInfo, deviceLatitude, deviceLongitude, accuracy, physicalAddress, internetAddress,
formattedAddress, locationTimestamp, eventGeofenceLatitude, eventGeofenceLongitude, radius,
geolocationPositioningType, lastGeolocationResponse, cause, apiVersion, uri);
}
public void setSid(Sid sid) {
this.sid = sid;
}
public void setDateUpdated(DateTime dateUpdated) {
this.dateUpdated = dateUpdated;
}
public void setAccountSid(Sid accountSid) {
this.accountSid = accountSid;
}
public void setSource(String source) {
this.source = source;
}
public void setDeviceIdentifier(String deviceIdentifier) {
this.deviceIdentifier = deviceIdentifier;
}
public void setGeolocationType(GeolocationType geolocationType) {
this.geolocationType = geolocationType;
}
public void setResponseStatus(String responseStatus) {
this.responseStatus = responseStatus;
}
public void setCellId(String cellId) {
this.cellId = cellId;
}
public void setLocationAreaCode(String locationAreaCode) {
this.locationAreaCode = locationAreaCode;
}
public void setMobileCountryCode(Integer mobileCountryCode) {
this.mobileCountryCode = mobileCountryCode;
}
public void setMobileNetworkCode(String mobileNetworkCode) {
this.mobileNetworkCode = mobileNetworkCode;
}
public void setNetworkEntityAddress(Long networkEntityAddress) {
this.networkEntityAddress = networkEntityAddress;
}
public void setAgeOfLocationInfo(Integer ageOfLocationInfo) {
this.ageOfLocationInfo = ageOfLocationInfo;
}
public void setDeviceLatitude(String devLatitude) {
this.deviceLatitude = devLatitude;
}
public void setDeviceLongitude(String devLongitude) {
this.deviceLongitude = devLongitude;
}
public void setAccuracy(Long accuracy) {
this.accuracy = accuracy;
}
public void setPhysicalAddress(String physicalAddress) {
this.physicalAddress = physicalAddress;
}
public void setInternetAddress(String internetAddress) {
this.internetAddress = internetAddress;
}
public void setFormattedAddress(String formattedAddress) {
this.formattedAddress = formattedAddress;
}
public void setLocationTimestamp(DateTime locationTimestamp) {
try {
this.locationTimestamp = locationTimestamp;
} catch (Exception exception) {
DateTime locTimestamp = DateTime.parse("1900-01-01");
this.locationTimestamp = locTimestamp;
}
}
public void setEventGeofenceLatitude(String eventGeofenceLat) {
this.eventGeofenceLatitude = eventGeofenceLat;
}
public void setEventGeofenceLongitude(String eventGeofenceLong) {
this.eventGeofenceLongitude = eventGeofenceLong;
}
public void setRadius(Long radius) {
if (geolocationType.toString().equals(GeolocationType.Notification)) {
this.radius = radius;
} else {
this.radius = null;
}
}
public void setGeolocationPositioningType(String geolocationPositioningType) {
this.geolocationPositioningType = geolocationPositioningType;
}
public void setLastGeolocationResponse(String lastGeolocationResponse) {
this.lastGeolocationResponse = lastGeolocationResponse;
}
public void setCause(String cause) {
if (responseStatus != null && (responseStatus.equalsIgnoreCase("rejected")
|| responseStatus.equalsIgnoreCase("unauthorized") || responseStatus.equalsIgnoreCase("failed"))) {
this.cause = cause;
// "cause" is only updated if "responseStatus" is not null and is either "rejected", "unauthorized" or "failed"
// Otherwise, it's value in HTTP POST/PUT is ignored
}
if (responseStatus != null && (!responseStatus.equalsIgnoreCase("rejected")
&& !responseStatus.equalsIgnoreCase("unauthorized") && !responseStatus.equalsIgnoreCase("failed"))) {
this.cause = null;
// "cause" is set to null if "responseStatus" is not null and is neither "rejected", "unauthorized" nor "failed"
}
}
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
public void setUri(URI uri) {
this.uri = uri;
}
}
}
| 32,828 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaServerFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MediaServerFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class MediaServerFilter {
private final String msIpAddress;
private final String msPort;
public MediaServerFilter(final String msIpAddress, final String msPort) throws ParseException {
this.msIpAddress = msIpAddress;
this.msPort = msPort;
}
public String getMsIpAddress() {
return msIpAddress;
}
public String getMsPort() {
return msPort;
}
}
| 1,448 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Transcription.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Transcription.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.io.Serializable;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Currency;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Transcription implements Serializable {
private static final long serialVersionUID = 1L;
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final Status status;
private final Sid recordingSid;
private final Double duration;
private final String transcriptionText;
private final BigDecimal price;
private Currency priceUnit;
private final URI uri;
public Transcription(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final Sid accountSid,
final Status status, final Sid recordingSid, final Double duration, final String transcriptionText,
final BigDecimal price, final Currency priceUnit, final URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.status = status;
this.recordingSid = recordingSid;
this.duration = duration;
this.transcriptionText = transcriptionText;
this.price = price;
this.priceUnit = priceUnit;
this.uri = uri;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public Status getStatus() {
return status;
}
public Sid getRecordingSid() {
return recordingSid;
}
public Double getDuration() {
return duration;
}
public String getTranscriptionText() {
return transcriptionText;
}
public BigDecimal getPrice() {
return price;
}
public Currency getPriceUnit() {
return priceUnit;
}
public URI getUri() {
return uri;
}
public Transcription setStatus(final Status status) {
final DateTime now = DateTime.now();
return new Transcription(sid, dateCreated, now, accountSid, status, recordingSid, duration, transcriptionText, price,
priceUnit, uri);
}
public Transcription setTranscriptionText(final String text) {
final DateTime now = DateTime.now();
return new Transcription(sid, dateCreated, now, accountSid, status, recordingSid, duration, text, price, priceUnit, uri);
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private Sid accountSid;
private Status status;
private Sid recordingSid;
private Double duration;
private String transcriptionText;
private BigDecimal price;
private Currency priceUnit;
private URI uri;
private Builder() {
super();
}
public Transcription build() {
final DateTime now = DateTime.now();
return new Transcription(sid, now, now, accountSid, status, recordingSid, duration, transcriptionText, price,
priceUnit, uri);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setStatus(final Status status) {
this.status = status;
}
public void setRecordingSid(final Sid recordingSid) {
this.recordingSid = recordingSid;
}
public void setDuration(final double duration) {
this.duration = duration;
}
public void setTranscriptionText(final String transcriptionText) {
this.transcriptionText = transcriptionText;
}
public void setPrice(final BigDecimal price) {
this.price = price;
}
public void setPriceUnit(Currency priceUnit) {
this.priceUnit = priceUnit;
}
public void setUri(final URI uri) {
this.uri = uri;
}
}
public enum Status {
IN_PROGRESS("in-progress"), COMPLETED("completed"), FAILED("failed");
private final String text;
private Status(final String text) {
this.text = text;
}
public static Status getStatusValue(final String text) {
final Status[] values = values();
for (final Status value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid status.");
}
@Override
public String toString() {
return text;
}
}
}
| 6,125 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CallDetailRecordList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/CallDetailRecordList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class CallDetailRecordList {
private final List<CallDetailRecord> cdrs;
public CallDetailRecordList(final List<CallDetailRecord> cdrs) {
super();
this.cdrs = cdrs;
}
public List<CallDetailRecord> getCallDetailRecords() {
return cdrs;
}
}
| 1,330 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Client.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Client.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.configuration.RestcommConfiguration;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.commons.util.DigestAuthentication;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Client {
public static final int DISABLED = 0;
public static final int ENABLED = 1;
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final String apiVersion;
private final String friendlyName;
private final String login;
private final String password;
private final Integer status;
private final URI voiceUrl;
private final String voiceMethod;
private final URI voiceFallbackUrl;
private final String voiceFallbackMethod;
private final Sid voiceApplicationSid;
private final URI uri;
private final String pushClientIdentity;
private final String passwordAlgorithm;
public Client(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final Sid accountSid,
final String apiVersion, final String friendlyName, final String login, final String password,
final Integer status, final URI voiceUrl, final String voiceMethod, final URI voiceFallbackUrl,
String voiceFallbackMethod, final Sid voiceApplicationSid, final URI uri, final String pushClientIdentity, final String passwordAlgorithm) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.apiVersion = apiVersion;
this.friendlyName = friendlyName;
this.login = login;
this.password = password;
this.status = status;
this.voiceUrl = voiceUrl;
this.voiceMethod = voiceMethod;
this.voiceFallbackUrl = voiceFallbackUrl;
this.voiceFallbackMethod = voiceFallbackMethod;
this.voiceApplicationSid = voiceApplicationSid;
this.uri = uri;
this.pushClientIdentity = pushClientIdentity;
this.passwordAlgorithm = passwordAlgorithm;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public String getApiVersion() {
return apiVersion;
}
public String getFriendlyName() {
return friendlyName;
}
public String getLogin() {
return login;
}
public String getPassword() {
return password;
}
public Integer getStatus() {
return status;
}
public URI getVoiceUrl() {
return voiceUrl;
}
public String getVoiceMethod() {
return voiceMethod;
}
public URI getVoiceFallbackUrl() {
return voiceFallbackUrl;
}
public String getVoiceFallbackMethod() {
return voiceFallbackMethod;
}
public Sid getVoiceApplicationSid() {
return voiceApplicationSid;
}
public URI getUri() {
return uri;
}
public String getPushClientIdentity() {
return pushClientIdentity;
}
public String getPasswordAlgorithm() { return passwordAlgorithm; }
public Client setFriendlyName(final String friendlyName) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
/**
* @param login
* @param password
* @param realm
* @return
*/
public Client setPassword(final String login, final String password, final String realm) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, DigestAuthentication.HA1(login, realm, password), status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, RestcommConfiguration.getInstance().getMain().getClientAlgorithm());
}
public Client setStatus(final int status) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setVoiceUrl(final URI voiceUrl) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setVoiceMethod(final String voiceMethod) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setVoiceFallbackUrl(final URI voiceFallbackUrl) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setVoiceFallbackMethod(final String voiceFallbackMethod) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setVoiceApplicationSid(final Sid voiceApplicationSid) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setPushClientIdentity(final String pushClientIdentity) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public Client setPasswordAlgorithm(final String passwordAlgorithm) {
return new Client(sid, dateCreated, DateTime.now(), accountSid, apiVersion, friendlyName, login, password, status,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private Sid accountSid;
private String apiVersion;
private String friendlyName;
private String login;
private String password;
private int status;
private URI voiceUrl;
private String voiceMethod;
private URI voiceFallbackUrl;
private String voiceFallbackMethod;
private Sid voiceApplicationSid;
private URI uri;
private String pushClientIdentity;
private String passwordAlgorithm;
private Builder() {
super();
}
public Client build() {
final DateTime now = DateTime.now();
return new Client(sid, now, now, accountSid, apiVersion, friendlyName, login, password, status, voiceUrl,
voiceMethod, voiceFallbackUrl, voiceFallbackMethod, voiceApplicationSid, uri, pushClientIdentity, passwordAlgorithm);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setLogin(final String login) {
this.login = login;
}
/**
* @param login
* @param password
* @param realm
* @param algorithm TODO
*/
public void setPassword(final String login, final String password, final String realm, String algorithm) {
if(!algorithm.isEmpty()) {
this.password = DigestAuthentication.HA1(login, realm, password);
}else {
this.password = password;
}
}
public void setStatus(final int status) {
this.status = status;
}
public void setVoiceUrl(final URI voiceUrl) {
this.voiceUrl = voiceUrl;
}
public void setVoiceMethod(final String voiceMethod) {
this.voiceMethod = voiceMethod;
}
public void setVoiceFallbackUrl(final URI voiceFallbackUrl) {
this.voiceFallbackUrl = voiceFallbackUrl;
}
public void setVoiceFallbackMethod(final String voiceFallbackMethod) {
this.voiceFallbackMethod = voiceFallbackMethod;
}
public void setVoiceApplicationSid(final Sid voiceApplicationSid) {
this.voiceApplicationSid = voiceApplicationSid;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setPushClientIdentity(String pushClientIdentity) {
this.pushClientIdentity = pushClientIdentity;
}
public void setPasswordAlgorithm(final String passwordAlgorithm) { this.passwordAlgorithm = passwordAlgorithm; }
}
}
| 11,189 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ProfileAssociation.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ProfileAssociation.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.Calendar;
import java.util.Date;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public final class ProfileAssociation{
private final Sid profileSid;
private final Sid targetSid;
private final Date dateCreated;
private final Date dateUpdated;
/**
* @param profileSid
* @param targetSid can be account or organizaation Sid
* @param dateCreated
* @param dateUpdated
*/
public ProfileAssociation(final Sid profileSid, final Sid targetSid, final Date dateCreated, final Date dateUpdated) {
super();
this.profileSid = profileSid;
this.targetSid = targetSid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
}
public static Builder builder() {
return new Builder();
}
public Sid getProfileSid() {
return profileSid;
}
public Sid getTargetSid() {
return targetSid;
}
public Date getDateCreated() {
return dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
/**
* @param newProfileSid
* @return
*/
public ProfileAssociation setProfileSid(final Sid newProfileSid){
return new ProfileAssociation(newProfileSid, targetSid, dateCreated, Calendar.getInstance().getTime());
}
@NotThreadSafe
public static final class Builder {
private Sid profileSid;
private Sid targetSid;
private Date dateCreated;
private Builder() {
super();
profileSid = null;
targetSid = null;
dateCreated = null;
}
public ProfileAssociation build() {
return new ProfileAssociation(profileSid, targetSid, dateCreated, Calendar.getInstance().getTime());
}
public void setProfileDocument(final Sid targetSid) {
this.targetSid = targetSid;
}
public void setSid(final Sid profileSid) {
this.profileSid = profileSid;
}
public void setDateCreated(final Date dateCreated) {
this.dateCreated = dateCreated;
}
}
@Override
public String toString() {
return "ProfileAssociation [profileSid=" + profileSid + ", targetSid=" + targetSid + ", dateCreated="
+ dateCreated + ", dateUpdated=" + dateUpdated + "]";
}
}
| 3,446 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MostOptimalNumberResponse.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MostOptimalNumberResponse.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2016, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package org.restcomm.connect.dao.entities;
/**
* @author [email protected] (Maria Farooq)
*/
public class MostOptimalNumberResponse {
private final IncomingPhoneNumber number;
private final boolean relevant;
/**
* @param number - number from db
* @param relevant - if this number belongs to proper organization as per restrictions or not
*/
public MostOptimalNumberResponse(IncomingPhoneNumber number, boolean relevant) {
super();
this.number = number;
this.relevant = relevant;
}
public IncomingPhoneNumber number() {
return number;
}
/**
* @return true if number belongs to proper organization as per restrictions, or false otherwise
*/
public boolean isRelevant() {
return relevant;
}
}
| 1,631 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
SmsMessage.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/SmsMessage.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Currency;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
import org.restcomm.connect.commons.dao.MessageError;
import org.restcomm.connect.commons.stream.StreamEvent;
/**
* @author [email protected] (Thomas Quintana)
* @author mariafarooq
*/
@Immutable
public class SmsMessage implements StreamEvent {
public static final int MAX_SIZE = 160;
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final DateTime dateSent;
private final Sid accountSid;
private final String sender;
private final String recipient;
private final String body;
private final Status status;
private final Direction direction;
private final BigDecimal price;
private final Currency priceUnit;
private final String apiVersion;
private final URI uri;
private final String smppMessageId;
private final URI statusCallback;
private final MessageError error;
private final String statusCallbackMethod;
public SmsMessage(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final DateTime dateSent,
final Sid accountSid, final String sender, final String recipient, final String body, final Status status,
final Direction direction, final BigDecimal price, final Currency priceUnit, final String apiVersion, final URI uri, final String smppMessageId,
final MessageError error, URI statusCallback,
String statusCallbackMethod) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.dateSent = dateSent;
this.accountSid = accountSid;
this.sender = sender;
this.recipient = recipient;
this.body = body;
this.status = status;
this.direction = direction;
this.price = price;
this.priceUnit = priceUnit;
this.apiVersion = apiVersion;
this.uri = uri;
this.smppMessageId = smppMessageId;
this.statusCallback = statusCallback;
this.statusCallbackMethod = statusCallbackMethod;
this.error = error;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public DateTime getDateSent() {
return dateSent;
}
public Sid getAccountSid() {
return accountSid;
}
public String getSender() {
return sender;
}
public String getRecipient() {
return recipient;
}
public String getBody() {
return body;
}
public Status getStatus() {
return status;
}
public Direction getDirection() {
return direction;
}
public BigDecimal getPrice() {
return (price == null) ? new BigDecimal("0.0") : price;
}
public Currency getPriceUnit() {
return (priceUnit == null) ? Currency.getInstance("USD") : priceUnit;
}
public String getApiVersion() {
return apiVersion;
}
public URI getUri() {
return uri;
}
public String getSmppMessageId() {
return smppMessageId;
}
public URI getStatusCallback() {
return statusCallback;
}
public String getStatusCallbackMethod() {
return statusCallbackMethod;
}
public MessageError getError() {
return error;
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private DateTime dateSent;
private Sid accountSid;
private String sender;
private String recipient;
private String body;
private Status status;
private Direction direction;
private BigDecimal price;
private Currency priceUnit;
private String apiVersion;
private URI uri;
private DateTime dateCreated;
private DateTime dateUpdated;
private String smppMessageId;
private URI statusCallback;
private String statusCallbackMethod = "POST";
private MessageError error;
private Builder() {
super();
}
public SmsMessage build() {
if (dateCreated == null) {
dateCreated = DateTime.now();
}
if (dateUpdated == null) {
dateUpdated = dateCreated;
}
return new SmsMessage(sid, dateCreated, dateUpdated, dateSent,
accountSid, sender, recipient, body, status, direction, price,
priceUnit, apiVersion, uri, smppMessageId, error, statusCallback,
statusCallbackMethod);
}
public Builder copyMessage(SmsMessage msg) {
this.accountSid = msg.accountSid;
this.sid = msg.sid;
this.dateCreated = msg.dateCreated;
this.dateUpdated = msg.dateUpdated;
this.dateSent = msg.dateSent;
this.accountSid = msg.accountSid;
this.sender = msg.sender;
this.recipient = msg.recipient;
this.body = msg.body;
this.status = msg.status;
this.direction = msg.direction;
this.price = msg.price;
this.priceUnit = msg.priceUnit;
this.apiVersion = msg.apiVersion;
this.uri = msg.uri;
this.smppMessageId = msg.smppMessageId;
this.error = msg.error;
this.statusCallback = msg.statusCallback;
this.statusCallbackMethod = msg.statusCallbackMethod;
return this;
}
public Builder setSid(final Sid sid) {
this.sid = sid;
return this;
}
public Builder setDateSent(final DateTime dateSent) {
this.dateSent = dateSent;
return this;
}
public Builder setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder setSender(final String sender) {
this.sender = sender;
return this;
}
public Builder setRecipient(final String recipient) {
this.recipient = recipient;
return this;
}
public Builder setBody(final String body) {
this.body = body;
return this;
}
public Builder setStatus(final Status status) {
this.status = status;
return this;
}
public Builder setDirection(final Direction direction) {
this.direction = direction;
return this;
}
public Builder setPrice(final BigDecimal price) {
this.price = price;
return this;
}
public Builder setPriceUnit(Currency priceUnit) {
this.priceUnit = priceUnit;
return this;
}
public Builder setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
return this;
}
public Builder setUri(final URI uri) {
this.uri = uri;
return this;
}
public Builder setDateCreated(DateTime dateCreated) {
this.dateCreated = dateCreated;
return this;
}
public Builder setDateUpdated(DateTime dateUpdated) {
this.dateUpdated = dateUpdated;
return this;
}
public Builder setSmppMessageId(String smppMessageId) {
this.smppMessageId = smppMessageId;
return this;
}
public Builder setStatusCallback(URI callback) {
this.statusCallback = callback;
return this;
}
public Builder setStatusCallbackMethod(String method) {
this.statusCallbackMethod = method;
return this;
}
public Builder setError(MessageError error) {
this.error = error;
return this;
}
}
public enum Direction {
INBOUND("inbound"), OUTBOUND_API("outbound-api"), OUTBOUND_CALL("outbound-call"), OUTBOUND_REPLY("outbound-reply");
private final String text;
private Direction(final String text) {
this.text = text;
}
public static Direction getDirectionValue(final String text) {
final Direction[] values = values();
for (final Direction value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid direction.");
}
@Override
public String toString() {
return text;
}
}
public enum Status {
QUEUED("queued"), SENDING("sending"), SENT("sent"), FAILED("failed"), RECEIVED("received"), DELIVERED("delivered"), UNDELIVERED("undelivered");
private final String text;
private Status(final String text) {
this.text = text;
}
public static Status getStatusValue(final String text) {
final Status[] values = values();
for (final Status value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid status.");
}
@Override
public String toString() {
return text;
}
}
}
| 10,765 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ConferenceDetailRecordFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ConferenceDetailRecordFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class ConferenceDetailRecordFilter {
private final String accountSid;
private final String status;
private final Date dateCreated;
private final Date dateUpdated;
private final String friendlyName;
private final Integer limit;
private final Integer offset;
public ConferenceDetailRecordFilter(String accountSid, String status, String dateCreated, String dateUpdated,
String friendlyName, Integer limit, Integer offset) throws ParseException {
this.accountSid = accountSid;
this.status = status;
this.friendlyName = friendlyName;
this.limit = limit;
this.offset = offset;
if (dateCreated != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(dateCreated);
this.dateCreated = date;
} else
this.dateCreated = null;
if (dateUpdated != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(dateUpdated);
this.dateUpdated = date;
} else
this.dateUpdated = null;
}
public String getSid() {
return accountSid;
}
public String getStatus() {
return status;
}
public String getFriendlyName() {
return friendlyName;
}
public Date getDateCreated() {
return dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
public int getLimit() {
return limit;
}
public int getOffset() {
return offset;
}
}
| 2,714 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ShortCode.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ShortCode.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class ShortCode {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String friendlyName;
private final Sid accountSid;
private final Integer shortCode;
private final String apiVersion;
private final URI smsUrl;
private final String smsMethod;
private final URI smsFallbackUrl;
private final String smsFallbackMethod;
private final URI uri;
public ShortCode(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String friendlyName,
final Sid accountSid, final Integer shortCode, final String apiVersion, final URI smsUrl, final String smsMethod,
final URI smsFallbackUrl, final String smsFallbackMethod, final URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.friendlyName = friendlyName;
this.accountSid = accountSid;
this.shortCode = shortCode;
this.apiVersion = apiVersion;
this.smsUrl = smsUrl;
this.smsMethod = smsMethod;
this.smsFallbackUrl = smsFallbackUrl;
this.smsFallbackMethod = smsFallbackMethod;
this.uri = uri;
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public String getFriendlyName() {
return friendlyName;
}
public Sid getAccountSid() {
return accountSid;
}
public Integer getShortCode() {
return shortCode;
}
public String getApiVersion() {
return apiVersion;
}
public URI getSmsUrl() {
return smsUrl;
}
public String getSmsMethod() {
return smsMethod;
}
public URI getSmsFallbackUrl() {
return smsFallbackUrl;
}
public String getSmsFallbackMethod() {
return smsFallbackMethod;
}
public URI getUri() {
return uri;
}
public ShortCode setApiVersion(final String apiVersion) {
return new ShortCode(sid, dateCreated, DateTime.now(), friendlyName, accountSid, shortCode, apiVersion, smsUrl,
smsMethod, smsFallbackUrl, smsFallbackMethod, uri);
}
public ShortCode setSmsUrl(final URI smsUrl) {
return new ShortCode(sid, dateCreated, DateTime.now(), friendlyName, accountSid, shortCode, apiVersion, smsUrl,
smsMethod, smsFallbackUrl, smsFallbackMethod, uri);
}
public ShortCode setSmsMethod(final String smsMethod) {
return new ShortCode(sid, dateCreated, DateTime.now(), friendlyName, accountSid, shortCode, apiVersion, smsUrl,
smsMethod, smsFallbackUrl, smsFallbackMethod, uri);
}
public ShortCode setSmsFallbackUrl(final URI smsFallbackUrl) {
return new ShortCode(sid, dateCreated, DateTime.now(), friendlyName, accountSid, shortCode, apiVersion, smsUrl,
smsMethod, smsFallbackUrl, smsFallbackMethod, uri);
}
public ShortCode setSmsFallbackMethod(final String smsFallbackMethod) {
return new ShortCode(sid, dateCreated, DateTime.now(), friendlyName, accountSid, shortCode, apiVersion, smsUrl,
smsMethod, smsFallbackUrl, smsFallbackMethod, uri);
}
}
| 4,475 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Gateway.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Gateway.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.io.Serializable;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Gateway implements Serializable {
private static final long serialVersionUID = 1L;
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String friendlyName;
private final String password;
private final String proxy;
private final Boolean register;
private final String userName;
private final int timeToLive;
private final URI uri;
public Gateway(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String friendlyName,
final String password, final String proxy, final Boolean register, final String userName, final int timeToLive,
final URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.friendlyName = friendlyName;
this.password = password;
this.proxy = proxy;
this.register = register;
this.userName = userName;
this.timeToLive = timeToLive;
this.uri = uri;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public String getFriendlyName() {
return friendlyName;
}
public String getPassword() {
return password;
}
public String getProxy() {
return proxy;
}
public String getUserName() {
return userName;
}
public boolean register() {
return register;
}
public int getTimeToLive() {
return timeToLive;
}
public URI getUri() {
return uri;
}
public Gateway setFriendlyName(final String friendlyName) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public Gateway setPassword(final String password) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public Gateway setProxy(final String proxy) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public Gateway setRegister(final boolean register) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public Gateway setUserName(final String userName) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public Gateway setTimeToLive(final int timeToLive) {
return new Gateway(sid, dateCreated, DateTime.now(), friendlyName, password, proxy, register, userName, timeToLive, uri);
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private String friendlyName;
private String password;
private String proxy;
private Boolean register;
private String userName;
private int timeToLive;
private URI uri;
private Builder() {
super();
}
public Gateway build() {
final DateTime now = DateTime.now();
return new Gateway(sid, now, now, friendlyName, password, proxy, register, userName, timeToLive, uri);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setPassword(final String password) {
this.password = password;
}
public void setProxy(final String proxy) {
this.proxy = proxy;
}
public void setRegister(final boolean register) {
this.register = register;
}
public void setUserName(final String userName) {
this.userName = userName;
}
public void setTimeToLive(final int timeToLive) {
this.timeToLive = timeToLive;
}
public void setUri(final URI uri) {
this.uri = uri;
}
}
}
| 5,572 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
GeolocationList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/GeolocationList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2013, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author <a href="mailto:[email protected]"> Fernando Mendioroz </a>
*
*/
@NotThreadSafe
public final class GeolocationList {
private final List<Geolocation> geolocations;
public GeolocationList(final List<Geolocation> geolocations) {
super();
this.geolocations = geolocations;
}
public List<Geolocation> getGeolocations() {
return geolocations;
}
}
| 1,483 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AnnouncementList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/AnnouncementList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author <a href="mailto:[email protected]">George Vagenas</a>
*/
@NotThreadSafe
public final class AnnouncementList {
private final List<Announcement> announcements;
public AnnouncementList(final List<Announcement> announcements) {
super();
this.announcements = announcements;
}
public List<Announcement> getAnnouncements() {
return announcements;
}
}
| 1,362 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Notification.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Notification.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Notification {
public static final int ERROR = 0;
public static final int WARNING = 1;
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final Sid callSid;
private final String apiVersion;
private final Integer log;
private final Integer errorCode;
private final URI moreInfo;
private final String messageText;
private final DateTime messageDate;
private final URI requestUrl;
private final String requestMethod;
private final String requestVariables;
private final String responseHeaders;
private final String responseBody;
private final URI uri;
public Notification(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final Sid accountSid,
final Sid callSid, final String apiVersion, final Integer log, final Integer errorCode, final URI moreInfo,
String messageText, final DateTime messageDate, final URI requestUrl, final String requestMethod,
final String requestVariables, final String responseHeaders, final String responseBody, final URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.callSid = callSid;
this.apiVersion = apiVersion;
this.log = log;
this.errorCode = errorCode;
this.moreInfo = moreInfo;
this.messageText = messageText;
this.messageDate = messageDate;
this.requestUrl = requestUrl;
this.requestMethod = requestMethod;
this.requestVariables = requestVariables;
this.responseHeaders = responseHeaders;
this.responseBody = responseBody;
this.uri = uri;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public Sid getCallSid() {
return callSid;
}
public String getApiVersion() {
return apiVersion;
}
public Integer getLog() {
return log;
}
public Integer getErrorCode() {
return errorCode;
}
public URI getMoreInfo() {
return moreInfo;
}
public String getMessageText() {
return messageText;
}
public DateTime getMessageDate() {
return messageDate;
}
public URI getRequestUrl() {
return requestUrl;
}
public String getRequestMethod() {
return requestMethod;
}
public String getRequestVariables() {
return requestVariables;
}
public String getResponseHeaders() {
return responseHeaders;
}
public String getResponseBody() {
return responseBody;
}
public URI getUri() {
return uri;
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private Sid accountSid;
private Sid callSid;
private String apiVersion;
private Integer log;
private Integer errorCode;
private URI moreInfo;
private String messageText;
private DateTime messageDate;
private URI requestUrl;
private String requestMethod;
private String requestVariables;
private String responseHeaders;
private String responseBody;
private URI uri;
private Builder() {
super();
}
public Notification build() {
final DateTime now = DateTime.now();
return new Notification(sid, now, now, accountSid, callSid, apiVersion, log, errorCode, moreInfo, messageText,
messageDate, requestUrl, requestMethod, requestVariables, responseHeaders, responseBody, uri);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setCallSid(final Sid callSid) {
this.callSid = callSid;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setLog(final int log) {
this.log = log;
}
public void setErrorCode(final int errorCode) {
this.errorCode = errorCode;
}
public void setMoreInfo(final URI moreInfo) {
this.moreInfo = moreInfo;
}
public void setMessageText(final String messageText) {
this.messageText = messageText;
}
public void setMessageDate(final DateTime messageDate) {
this.messageDate = messageDate;
}
public void setRequestUrl(final URI requestUrl) {
this.requestUrl = requestUrl;
}
public void setRequestMethod(final String requestMethod) {
this.requestMethod = requestMethod;
}
public void setRequestVariables(final String requestVariables) {
this.requestVariables = requestVariables;
}
public void setResponseHeaders(final String responseHeaders) {
this.responseHeaders = responseHeaders;
}
public void setResponseBody(final String responseBody) {
this.responseBody = responseBody;
}
public void setUri(final URI uri) {
this.uri = uri;
}
}
}
| 6,881 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OrganizationList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/OrganizationList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author maria farooq
*/
@NotThreadSafe
public final class OrganizationList {
private final List<Organization> organizations;
public OrganizationList(final List<Organization> organizations) {
super();
this.organizations = organizations;
}
/**
* @return list of organization
*/
public List<Organization> getOrganizations() {
return organizations;
}
}
| 1,372 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CallDetailRecord.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/CallDetailRecord.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Currency;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
* @author [email protected]
*/
@Immutable
public final class CallDetailRecord {
private final Sid sid;
private final String instanceId;
private final Sid parentCallSid;
private final Sid conferenceSid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final String to;
private final String from;
private final Sid phoneNumberSid;
private final String status;
private final DateTime startTime;
private final DateTime endTime;
private final Integer duration;
private final Integer ringDuration;
private final BigDecimal price;
private final Currency priceUnit;
private final String direction;
private final String answeredBy;
private final String apiVersion;
private final String forwardedFrom;
private final String callerName;
private final URI uri;
private final String callPath;
private final Boolean muted;
private final Boolean startConferenceOnEnter;
private final Boolean endConferenceOnExit;
private final Boolean onHold;
private final String msId;
public CallDetailRecord(final Sid sid, final String instanceId, final Sid parentCallSid, final Sid conferenceSid, final DateTime dateCreated, final DateTime dateUpdated,
final Sid accountSid, final String to, final String from, final Sid phoneNumberSid, final String status,
final DateTime startTime, final DateTime endTime, final Integer duration, final BigDecimal price,
final Currency priceUnit, final String direction, final String answeredBy, final String apiVersion,
final String forwardedFrom, final String callerName, final URI uri, final String callPath,final Integer ringDuration,
final Boolean muted, final Boolean startConferenceOnEnter, final Boolean endConferenceOnExit, final Boolean onHold, final String msId) {
super();
this.sid = sid;
this.instanceId = instanceId;
this.parentCallSid = parentCallSid;
this.conferenceSid = conferenceSid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.to = to;
this.from = from;
this.phoneNumberSid = phoneNumberSid;
this.status = status;
this.startTime = startTime;
this.endTime = endTime;
this.duration = duration;
this.price = price;
this.priceUnit = priceUnit;
this.direction = direction;
this.answeredBy = answeredBy;
this.apiVersion = apiVersion;
this.forwardedFrom = forwardedFrom;
this.callerName = callerName;
this.uri = uri;
this.callPath = callPath;
this.ringDuration = ringDuration;
this.muted = muted;
this.startConferenceOnEnter = startConferenceOnEnter;
this.endConferenceOnExit = endConferenceOnExit;
this.onHold = onHold;
this.msId = msId;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public String getInstanceId() { return instanceId; }
public Sid getParentCallSid() {
return parentCallSid;
}
public Sid getConferenceSid() {
return conferenceSid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public String getTo() {
return to;
}
public String getFrom() {
return from;
}
public Sid getPhoneNumberSid() {
return phoneNumberSid;
}
public String getStatus() {
return status;
}
public DateTime getStartTime() {
return startTime;
}
public DateTime getEndTime() {
return endTime;
}
public Integer getDuration() {
return duration;
}
public Integer getRingDuration() {
return ringDuration;
}
public BigDecimal getPrice() {
return (price == null) ? new BigDecimal("0.0") : price;
}
public Currency getPriceUnit() {
return (priceUnit == null) ? Currency.getInstance("USD") : priceUnit;
}
public String getDirection() {
return direction;
}
public String getAnsweredBy() {
return answeredBy;
}
public String getApiVersion() {
return apiVersion;
}
public String getForwardedFrom() {
return forwardedFrom;
}
public String getCallerName() {
return callerName;
}
public URI getUri() {
return uri;
}
public String getCallPath() {
return callPath;
}
public Boolean isMuted() {
return muted;
}
public Boolean isStartConferenceOnEnter() {
return startConferenceOnEnter;
}
public Boolean isEndConferenceOnExit() {
return endConferenceOnExit;
}
public Boolean isOnHold() {
return onHold;
}
public String getMsId() {
return msId;
}
public CallDetailRecord setStatus(final String status) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setStartTime(final DateTime startTime) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setEndTime(final DateTime endTime) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setDuration(final Integer duration) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setRingDuration(final Integer ringDuration) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setPrice(final BigDecimal price) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setAnsweredBy(final String answeredBy) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setConferenceSid(final Sid conferenceSid) {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setMuted(final Boolean muted){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setStartConferenceOnEnter(final Boolean startConferenceOnEnter){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setEndConferenceOnExit(final Boolean endConferenceOnExit){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setOnHold(final Boolean onHold){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setMsId(final String msId){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public CallDetailRecord setForwardedFrom(final String forwardedFrom){
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, DateTime.now(), accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
@Override
public String toString() {
return "CDR SID: "+getSid()+" | InstanceId: "+getInstanceId()+" | ParentCallSid: "+getParentCallSid()+" | ConferenceSid: "+getConferenceSid()+" | DateCreated: "+getDateCreated()+" | DateUpdated: "+getDateUpdated()+" | AccountSid: "+getAccountSid()+" | To: "+getTo()+" | From: "+getFrom()
+" | PhoneNumberSid: "+getPhoneNumberSid()+" | Status: "+getStatus()+" | StartTime: "+getStartTime()+" | EndTime: "+getEndTime()+" | Duration: "+getDuration()+" | Price: "+getPrice()+" | PriceUnit: "+getPriceUnit()+" | Direction: "+getDirection()+" | AnsweredBy: "+getAnsweredBy()
+" | ApiVersion: "+getApiVersion()+" | ForwaredFrom: "+getForwardedFrom()+" | CallerName: "+getCallerName()+" | Uri: "+getUri()+" | CallPath: "+getCallPath()+" | RingDuration: "+getRingDuration()+" | Muted: "+isMuted()+" | StartConferenceOnEnter: "+isStartConferenceOnEnter()
+" | isEndConferenceOnExit: "+ isEndConferenceOnExit()+" | isOnHold: "+isOnHold();
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private String instanceId;
private Sid parentCallSid;
private Sid conferenceSid;
private DateTime dateCreated;
private DateTime dateUpdated;
private Sid accountSid;
private String to;
private String from;
private Sid phoneNumberSid;
private String status;
private DateTime startTime;
private DateTime endTime;
private Integer duration;
private Integer ringDuration;
private BigDecimal price;
private Currency priceUnit;
private String direction;
private String answeredBy;
private String apiVersion;
private String forwardedFrom;
private String callerName;
private URI uri;
private String callPath;
private Boolean muted;
private Boolean startConferenceOnEnter;
private Boolean endConferenceOnExit;
private Boolean onHold;
private String msId;
private Builder() {
super();
sid = null;
instanceId = null;
parentCallSid = null;
conferenceSid = null;
dateCreated = null;
dateUpdated = DateTime.now();
accountSid = null;
to = null;
from = null;
phoneNumberSid = null;
status = null;
startTime = null;
endTime = null;
duration = null;
price = null;
direction = null;
answeredBy = null;
apiVersion = null;
forwardedFrom = null;
callerName = null;
uri = null;
callPath = null;
ringDuration = null;
muted = null;
startConferenceOnEnter = null;
endConferenceOnExit = null;
onHold = null;
msId = null;
}
public CallDetailRecord build() {
return new CallDetailRecord(sid, instanceId, parentCallSid, conferenceSid, dateCreated, dateUpdated, accountSid, to, from, phoneNumberSid,
status, startTime, endTime, duration, price, priceUnit, direction, answeredBy, apiVersion, forwardedFrom,
callerName, uri, callPath, ringDuration, muted, startConferenceOnEnter, endConferenceOnExit, onHold, msId);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setInstanceId(final String instanceId) { this.instanceId = instanceId; }
public void setParentCallSid(final Sid parentCallSid) {
this.parentCallSid = parentCallSid;
}
public void setConferenceSid(final Sid conferenceSid) {
this.conferenceSid = conferenceSid;
}
public void setDateCreated(final DateTime dateCreated) {
this.dateCreated = dateCreated;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setTo(final String to) {
this.to = to;
}
public void setFrom(final String from) {
this.from = from;
}
public void setPhoneNumberSid(final Sid phoneNumberSid) {
this.phoneNumberSid = phoneNumberSid;
}
public void setStatus(final String status) {
this.status = status;
}
public void setStartTime(final DateTime startTime) {
this.startTime = startTime;
}
public void setEndTime(final DateTime endTime) {
this.endTime = endTime;
}
public void setDuration(final Integer duration) {
this.duration = duration;
}
public void setPrice(final BigDecimal price) {
this.price = price;
}
public void setPriceUnit(final Currency priceUnit) {
this.priceUnit = priceUnit;
}
public void setDirection(final String direction) {
this.direction = direction;
}
public void setAnsweredBy(final String answeredBy) {
this.answeredBy = answeredBy;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setForwardedFrom(final String forwardedFrom) {
this.forwardedFrom = forwardedFrom;
}
public void setCallerName(final String callerName) {
this.callerName = callerName;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setCallPath(final String callPath) {
this.callPath = callPath;
}
public void setMuted(final Boolean muted) {
this.muted = muted;
}
public void setStartConferenceOnEnter(final Boolean startConferenceOnEnter) {
this.startConferenceOnEnter = startConferenceOnEnter;
}
public void setEndConferenceOnExit(final Boolean endConferenceOnExit) {
this.endConferenceOnExit = endConferenceOnExit;
}
public void setOnHold(final Boolean onHold) {
this.onHold = onHold;
}
public void setMsId(final String msId) {
this.msId = msId;
}
}
}
| 19,391 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RecordingFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/RecordingFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.dao.common.Sorting;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @author <a href="mailto:[email protected]">vunguyen</a>
*/
public class RecordingFilter {
private final String accountSid;
private final List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private final Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private final Date endTime;
private final String callSid;
private final Integer limit;
private final Integer offset;
private final String instanceid;
private final Sorting.Direction sortByDate;
private final Sorting.Direction sortByDuration;
private final Sorting.Direction sortByCallSid;
public RecordingFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime,
String callSid, Integer limit, Integer offset) throws ParseException {
this(accountSid, accountSidSet, startTime,endTime, callSid, limit,offset, null, null, null, null);
}
public RecordingFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime,
String callSid, Integer limit, Integer offset, String instanceId, Sorting.Direction sortByDate,
Sorting.Direction sortByDuration, Sorting.Direction sortByCallSid) throws ParseException {
this.accountSid = accountSid;
this.accountSidSet = accountSidSet;
this.callSid = callSid;
this.limit = limit;
this.offset = offset;
if (startTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(startTime);
this.startTime = date;
} else
this.startTime = null;
if (endTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(endTime);
this.endTime = date;
} else {
this.endTime = null;
}
if (instanceId != null && !instanceId.isEmpty()) {
this.instanceid = instanceId;
} else {
this.instanceid = null;
}
this.sortByDate = sortByDate;
this.sortByDuration = sortByDuration;
this.sortByCallSid = sortByCallSid;
}
public String getSid() {
return accountSid;
}
public List<String> getAccountSidSet() {
return accountSidSet;
}
public String getCallSid() {
return callSid;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public Integer getLimit() {
return limit;
}
public Integer getOffset() {
return offset;
}
public String getInstanceid() { return instanceid; }
public Sorting.Direction getSortByDate() { return sortByDate; }
public Sorting.Direction getSortByDuration() { return sortByDuration; }
public Sorting.Direction getSortByCallSid() { return sortByCallSid; }
public static final class Builder {
private String accountSid = null;
private List<String> accountSidSet = null;
private String startTime = null;
private String endTime = null;
private String callSid = null;
private String instanceid = null;
private Sorting.Direction sortByDate = null;
private Sorting.Direction sortByDuration = null;
private Sorting.Direction sortByCallSid = null;
private Integer limit = null;
private Integer offset = null;
public static RecordingFilter.Builder builder() {
return new RecordingFilter.Builder();
}
public RecordingFilter build() throws ParseException {
return new RecordingFilter(accountSid,
accountSidSet,
startTime,
endTime,
callSid,
limit,
offset,
instanceid,
sortByDate,
sortByDuration,
sortByCallSid);
}
// Filters
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byAccountSidSet(List<String> accountSidSet) {
this.accountSidSet = accountSidSet;
return this;
}
public Builder byStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public Builder byEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public Builder byCallSid(String callSid) {
this.callSid = callSid;
return this;
}
public Builder byInstanceId(String instanceid) {
this.instanceid = instanceid;
return this;
}
// Sorters
public Builder sortedByDate(Sorting.Direction sortDirection) {
this.sortByDate = sortDirection;
return this;
}
public Builder sortedByDuration(Sorting.Direction sortDirection) {
this.sortByDuration = sortDirection;
return this;
}
public Builder sortedByCallSid(Sorting.Direction sortDirection) {
this.sortByCallSid = sortDirection;
return this;
}
// Paging
public Builder limited(Integer limit, Integer offset) {
this.limit = limit;
this.offset = offset;
return this;
}
}
}
| 6,660 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OutgoingCallerId.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/OutgoingCallerId.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class OutgoingCallerId {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String friendlyName;
private final Sid accountSid;
private final String phoneNumber;
private final URI uri;
public OutgoingCallerId(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String friendlyName,
final Sid accountSid, final String phoneNumber, final URI uri) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.friendlyName = friendlyName;
this.accountSid = accountSid;
this.phoneNumber = phoneNumber;
this.uri = uri;
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public String getFriendlyName() {
return friendlyName;
}
public Sid getAccountSid() {
return accountSid;
}
public String getPhoneNumber() {
return phoneNumber;
}
public URI getUri() {
return uri;
}
public OutgoingCallerId setFriendlyName(final String friendlyName) {
return new OutgoingCallerId(sid, dateCreated, DateTime.now(), friendlyName, accountSid, phoneNumber, uri);
}
}
| 2,522 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
UsageList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/UsageList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Alexandre Mendonca)
*/
@NotThreadSafe
public final class UsageList {
private final List<Usage> usages;
public UsageList(final List<Usage> usages) {
super();
this.usages = usages;
}
public List<Usage> getUsages() {
return usages;
}
}
| 1,249 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaResourceBrokerEntity.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MediaResourceBrokerEntity.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public final class MediaResourceBrokerEntity {
private final Sid conferenceSid;
private String slaveMsId;
private String slaveMsBridgeEpId;
private String slaveMsCnfEpId;
private boolean isBridgedTogether;
public MediaResourceBrokerEntity(final Sid conferenceSid, final String slaveMsId, final String slaveMsBridgeEpId,
final String slaveMsCnfEpId, final Boolean isBridgedTogether) {
super();
this.conferenceSid = conferenceSid;
this.slaveMsId = slaveMsId;
this.slaveMsBridgeEpId = slaveMsBridgeEpId;
this.slaveMsCnfEpId = slaveMsCnfEpId;
this.isBridgedTogether = isBridgedTogether;
}
public static Builder builder() {
return new Builder();
}
public Sid getConferenceSid() {
return conferenceSid;
}
public String getSlaveMsId() {
return slaveMsId;
}
public String getSlaveMsBridgeEpId() {
return slaveMsBridgeEpId;
}
public String getSlaveMsCnfEpId() {
return slaveMsCnfEpId;
}
public boolean isBridgedTogether() {
return isBridgedTogether;
}
@NotThreadSafe
public static final class Builder {
private Sid conferenceSid;
private String slaveMsId;
private String slaveMsBridgeEpId;
private String slaveMsCnfEpId;
private boolean isBridgedTogether;
private Builder() {
super();
conferenceSid = null;
slaveMsId = null;
slaveMsBridgeEpId = null;
slaveMsCnfEpId = null;
}
public MediaResourceBrokerEntity build() {
return new MediaResourceBrokerEntity(conferenceSid, slaveMsId, slaveMsBridgeEpId, slaveMsCnfEpId, isBridgedTogether);
}
public void setConferenceSid(Sid conferenceSid) {
this.conferenceSid = conferenceSid;
}
public void setSlaveMsId(String slaveMsId) {
this.slaveMsId = slaveMsId;
}
public void setSlaveMsBridgeEpId(String slaveMsBridgeEpId) {
this.slaveMsBridgeEpId = slaveMsBridgeEpId;
}
public void setSlaveMsCnfEpId(String slaveMsCnfEpId) {
this.slaveMsCnfEpId = slaveMsCnfEpId;
}
public void setBridgedTogether(boolean isBridgedTogether) {
this.isBridgedTogether = isBridgedTogether;
}
}
}
| 3,514 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ConferenceDetailRecordList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ConferenceDetailRecordList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Maria Farooq)
*/
@NotThreadSafe
public final class ConferenceDetailRecordList {
private final List<ConferenceDetailRecord> cdrs;
public ConferenceDetailRecordList(final List<ConferenceDetailRecord> cdrs) {
super();
this.cdrs = cdrs;
}
public List<ConferenceDetailRecord> getConferenceDetailRecords() {
return cdrs;
}
}
| 1,359 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ClientList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ClientList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class ClientList {
private final List<Client> clients;
public ClientList(final List<Client> clients) {
super();
this.clients = clients;
}
public List<Client> getClients() {
return clients;
}
}
| 1,285 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaAttributes.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MediaAttributes.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2017, Telestax Inc and individual contributors
* by the @authors tag.
*
* This 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 software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* Gathers media attributes that are used to create a media session.
*
* @author [email protected]
*/
@Immutable
public class MediaAttributes {
private final MediaType mediaType;
// video attributes
private final VideoMode videoMode;
private final VideoResolution videoResolution;
private final VideoLayout videoLayout;
private final String videoOverlay;
/**
* Constructor for audio-only media sessions
*/
public MediaAttributes() {
this.mediaType = MediaType.AUDIO_ONLY;
this.videoMode = null;
this.videoResolution = null;
this.videoLayout = null;
this.videoOverlay = null;
}
/**
* Constructor for audio-video or video-only media sessions (conference calls)
*
* @param mediaType
* @param videoMode
* @param videoResolution
* @param videoLayout
* @param videoOverlay
*/
public MediaAttributes(final MediaType mediaType, final VideoMode videoMode, final VideoResolution videoResolution,
final VideoLayout videoLayout, final String videoOverlay) {
if (MediaType.AUDIO_ONLY.equals(mediaType)) {
throw new IllegalArgumentException("Informed mediaType is not compatible with video.");
}
this.mediaType = mediaType;
this.videoMode = videoMode;
this.videoResolution = videoResolution;
this.videoLayout = videoLayout;
this.videoOverlay = videoOverlay;
}
/**
* Constructor for audio-video or video-only media sessions (outbound calls / fork)
*
* @param mediaType
* @param videoResolution
*/
public MediaAttributes(final MediaType mediaType, final VideoResolution videoResolution){
this(mediaType, null, videoResolution, null, null);
}
public MediaType getMediaType() {
return mediaType;
}
public VideoMode getVideoMode() {
return videoMode;
}
public VideoResolution getVideoResolution() {
return videoResolution;
}
public VideoLayout getVideoLayout() {
return videoLayout;
}
public String getVideoOverlay() {
return videoOverlay;
}
public enum MediaType {
AUDIO_ONLY("audio_only", new String[] {"audio"}),
VIDEO_ONLY("video_only", new String[] {"video"}),
AUDIO_VIDEO("audio_video", new String[] {"audio", "video"});
private final String text;
private final String[] codecPolicy;
MediaType(final String text, final String[] codecPolicy) {
this.text = text;
this.codecPolicy = codecPolicy;
}
public static MediaType getValueOf(final String text) {
MediaType[] values = values();
for (final MediaType value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid media type.");
}
@Override
public String toString() {
return text;
}
public String[] getCodecPolicy() {
return codecPolicy;
}
}
public enum VideoMode {
MCU("mcu"), SFU("sfu");
final String text;
VideoMode(final String text) {
this.text = text;
}
public static VideoMode getValueOf(final String text) {
VideoMode[] values = values();
for (final VideoMode value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid video mode.");
}
@Override
public String toString() {
return this.text;
}
}
public enum VideoResolution {
CIF("CIF"), FOUR_CIF("4CIF"), SIXTEEN_CIF("16CIF"), QCIF("QCIF"), VGA("VGA"), SEVEN_TWENTY_P("720p");
final String text;
VideoResolution(final String text) {
this.text = text;
}
public static VideoResolution getValueOf(final String text) {
VideoResolution[] values = values();
for (final VideoResolution value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid video resolution.");
}
@Override
public String toString() {
return this.text;
}
}
public enum VideoLayout {
LINEAR("linear"), TILE("tile");
final String text;
VideoLayout(final String text) {
this.text = text;
}
public static VideoLayout getValueOf(final String text) {
VideoLayout[] values = values();
for (final VideoLayout value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid video layout.");
}
@Override
public String toString() {
return this.text;
}
}
}
| 6,296 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
IncomingPhoneNumberFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/IncomingPhoneNumberFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.dao.common.Sorting;
/**
* @author <a href="mailto:[email protected]">Jean Deruelle</a>
*/
@Immutable
public class IncomingPhoneNumberFilter {
private final String accountSid;
private final String friendlyName;
private final String phoneNumber;
private final Sorting.Direction sortByNumber;
private final Sorting.Direction sortByFriendly;
private final Integer limit;
private final Integer offset;
private final String orgSid;
private final Boolean pureSIP;
private SearchFilterMode filterMode;
private IncomingPhoneNumberFilter(String accountSid, String friendlyName, String phoneNumber,
Sorting.Direction sortByNumber,Sorting.Direction sortByFriendly, Integer limit, Integer offset, String orgSid, Boolean pureSIP, SearchFilterMode filterMode) {
this.accountSid = accountSid;
this.friendlyName = friendlyName;
this.phoneNumber = phoneNumber;
this.sortByNumber = sortByNumber;
this.sortByFriendly = sortByFriendly;
this.limit = limit;
this.offset = offset;
this.orgSid = orgSid;
this.pureSIP = pureSIP;
this.filterMode = filterMode;
}
public IncomingPhoneNumberFilter(String accountSid, String friendlyName, String phoneNumber) {
this.accountSid = accountSid;
this.friendlyName = friendlyName;
this.phoneNumber = phoneNumber;
this.sortByNumber = null;
this.sortByFriendly = null;
this.offset = null;
this.limit = null;
this.orgSid = null;
this.pureSIP = null;
this.filterMode = SearchFilterMode.PERFECT_MATCH;
}
public String getAccountSid() {
return accountSid;
}
/**
* @return the friendlyName
*/
public String getFriendlyName() {
return friendlyName;
}
/**
* @return the phoneNumber
*/
public String getPhoneNumber() {
return phoneNumber;
}
public Sorting.Direction getSortByNumber() {
return sortByNumber;
}
public Sorting.Direction getSortByFriendly() {
return sortByFriendly;
}
/**
* @return the limit
*/
public Integer getLimit() {
return limit;
}
/**
* @return the offset
*/
public Integer getOffset() {
return offset;
}
public String getOrgSid() {
return orgSid;
}
public Boolean getPureSIP() {
return pureSIP;
}
public SearchFilterMode getFilterMode() {
return filterMode;
}
@Override
public String toString() {
return "IncomingPhoneNumberFilter{" + "accountSid=" + accountSid + ", friendlyName=" + friendlyName + ", phoneNumber=" + phoneNumber + ", sortByNumber=" + sortByNumber + ", limit=" + limit + ", offset=" + offset + ", orgSid=" + orgSid + ", pureSIP=" + pureSIP + '}';
}
public static final class Builder {
private String accountSid = null;
private String friendlyName = null;
private String phoneNumber = null;
private Sorting.Direction sortByPhoneNumber = null;
private Sorting.Direction sortByFriendly = null;
private Integer limit = null;
private Integer offset = null;
private String orgSid = null;
private Boolean pureSIP = null;
private SearchFilterMode filterMode = SearchFilterMode.PERFECT_MATCH;
public static IncomingPhoneNumberFilter.Builder builder() {
return new IncomingPhoneNumberFilter.Builder();
}
/**
* Prepare fields with SQL wildcards
*
* @param value
* @return
*/
private String convertIntoSQLWildcard(String value) {
String wildcarded = value;
// The LIKE keyword uses '%' to match any (including 0) number of characters, and '_' to match exactly one character
// Add here the '%' keyword so +15126002188 will be the same as 15126002188 and 6002188
if (wildcarded != null) {
wildcarded = "%" + wildcarded + "%";
}
return wildcarded;
}
public IncomingPhoneNumberFilter build() {
if (filterMode.equals(SearchFilterMode.WILDCARD_MATCH)) {
phoneNumber = convertIntoSQLWildcard(phoneNumber);
friendlyName = convertIntoSQLWildcard(friendlyName);
}
return new IncomingPhoneNumberFilter(accountSid,
friendlyName,
phoneNumber,
sortByPhoneNumber,
sortByFriendly,
limit,
offset,
orgSid,
pureSIP,
filterMode);
}
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byPureSIP(Boolean pureSIP) {
this.pureSIP = pureSIP;
return this;
}
public Builder byFriendlyName(String friendlyName) {
this.friendlyName = friendlyName;
return this;
}
public Builder byPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
public Builder sortedByPhoneNumber(Sorting.Direction sortDirection) {
this.sortByPhoneNumber = sortDirection;
return this;
}
public Builder sortedByfriendly(Sorting.Direction sortDirection) {
this.sortByFriendly = sortDirection;
return this;
}
public Builder usingMode(SearchFilterMode mode) {
this.filterMode = mode;
return this;
}
public Builder limited(Integer limit, Integer offset) {
this.limit = limit;
this.offset = offset;
return this;
}
public Builder byOrgSid(String orgSid) {
this.orgSid = orgSid;
return this;
}
}
}
| 7,017 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaResourceBrokerEntityFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MediaResourceBrokerEntityFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class MediaResourceBrokerEntityFilter {
private final String conferenceSid;
private String slaveMsId;
public MediaResourceBrokerEntityFilter(String conferenceSid, String slaveMsId) {
this.conferenceSid = conferenceSid;
this.slaveMsId = slaveMsId;
}
public String getConferenceSid() {
return conferenceSid;
}
public String getSlaveMsId() {
return slaveMsId;
}
}
| 1,435 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Application.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Application.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import java.util.List;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* Represents a RestComm application
*
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class Application {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final String friendlyName;
private final Sid accountSid;
private final String apiVersion;
private final Boolean hasVoiceCallerIdLookup;
private final URI uri;
private final URI rcmlUrl;
private final Kind kind;
private List<ApplicationNumberSummary> numbers;
public Application(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String friendlyName,
final Sid accountSid, final String apiVersion, final Boolean hasVoiceCallerIdLookup, final URI uri,
final URI rcmlUrl, Kind kind) {
this(sid, dateCreated, dateUpdated, friendlyName, accountSid, apiVersion,hasVoiceCallerIdLookup,uri,rcmlUrl,kind,null);
}
public Application(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final String friendlyName,
final Sid accountSid, final String apiVersion, final Boolean hasVoiceCallerIdLookup, final URI uri,
final URI rcmlUrl, Kind kind, List<ApplicationNumberSummary> numbers) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.friendlyName = friendlyName;
this.accountSid = accountSid;
this.apiVersion = apiVersion;
this.hasVoiceCallerIdLookup = hasVoiceCallerIdLookup;
this.uri = uri;
this.rcmlUrl = rcmlUrl;
this.kind = kind;
this.numbers = numbers;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public String getFriendlyName() {
return friendlyName;
}
public Sid getAccountSid() {
return accountSid;
}
public String getApiVersion() {
return apiVersion;
}
public Boolean hasVoiceCallerIdLookup() {
return hasVoiceCallerIdLookup;
}
public URI getUri() {
return uri;
}
public URI getRcmlUrl() {
return rcmlUrl;
}
public Kind getKind() {
return kind;
}
public List<ApplicationNumberSummary> getNumbers() {
return numbers;
}
public Application setFriendlyName(final String friendlyName) {
return new Application(sid, dateCreated, DateTime.now(), friendlyName, accountSid, apiVersion, hasVoiceCallerIdLookup,
uri, rcmlUrl, kind);
}
public Application setVoiceCallerIdLookup(final boolean hasVoiceCallerIdLookup) {
return new Application(sid, dateCreated, DateTime.now(), friendlyName, accountSid, apiVersion, hasVoiceCallerIdLookup,
uri, rcmlUrl, kind);
}
public Application setRcmlUrl(final URI rcmlUrl) {
return new Application(sid, dateCreated, DateTime.now(), friendlyName, accountSid, apiVersion, hasVoiceCallerIdLookup,
uri, rcmlUrl, kind);
}
public Application setKind(final Kind kind) {
return new Application(sid, dateCreated, DateTime.now(), friendlyName, accountSid, apiVersion, hasVoiceCallerIdLookup,
uri, rcmlUrl, kind);
}
public void setNumbers(List<ApplicationNumberSummary> numbers) {
this.numbers = numbers;
}
public enum Kind {
VOICE("voice"), SMS("sms"), USSD("ussd");
private final String text;
private Kind(final String text) {
this.text = text;
}
public static Kind getValueOf(final String text) {
Kind[] values = values();
for (final Kind value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid application kind.");
}
@Override
public String toString() {
return text;
}
};
public static final class Builder {
private Sid sid;
private String friendlyName;
private Sid accountSid;
private String apiVersion;
private Boolean hasVoiceCallerIdLookup;
private URI uri;
private URI rcmlUrl;
private Kind kind;
private Builder() {
super();
}
public Application build() {
final DateTime now = DateTime.now();
return new Application(sid, now, now, friendlyName, accountSid, apiVersion, hasVoiceCallerIdLookup, uri, rcmlUrl,
kind);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setHasVoiceCallerIdLookup(final boolean hasVoiceCallerIdLookup) {
this.hasVoiceCallerIdLookup = hasVoiceCallerIdLookup;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setRcmlUrl(final URI rcmlUrl) {
this.rcmlUrl = rcmlUrl;
}
public void setKind(final Kind kind) {
this.kind = kind;
}
}
}
| 6,798 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
TranscriptionList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/TranscriptionList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class TranscriptionList {
private final List<Transcription> transcriptions;
public TranscriptionList(final List<Transcription> transcriptions) {
super();
this.transcriptions = transcriptions;
}
public List<Transcription> getTranscriptions() {
return transcriptions;
}
}
| 1,362 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RegistrationList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/RegistrationList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class RegistrationList {
private final List<Registration> registrations;
public RegistrationList(final List<Registration> records) {
super();
this.registrations = records;
}
public List<Registration> getRegistrations() {
return registrations;
}
}
| 1,339 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
SmsMessageFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/SmsMessageFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.dao.common.Sorting;
/**
* @author <a href="mailto:[email protected]">vunguyen</a>
*/
@Immutable
public class SmsMessageFilter {
private final String accountSid;
private final List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private final String recipient;
private final String sender;
private final String status;
private final Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private final Date endTime;
private final String body;
private final Integer limit;
private final Integer offset;
private final String instanceid;
private final Sorting.Direction sortByDate;
private final Sorting.Direction sortByFrom;
private final Sorting.Direction sortByTo;
private final Sorting.Direction sortByDirection;
private final Sorting.Direction sortByStatus;
private final Sorting.Direction sortByBody;
private final Sorting.Direction sortByPrice;
public SmsMessageFilter(String accountSid, List<String> accountSidSet, String recipient, String sender, String status, String startTime, String endTime,
String body, Integer limit, Integer offset) throws ParseException {
this(accountSid, accountSidSet, recipient,sender, status, startTime, endTime, body, limit,offset, null, null,
null, null, null, null, null, null);
}
public SmsMessageFilter(String accountSid, List<String> accountSidSet, String recipient, String sender, String status, String startTime, String endTime,
String body, Integer limit, Integer offset, String instanceId, Sorting.Direction sortByDate,
Sorting.Direction sortByFrom, Sorting.Direction sortByTo, Sorting.Direction sortByDirection, Sorting.Direction sortByStatus, Sorting.Direction sortByBody,
Sorting.Direction sortByPrice) throws ParseException {
this.accountSid = accountSid;
this.accountSidSet = accountSidSet;
// The LIKE keyword uses '%' to match any (including 0) number of characters, and '_' to match exactly one character
// Add here the '%' keyword so +15126002188 will be the same as 15126002188 and 6002188
if (recipient != null)
recipient = "%".concat(recipient);
if (sender != null)
sender = "%".concat(sender);
this.recipient = recipient;
this.sender = sender;
this.status = status;
this.body = body;
this.limit = limit;
this.offset = offset;
if (startTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(startTime);
this.startTime = date;
} else
this.startTime = null;
if (endTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(endTime);
this.endTime = date;
} else {
this.endTime = null;
}
if (instanceId != null && !instanceId.isEmpty()) {
this.instanceid = instanceId;
} else {
this.instanceid = null;
}
this.sortByDate = sortByDate;
this.sortByFrom = sortByFrom;
this.sortByTo = sortByTo;
this.sortByDirection = sortByDirection;
this.sortByStatus = sortByStatus;
this.sortByBody = sortByBody;
this.sortByPrice = sortByPrice;
}
public String getSid() {
return accountSid;
}
public List<String> getAccountSidSet() {
return accountSidSet;
}
public String getRecipient() {
return recipient;
}
public String getSender() {
return sender;
}
public String getStatus() {
return status;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public String getBody() {
return body;
}
public Integer getLimit() {
return limit;
}
public int getOffset() {
return offset;
}
public String getInstanceid() { return instanceid; }
public Sorting.Direction getSortByDate() { return sortByDate; }
public Sorting.Direction getSortByFrom() { return sortByFrom; }
public Sorting.Direction getSortByTo() { return sortByTo; }
public Sorting.Direction getSortByDirection() { return sortByDirection; }
public Sorting.Direction getSortByStatus() { return sortByStatus; }
public Sorting.Direction getSortByBody() { return sortByBody; }
public Sorting.Direction getSortByPrice() { return sortByPrice; }
public static final class Builder {
private String accountSid = null;
private List<String> accountSidSet = null;
private String recipient = null;
private String sender = null;
private String status = null;
private String startTime = null;
private String endTime = null;
private String body;
private String instanceid = null;
private Sorting.Direction sortByDate = null;
private Sorting.Direction sortByFrom = null;
private Sorting.Direction sortByTo = null;
private Sorting.Direction sortByDirection = null;
private Sorting.Direction sortByStatus = null;
private Sorting.Direction sortByBody = null;
private Sorting.Direction sortByPrice = null;
private Integer limit = null;
private Integer offset = null;
public static SmsMessageFilter.Builder builder() {
return new SmsMessageFilter.Builder();
}
public SmsMessageFilter build() throws ParseException {
return new SmsMessageFilter(accountSid,
accountSidSet,
recipient,
sender,
status,
startTime,
endTime,
body,
limit,
offset,
instanceid,
sortByDate,
sortByFrom,
sortByTo,
sortByDirection,
sortByStatus,
sortByBody,
sortByPrice);
}
// Filters
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byAccountSidSet(List<String> accountSidSet) {
this.accountSidSet = accountSidSet;
return this;
}
public Builder byRecipient(String recipient) {
this.recipient = recipient;
return this;
}
public Builder bySender(String sender) {
this.sender = sender;
return this;
}
public Builder byStatus(String status) {
this.status = status;
return this;
}
public Builder byStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public Builder byEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public Builder byBody(String body) {
this.body = body;
return this;
}
public Builder byInstanceId(String instanceid) {
this.instanceid = instanceid;
return this;
}
// Sorters
public Builder sortedByDate(Sorting.Direction sortDirection) {
this.sortByDate = sortDirection;
return this;
}
public Builder sortedByFrom(Sorting.Direction sortDirection) {
this.sortByFrom = sortDirection;
return this;
}
public Builder sortedByTo(Sorting.Direction sortDirection) {
this.sortByTo = sortDirection;
return this;
}
public Builder sortedByDirection(Sorting.Direction sortDirection) {
this.sortByDirection = sortDirection;
return this;
}
public Builder sortedByStatus(Sorting.Direction sortDirection) {
this.sortByStatus = sortDirection;
return this;
}
public Builder sortedByBody(Sorting.Direction sortDirection) {
this.sortByBody = sortDirection;
return this;
}
public Builder sortedByPrice(Sorting.Direction sortDirection) {
this.sortByPrice = sortDirection;
return this;
}
// Paging
public Builder limited(Integer limit, Integer offset) {
this.limit = limit;
this.offset = offset;
return this;
}
}
} | 9,876 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CallStatus.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/CallStatus.java | package org.restcomm.connect.dao.entities;
/**
* @author <a href="mailto:[email protected]">gvagenas</a>
*/
public enum CallStatus {
// May be queued, ringing, in-progress, canceled, completed, failed, busy, or no-answer
QUEUED, RINGING, INPROGRESS, CANCELED, COMPLETED, FAILED, BUSY, NOANSWER;
}
| 311 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ConferenceDetailRecord.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ConferenceDetailRecord.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public final class ConferenceDetailRecord {
private final Sid sid;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Sid accountSid;
private final String status;
private final String friendlyName;
private final String apiVersion;
private final URI uri;
private final String masterMsId;
private final boolean masterPresent;
private final String masterConfernceEndpointId;
private final String masterIVREndpointId;
private final String masterIVREndpointSessionId;
private final String masterBridgeEndpointId;
private final String masterBridgeEndpointSessionId;
private final String masterBridgeConnectionIdentifier;
private final String masterIVRConnectionIdentifier;
private final boolean moderatorPresent;
public ConferenceDetailRecord(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated, final Sid accountSid,
final String status, final String friendlyName, final String apiVersion, final URI uri, final String msId,
final String masterConfernceEndpointId, final boolean isMasterPresent, final String masterIVREndpointId, final String masterIVREndpointSessionId,
final String masterBridgeEndpointId, final String masterBridgeEndpointSessionId, final String masterBridgeConnectionIdentifier,
final String masterIVRConnectionIdentifier, final boolean moderatorPresent) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.accountSid = accountSid;
this.status = status;
this.friendlyName = friendlyName;
this.apiVersion = apiVersion;
this.uri = uri;
this.masterMsId = msId;
this.masterConfernceEndpointId = masterConfernceEndpointId;
this.masterPresent = isMasterPresent;
this.masterIVREndpointId = masterIVREndpointId;
this.masterIVREndpointSessionId = masterIVREndpointSessionId;
this.masterBridgeEndpointId = masterBridgeEndpointId;
this.masterBridgeEndpointSessionId = masterBridgeEndpointSessionId;
this.masterBridgeConnectionIdentifier = masterBridgeConnectionIdentifier;
this.masterIVRConnectionIdentifier = masterIVRConnectionIdentifier;
this.moderatorPresent = moderatorPresent;
}
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Sid getAccountSid() {
return accountSid;
}
public String getStatus() {
return status;
}
public String getFriendlyName() {
return friendlyName;
}
public String getApiVersion() {
return apiVersion;
}
public URI getUri() {
return uri;
}
public String getMasterMsId() {
return masterMsId;
}
public String getMasterConferenceEndpointId() {
return masterConfernceEndpointId;
}
public String getMasterBridgeEndpointId() {
return masterBridgeEndpointId;
}
public String getMasterIVREndpointId() {
return masterIVREndpointId;
}
public String getMasterIVREndpointSessionId() {
return masterIVREndpointSessionId;
}
public String getMasterBridgeEndpointSessionId() {
return masterBridgeEndpointSessionId;
}
public boolean isMasterPresent() {
return masterPresent;
}
public String getMasterBridgeConnectionIdentifier() {
return masterBridgeConnectionIdentifier;
}
public String getMasterIVRConnectionIdentifier() {
return masterIVRConnectionIdentifier;
}
public boolean isModeratorPresent() {
return moderatorPresent;
}
public ConferenceDetailRecord setStatus(final String status) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterConfernceEndpointId(final String masterConfernceEndpointId) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterIVREndpointId(final String masterIVREndpointId) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterIVREndpointSessionId(final String masterIVREndpointSessionId) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterBridgeEndpointSessionId(final String masterBridgeEndpointSessionId) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterBridgeEndpointId(final String masterBridgeEndpointId) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterBridgeConnectionIdentifier(final String masterBridgeConnectionIdentifier) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterIVRConnectionIdentifier(final String masterIVRConnectionIdentifier) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setMasterPresent(final boolean masterPresent) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
public ConferenceDetailRecord setModeratorPresent(final boolean moderatorPresent) {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid, status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, masterPresent, masterIVREndpointId, masterIVREndpointSessionId, masterBridgeEndpointId, masterBridgeEndpointSessionId, masterBridgeConnectionIdentifier, masterIVRConnectionIdentifier, moderatorPresent);
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private DateTime dateCreated;
private Sid accountSid;
private String status;
private String friendlyName;
private String apiVersion;
private URI uri;
private String masterMsId;
private String masterConfernceEndpointId;
private String masterIVREndpointId;
private boolean isMasterPresent;
private Builder() {
super();
sid = null;
dateCreated = null;
accountSid = null;
status = null;
friendlyName = null;
apiVersion = null;
uri = null;
masterMsId = null;
masterConfernceEndpointId = null;
masterIVREndpointId = null;
isMasterPresent = true;
}
public ConferenceDetailRecord build() {
return new ConferenceDetailRecord(sid, dateCreated, DateTime.now(), accountSid,
status, friendlyName, apiVersion, uri, masterMsId, masterConfernceEndpointId, isMasterPresent, masterIVREndpointId, null, null, null, null, null, false);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setMasterMsId(final String msId) {
this.masterMsId = msId;
}
public void setDateCreated(final DateTime dateCreated) {
this.dateCreated = dateCreated;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setStatus(final String status) {
this.status = status;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setMasterConfernceEndpointId(final String masterConfernceEndpointId) {
this.masterConfernceEndpointId = masterConfernceEndpointId;
}
public void setMasterIVREndpointId(final String masterIVREndpointId) {
this.masterIVREndpointId = masterIVREndpointId;
}
}
@Override
public String toString() {
return "ConferenceDetailRecord [sid=" + sid + ", dateCreated=" + dateCreated + ", dateUpdated=" + dateUpdated
+ ", accountSid=" + accountSid + ", status=" + status + ", friendlyName=" + friendlyName
+ ", apiVersion=" + apiVersion + ", uri=" + uri + ", masterMsId=" + masterMsId + ", masterPresent="
+ masterPresent + ", masterConfernceEndpointId=" + masterConfernceEndpointId + ", masterIVREndpointId="
+ masterIVREndpointId + ", masterIVREndpointSessionId=" + masterIVREndpointSessionId
+ ", masterBridgeEndpointId=" + masterBridgeEndpointId + ", masterBridgeEndpointSessionId="
+ masterBridgeEndpointSessionId + ", masterBridgeConnectionIdentifier="
+ masterBridgeConnectionIdentifier + ", masterIVRConnectionIdentifier=" + masterIVRConnectionIdentifier
+ ", moderatorPresent=" + moderatorPresent + "]";
}
}
| 13,177 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
MediaServerEntity.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/MediaServerEntity.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public final class MediaServerEntity {
private final int msId;
private final String compatibility;
private final String localIpAddress;
private final int localPort;
private final String remoteIpAddress;
private final int remotePort;
private final String responseTimeout;
private final String externalAddress;
public MediaServerEntity(final int msId, final String compatibility,final String localIpAddress, final int localPort,
final String remoteIpAddress, final int remotePort, final String responseTimeout, final String externalAddress) {
super();
this.msId = msId;
this.compatibility = compatibility;
this.localIpAddress = localIpAddress;
this.localPort = localPort;
this.remoteIpAddress = remoteIpAddress;
this.remotePort = remotePort;
this.responseTimeout = responseTimeout;
this.externalAddress = externalAddress;
}
public static Builder builder() {
return new Builder();
}
public int getMsId() {
return this.msId;
}
public String getCompatibility() {
return this.compatibility;
}
public String getLocalIpAddress() {
return this.localIpAddress;
}
public int getLocalPort() {
return this.localPort;
}
public String getRemoteIpAddress() {
return this.remoteIpAddress;
}
public int getRemotePort() {
return this.remotePort;
}
public String getResponseTimeout() {
return this.responseTimeout;
}
public String getExternalAddress() {
return this.externalAddress;
}
public MediaServerEntity setMsId(int msId) {
return new MediaServerEntity(msId, compatibility, localIpAddress, localPort, remoteIpAddress, remotePort, responseTimeout, externalAddress);
}
@NotThreadSafe
public static final class Builder {
private int msId;
private String compatibility;
private String localIpAddress;
private int localPort;
private String remoteIpAddress;
private int remotePort;
private String responseTimeout;
private String externalAddress;
private Builder() {
super();
compatibility = null;
localIpAddress = null;
remoteIpAddress = null;
responseTimeout = null;
externalAddress = null;
}
public MediaServerEntity build() {
return new MediaServerEntity(msId, compatibility, localIpAddress, localPort, remoteIpAddress, remotePort, responseTimeout, externalAddress);
}
public void setMsId(int msId) {
this.msId = msId;
}
public void setCompatibility(String compatibility) {
this.compatibility = compatibility;
}
public void setLocalIpAddress(String localIpAddress) {
this.localIpAddress = localIpAddress;
}
public void setLocalPort(int localPort) {
this.localPort = localPort;
}
public void setRemoteIpAddress(String remoteIpAddress) {
this.remoteIpAddress = remoteIpAddress;
}
public void setRemotePort(int remotePort) {
this.remotePort = remotePort;
}
public void setResponseTimeout(String responseTimeout) {
this.responseTimeout = responseTimeout;
}
public void setExternalAddress(String externalAddress) {
this.externalAddress = externalAddress;
}
}
}
| 4,626 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RestCommResponse.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/RestCommResponse.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class RestCommResponse {
private final Object object;
public RestCommResponse(final Object object) {
super();
this.object = object;
}
public Object getObject() {
return object;
}
}
| 1,241 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
NotificationList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/NotificationList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class NotificationList {
private final List<Notification> notifications;
public NotificationList(final List<Notification> notifications) {
super();
this.notifications = notifications;
}
public List<Notification> getNotifications() {
return notifications;
}
}
| 1,351 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
AvailablePhoneNumber.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/AvailablePhoneNumber.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
/**
* @author [email protected] (Thomas Quintana)
*/
@Immutable
public final class AvailablePhoneNumber {
private final String friendlyName;
private final String phoneNumber;
private final Integer lata;
private final String rateCenter;
private final Double latitude;
private final Double longitude;
private final String region;
private final Integer postalCode;
private final String isoCountry;
private final String cost;
// Capabilities
private final Boolean voiceCapable;
private final Boolean smsCapable;
private final Boolean mmsCapable;
private final Boolean faxCapable;
public AvailablePhoneNumber(final String friendlyName, final String phoneNumber, final Integer lata,
final String rateCenter, final Double latitude, final Double longitude, final String region,
final Integer postalCode, final String isoCountry, final String cost) {
this(friendlyName, phoneNumber, lata, rateCenter, latitude, longitude, region, postalCode, isoCountry, cost, null, null,
null, null);
}
public AvailablePhoneNumber(final String friendlyName, final String phoneNumber, final Integer lata,
final String rateCenter, final Double latitude, final Double longitude, final String region,
final Integer postalCode, final String isoCountry, final String cost, final Boolean voiceCapable, final Boolean smsCapable,
final Boolean mmsCapable, final Boolean faxCapable) {
super();
this.friendlyName = friendlyName;
this.phoneNumber = phoneNumber;
this.lata = lata;
this.rateCenter = rateCenter;
this.latitude = latitude;
this.longitude = longitude;
this.region = region;
this.postalCode = postalCode;
this.isoCountry = isoCountry;
this.cost = cost;
this.voiceCapable = voiceCapable;
this.smsCapable = smsCapable;
this.mmsCapable = mmsCapable;
this.faxCapable = faxCapable;
}
public String getFriendlyName() {
return friendlyName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public Integer getLata() {
return lata;
}
public String getRateCenter() {
return rateCenter;
}
public Double getLatitude() {
return latitude;
}
public Double getLongitude() {
return longitude;
}
public String getRegion() {
return region;
}
public Integer getPostalCode() {
return postalCode;
}
public String getIsoCountry() {
return isoCountry;
}
public String getCost() {
return cost;
}
public Boolean isVoiceCapable() {
return this.voiceCapable;
}
public Boolean isSmsCapable() {
return smsCapable;
}
public Boolean isMmsCapable() {
return mmsCapable;
}
public Boolean isFaxCapable() {
return faxCapable;
}
public AvailablePhoneNumber setFriendlyName(final String friendlyName) {
return new AvailablePhoneNumber(friendlyName, phoneNumber, lata, rateCenter, latitude, longitude, region, postalCode,
isoCountry, cost, voiceCapable, smsCapable, mmsCapable, faxCapable);
}
}
| 4,229 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
IncomingPhoneNumber.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/IncomingPhoneNumber.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
* @author [email protected] (Maria Farooq)
*/
@Immutable
public final class IncomingPhoneNumber {
private Sid sid;
private DateTime dateCreated;
private DateTime dateUpdated;
private String friendlyName;
private Sid accountSid;
private String phoneNumber;
private String cost;
private String apiVersion;
private Boolean hasVoiceCallerIdLookup;
private URI voiceUrl;
private String voiceMethod;
private URI voiceFallbackUrl;
private String voiceFallbackMethod;
private URI statusCallback;
private String statusCallbackMethod;
private Sid voiceApplicationSid;
private String voiceApplicationName;
private URI smsUrl;
private String smsMethod;
private URI smsFallbackUrl;
private String smsFallbackMethod;
private Sid smsApplicationSid;
private String smsApplicationName;
private URI uri;
private URI ussdUrl;
private String ussdMethod;
private URI ussdFallbackUrl;
private String ussdFallbackMethod;
private Sid ussdApplicationSid;
private String ussdApplicationName;
private URI referUrl;
private String referMethod;
private Sid referApplicationSid;
private String referApplicationName;
private Sid organizationSid;
// Capabilities
private Boolean voiceCapable;
private Boolean smsCapable;
private Boolean mmsCapable;
private Boolean faxCapable;
private Boolean pureSip;
public IncomingPhoneNumber(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated,
final String friendlyName, final Sid accountSid, final String phoneNumber, final String cost, final String apiVersion,
final Boolean hasVoiceCallerIdLookup, final URI voiceUrl, final String voiceMethod, final URI voiceFallbackUrl,
final String voiceFallbackMethod, final URI statusCallback, final String statusCallbackMethod,
final Sid voiceApplicationSid, final URI smsUrl, final String smsMethod, final URI smsFallbackUrl,
final String smsFallbackMethod, final Sid smsApplicationSid, final URI uri, final URI ussdUrl, final String ussdMethod, final URI ussdFallbackUrl,
final String ussdFallbackMethod, final Sid ussdApplicationSid,
final URI referUrl, final String referMethod, final Sid referApplicationSid, final Sid organizationSid) {
this(sid, dateCreated, dateUpdated, friendlyName, accountSid, phoneNumber, cost, apiVersion, hasVoiceCallerIdLookup,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, statusCallback, statusCallbackMethod,
voiceApplicationSid, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, smsApplicationSid, uri, ussdUrl, ussdMethod, ussdFallbackUrl, ussdFallbackMethod, ussdApplicationSid, referUrl, referMethod, referApplicationSid, null, null, null, null, null, organizationSid);
}
public IncomingPhoneNumber(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated,
final String friendlyName, final Sid accountSid, final String phoneNumber, final String cost, final String apiVersion,
final Boolean hasVoiceCallerIdLookup, final URI voiceUrl, final String voiceMethod, final URI voiceFallbackUrl,
final String voiceFallbackMethod, final URI statusCallback, final String statusCallbackMethod,
final Sid voiceApplicationSid, final URI smsUrl, final String smsMethod, final URI smsFallbackUrl,
final String smsFallbackMethod, final Sid smsApplicationSid, final URI uri, final URI ussdUrl, final String ussdMethod, final URI ussdFallbackUrl,
final String ussdFallbackMethod, final Sid ussdApplicationSid,
final URI referUrl, final String referMethod, final Sid referApplicationSid,
final Boolean voiceCapable,
final Boolean smsCapable, final Boolean mmsCapable, final Boolean faxCapable, final Boolean pureSip, final Sid organizationSid) {
this(sid, dateCreated, dateUpdated, friendlyName, accountSid, phoneNumber, cost, apiVersion, hasVoiceCallerIdLookup,
voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, statusCallback, statusCallbackMethod,
voiceApplicationSid, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, smsApplicationSid, uri, ussdUrl, ussdMethod, ussdFallbackUrl, ussdFallbackMethod, ussdApplicationSid,
referUrl, referMethod, referApplicationSid,
voiceCapable, smsCapable, mmsCapable, faxCapable, pureSip, null, null, null, null, organizationSid);
}
public IncomingPhoneNumber(final Sid sid, final DateTime dateCreated, final DateTime dateUpdated,
final String friendlyName, final Sid accountSid, final String phoneNumber, final String cost, final String apiVersion,
final Boolean hasVoiceCallerIdLookup, final URI voiceUrl, final String voiceMethod, final URI voiceFallbackUrl,
final String voiceFallbackMethod, final URI statusCallback, final String statusCallbackMethod,
final Sid voiceApplicationSid, final URI smsUrl, final String smsMethod, final URI smsFallbackUrl,
final String smsFallbackMethod, final Sid smsApplicationSid, final URI uri, final URI ussdUrl, final String ussdMethod, final URI ussdFallbackUrl,
final String ussdFallbackMethod, final Sid ussdApplicationSid,
final URI referUrl, final String referMethod, final Sid referApplicationSid,
final Boolean voiceCapable,
final Boolean smsCapable, final Boolean mmsCapable, final Boolean faxCapable, final Boolean pureSip, final String voiceApplicationName, final String smsApplicationName, final String ussdApplicationName, final String referApplicationName, final Sid organizationSid) {
super();
this.sid = sid;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.friendlyName = friendlyName;
this.accountSid = accountSid;
this.phoneNumber = phoneNumber;
this.cost = cost;
this.apiVersion = apiVersion;
this.hasVoiceCallerIdLookup = hasVoiceCallerIdLookup;
this.voiceUrl = voiceUrl;
this.voiceMethod = voiceMethod;
this.voiceFallbackUrl = voiceFallbackUrl;
this.voiceFallbackMethod = voiceFallbackMethod;
this.statusCallback = statusCallback;
this.statusCallbackMethod = statusCallbackMethod;
this.voiceApplicationSid = voiceApplicationSid;
this.smsUrl = smsUrl;
this.smsMethod = smsMethod;
this.smsFallbackUrl = smsFallbackUrl;
this.smsFallbackMethod = smsFallbackMethod;
this.smsApplicationSid = smsApplicationSid;
this.uri = uri;
this.ussdUrl = ussdUrl;
this.ussdMethod = ussdMethod;
this.ussdFallbackUrl = ussdFallbackUrl;
this.ussdFallbackMethod = ussdFallbackMethod;
this.ussdApplicationSid = ussdApplicationSid;
this.referUrl = referUrl;
this.referMethod = referMethod;
this.referApplicationSid = referApplicationSid;
this.voiceCapable = voiceCapable;
this.smsCapable = smsCapable;
this.mmsCapable = mmsCapable;
this.faxCapable = faxCapable;
this.pureSip = pureSip;
this.voiceApplicationName = voiceApplicationName;
this.smsApplicationName = smsApplicationName;
this.ussdApplicationName = ussdApplicationName;
this.referApplicationName = referApplicationName;
this.organizationSid = organizationSid;
}
/**
* @return the sid
*/
public Sid getSid() {
return sid;
}
/**
* @param sid the sid to set
*/
public void setSid(Sid sid) {
this.sid = sid;
}
/**
* @return the dateCreated
*/
public DateTime getDateCreated() {
return dateCreated;
}
/**
* @param dateCreated the dateCreated to set
*/
public void setDateCreated(DateTime dateCreated) {
this.dateCreated = dateCreated;
}
/**
* @return the dateUpdated
*/
public DateTime getDateUpdated() {
return dateUpdated;
}
/**
* @param dateUpdated the dateUpdated to set
*/
public void setDateUpdated(DateTime dateUpdated) {
this.dateUpdated = dateUpdated;
}
/**
* @return the friendlyName
*/
public String getFriendlyName() {
return friendlyName;
}
/**
* @param friendlyName the friendlyName to set
*/
public void setFriendlyName(String friendlyName) {
this.friendlyName = friendlyName;
}
/**
* @return the accountSid
*/
public Sid getAccountSid() {
return accountSid;
}
/**
* @param accountSid the accountSid to set
*/
public void setAccountSid(Sid accountSid) {
this.accountSid = accountSid;
}
/**
* @return the phoneNumber
*/
public String getPhoneNumber() {
return phoneNumber;
}
/**
* @param phoneNumber the phoneNumber to set
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
/**
* @return the cost
*/
public String getCost() {
return cost;
}
/**
* @param cost the cost to set
*/
public void setCost(String cost) {
this.cost = cost;
}
/**
* @return the apiVersion
*/
public String getApiVersion() {
return apiVersion;
}
/**
* @param apiVersion the apiVersion to set
*/
public void setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
}
/**
* @return the hasVoiceCallerIdLookup
*/
public Boolean hasVoiceCallerIdLookup() {
return hasVoiceCallerIdLookup;
}
/**
* @param hasVoiceCallerIdLookup the hasVoiceCallerIdLookup to set
*/
public void setHasVoiceCallerIdLookup(Boolean hasVoiceCallerIdLookup) {
this.hasVoiceCallerIdLookup = hasVoiceCallerIdLookup;
}
/**
* @return the voiceUrl
*/
public URI getVoiceUrl() {
return voiceUrl;
}
/**
* @param voiceUrl the voiceUrl to set
*/
public void setVoiceUrl(URI voiceUrl) {
this.voiceUrl = voiceUrl;
}
/**
* @return the voiceMethod
*/
public String getVoiceMethod() {
return voiceMethod;
}
/**
* @param voiceMethod the voiceMethod to set
*/
public void setVoiceMethod(String voiceMethod) {
this.voiceMethod = voiceMethod;
}
/**
* @return the voiceFallbackUrl
*/
public URI getVoiceFallbackUrl() {
return voiceFallbackUrl;
}
/**
* @param voiceFallbackUrl the voiceFallbackUrl to set
*/
public void setVoiceFallbackUrl(URI voiceFallbackUrl) {
this.voiceFallbackUrl = voiceFallbackUrl;
}
/**
* @return the voiceFallbackMethod
*/
public String getVoiceFallbackMethod() {
return voiceFallbackMethod;
}
/**
* @param voiceFallbackMethod the voiceFallbackMethod to set
*/
public void setVoiceFallbackMethod(String voiceFallbackMethod) {
this.voiceFallbackMethod = voiceFallbackMethod;
}
/**
* @return the statusCallback
*/
public URI getStatusCallback() {
return statusCallback;
}
/**
* @param statusCallback the statusCallback to set
*/
public void setStatusCallback(URI statusCallback) {
this.statusCallback = statusCallback;
}
/**
* @return the statusCallbackMethod
*/
public String getStatusCallbackMethod() {
return statusCallbackMethod;
}
/**
* @param statusCallbackMethod the statusCallbackMethod to set
*/
public void setStatusCallbackMethod(String statusCallbackMethod) {
this.statusCallbackMethod = statusCallbackMethod;
}
/**
* @return the voiceApplicationSid
*/
public Sid getVoiceApplicationSid() {
return voiceApplicationSid;
}
/**
* @param voiceApplicationSid the voiceApplicationSid to set
*/
public void setVoiceApplicationSid(Sid voiceApplicationSid) {
this.voiceApplicationSid = voiceApplicationSid;
}
/**
* @return the smsUrl
*/
public URI getSmsUrl() {
return smsUrl;
}
/**
* @param smsUrl the smsUrl to set
*/
public void setSmsUrl(URI smsUrl) {
this.smsUrl = smsUrl;
}
/**
* @return the smsMethod
*/
public String getSmsMethod() {
return smsMethod;
}
/**
* @param smsMethod the smsMethod to set
*/
public void setSmsMethod(String smsMethod) {
this.smsMethod = smsMethod;
}
/**
* @return the smsFallbackUrl
*/
public URI getSmsFallbackUrl() {
return smsFallbackUrl;
}
/**
* @param smsFallbackUrl the smsFallbackUrl to set
*/
public void setSmsFallbackUrl(URI smsFallbackUrl) {
this.smsFallbackUrl = smsFallbackUrl;
}
/**
* @return the smsFallbackMethod
*/
public String getSmsFallbackMethod() {
return smsFallbackMethod;
}
/**
* @param smsFallbackMethod the smsFallbackMethod to set
*/
public void setSmsFallbackMethod(String smsFallbackMethod) {
this.smsFallbackMethod = smsFallbackMethod;
}
/**
* @return the smsApplicationSid
*/
public Sid getSmsApplicationSid() {
return smsApplicationSid;
}
/**
* @param smsApplicationSid the smsApplicationSid to set
*/
public void setSmsApplicationSid(Sid smsApplicationSid) {
this.smsApplicationSid = smsApplicationSid;
}
/**
* @return the uri
*/
public URI getUri() {
return uri;
}
/**
* @param uri the uri to set
*/
public void setUri(URI uri) {
this.uri = uri;
}
/**
* @return the ussdUrl
*/
public URI getUssdUrl() {
return ussdUrl;
}
/**
* @param ussdUrl the ussdUrl to set
*/
public void setUssdUrl(URI ussdUrl) {
this.ussdUrl = ussdUrl;
}
/**
* @return the ussdMethod
*/
public String getUssdMethod() {
return ussdMethod;
}
/**
* @param ussdMethod the ussdMethod to set
*/
public void setUssdMethod(String ussdMethod) {
this.ussdMethod = ussdMethod;
}
/**
* @return the ussdFallbackUrl
*/
public URI getUssdFallbackUrl() {
return ussdFallbackUrl;
}
/**
* @param ussdFallbackUrl the ussdFallbackUrl to set
*/
public void setUssdFallbackUrl(URI ussdFallbackUrl) {
this.ussdFallbackUrl = ussdFallbackUrl;
}
/**
* @return the ussdFallbackMethod
*/
public String getUssdFallbackMethod() {
return ussdFallbackMethod;
}
/**
* @param ussdFallbackMethod the ussdFallbackMethod to set
*/
public void setUssdFallbackMethod(String ussdFallbackMethod) {
this.ussdFallbackMethod = ussdFallbackMethod;
}
/**
* @return the ussdApplicationSid
*/
public Sid getUssdApplicationSid() {
return ussdApplicationSid;
}
/**
* @param ussdApplicationSid the ussdApplicationSid to set
*/
public void setUssdApplicationSid(Sid ussdApplicationSid) {
this.ussdApplicationSid = ussdApplicationSid;
}
/**
* @return the referUrl
*/
public URI getReferUrl() {
return referUrl;
}
/**
* @param referUrl the referUrl to set
*/
public void setReferUrl(URI referUrl) {
this.referUrl = referUrl;
}
/**
* @return the referMethod
*/
public String getReferMethod() {
return referMethod;
}
/**
* @param referMethod the referMethod to set
*/
public void setReferMethod(String referMethod) {
this.referMethod = referMethod;
}
/**
* @return the referApplicationSid
*/
public Sid getReferApplicationSid() {
return referApplicationSid;
}
/**
* @param referApplicationSid the referApplicationSid to set
*/
public void setReferApplicationSid(Sid referApplicationSid) {
this.referApplicationSid = referApplicationSid;
}
/**
* @return the referApplicationName
*/
public String getReferApplicationName() {
return referApplicationName;
}
/**
* @param referApplicationName the referApplicationName to set
*/
public void setReferApplicationName(String referApplicationName) {
this.referApplicationName = referApplicationName;
}
/**
* @return the voiceCapable
*/
public Boolean isVoiceCapable() {
return voiceCapable;
}
/**
* @param voiceCapable the voiceCapable to set
*/
public void setVoiceCapable(Boolean voiceCapable) {
this.voiceCapable = voiceCapable;
}
/**
* @return the smsCapable
*/
public Boolean isSmsCapable() {
return smsCapable;
}
/**
* @param smsCapable the smsCapable to set
*/
public void setSmsCapable(Boolean smsCapable) {
this.smsCapable = smsCapable;
}
/**
* @return the mmsCapable
*/
public Boolean isMmsCapable() {
return mmsCapable;
}
/**
* @param mmsCapable the mmsCapable to set
*/
public void setMmsCapable(Boolean mmsCapable) {
this.mmsCapable = mmsCapable;
}
/**
* @return the faxCapable
*/
public Boolean isFaxCapable() {
return faxCapable;
}
/**
* @param faxCapable the faxCapable to set
*/
public void setFaxCapable(Boolean faxCapable) {
this.faxCapable = faxCapable;
}
public Boolean isPureSip() {
return pureSip;
}
public void setPureSip(Boolean pureSip) {
this.pureSip = pureSip;
}
public void setVoiceApplicationName(String voiceApplicationName) {
this.voiceApplicationName = voiceApplicationName;
}
public void setSmsApplicationName(String smsApplicationName) {
this.smsApplicationName = smsApplicationName;
}
public void setUssdApplicationName(String ussdApplicationName) {
this.ussdApplicationName = ussdApplicationName;
}
public void setOrganizationSid(Sid organizationSid) {
this.organizationSid = organizationSid;
}
public String getVoiceApplicationName() {
return voiceApplicationName;
}
public String getSmsApplicationName() {
return smsApplicationName;
}
public String getUssdApplicationName() {
return ussdApplicationName;
}
/**
* @return the organizationSid
*/
public Sid getOrganizationSid() {
return organizationSid;
}
public static Builder builder() {
return new Builder();
}
@Override
public String toString() {
return "IncomingPhoneNumber [sid=" + sid + ", friendlyName=" + friendlyName + ", accountSid=" + accountSid
+ ", phoneNumber=" + phoneNumber + ", cost=" + cost + ", apiVersion=" + apiVersion
+ ", hasVoiceCallerIdLookup=" + hasVoiceCallerIdLookup + ", voiceUrl=" + voiceUrl + ", voiceMethod="
+ voiceMethod + ", voiceFallbackUrl=" + voiceFallbackUrl + ", voiceFallbackMethod="
+ voiceFallbackMethod + ", statusCallback=" + statusCallback + ", statusCallbackMethod="
+ statusCallbackMethod + ", voiceApplicationSid=" + voiceApplicationSid + ", smsUrl=" + smsUrl
+ ", smsMethod=" + smsMethod + ", smsFallbackUrl=" + smsFallbackUrl + ", smsFallbackMethod="
+ smsFallbackMethod + ", smsApplicationSid=" + smsApplicationSid + ", uri=" + uri + ", ussdUrl="
+ ussdUrl + ", ussdMethod=" + ussdMethod + ", ussdFallbackUrl=" + ussdFallbackUrl
+ ", ussdFallbackMethod=" + ussdFallbackMethod + ", ussdApplicationSid=" + ussdApplicationSid
+ ", referUrl=" + referUrl + ", referMethod=" + referMethod + ", referApplicationSid="
+ referApplicationSid + ", voiceCapable=" + voiceCapable + ", smsCapable=" + smsCapable
+ ", mmsCapable=" + mmsCapable + ", faxCapable=" + faxCapable + ", pureSip=" + pureSip
+ ", organizationSid=" + organizationSid + "]";
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private String friendlyName;
private Sid accountSid;
private String phoneNumber;
private String cost;
private String apiVersion;
private Boolean hasVoiceCallerIdLookup;
private URI voiceUrl;
private String voiceMethod;
private URI voiceFallbackUrl;
private String voiceFallbackMethod;
private URI statusCallback;
private String statusCallbackMethod;
private Sid voiceApplicationSid;
private URI smsUrl;
private String smsMethod;
private URI smsFallbackUrl;
private String smsFallbackMethod;
private Sid smsApplicationSid;
private URI uri;
private URI ussdUrl;
private String ussdMethod;
private URI ussdFallbackUrl;
private String ussdFallbackMethod;
private Sid ussdApplicationSid;
private URI referUrl;
private String referMethod;
private Sid referApplicationSid;
// Capabilities
private Boolean voiceCapable;
private Boolean smsCapable;
private Boolean mmsCapable;
private Boolean faxCapable;
private Boolean pureSip;
private Sid organizationSid;
public Builder() {
super();
}
public IncomingPhoneNumber build() {
final DateTime now = DateTime.now();
return new IncomingPhoneNumber(sid, now, now, friendlyName, accountSid, phoneNumber, cost, apiVersion,
hasVoiceCallerIdLookup, voiceUrl, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, statusCallback,
statusCallbackMethod, voiceApplicationSid, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod,
smsApplicationSid, uri, ussdUrl, ussdMethod, ussdFallbackUrl, ussdFallbackMethod, ussdApplicationSid,
referUrl, referMethod, referApplicationSid,
voiceCapable, smsCapable, mmsCapable, faxCapable, pureSip, organizationSid);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setFriendlyName(final String friendlyName) {
this.friendlyName = friendlyName;
}
public void setAccountSid(final Sid accountSid) {
this.accountSid = accountSid;
}
public void setPhoneNumber(final String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public void setCost(final String cost) {
this.cost = cost;
}
public void setApiVersion(final String apiVersion) {
this.apiVersion = apiVersion;
}
public void setHasVoiceCallerIdLookup(final boolean hasVoiceCallerIdLookup) {
this.hasVoiceCallerIdLookup = hasVoiceCallerIdLookup;
}
public void setVoiceUrl(final URI voiceUrl) {
this.voiceUrl = voiceUrl;
}
public void setVoiceMethod(final String voiceMethod) {
this.voiceMethod = voiceMethod;
}
public void setVoiceFallbackUrl(final URI voiceFallbackUrl) {
this.voiceFallbackUrl = voiceFallbackUrl;
}
public void setVoiceFallbackMethod(final String voiceFallbackMethod) {
this.voiceFallbackMethod = voiceFallbackMethod;
}
public void setStatusCallback(final URI statusCallback) {
this.statusCallback = statusCallback;
}
public void setStatusCallbackMethod(final String statusCallbackMethod) {
this.statusCallbackMethod = statusCallbackMethod;
}
public void setVoiceApplicationSid(final Sid voiceApplicationSid) {
this.voiceApplicationSid = voiceApplicationSid;
}
public void setSmsUrl(final URI smsUrl) {
this.smsUrl = smsUrl;
}
public void setSmsMethod(final String smsMethod) {
this.smsMethod = smsMethod;
}
public void setSmsFallbackUrl(final URI smsFallbackUrl) {
this.smsFallbackUrl = smsFallbackUrl;
}
public void setSmsFallbackMethod(final String smsFallbackMethod) {
this.smsFallbackMethod = smsFallbackMethod;
}
public void setSmsApplicationSid(final Sid smsApplicationSid) {
this.smsApplicationSid = smsApplicationSid;
}
public void setUri(final URI uri) {
this.uri = uri;
}
public void setUssdUrl(final URI ussdUrl) {
this.ussdUrl = ussdUrl;
}
public void setUssdMethod(final String ussdMethod) {
this.ussdMethod = ussdMethod;
}
public void setUssdFallbackUrl(final URI ussdFallbackUrl) {
this.ussdFallbackUrl = ussdFallbackUrl;
}
public void setUssdFallbackMethod(final String ussdFallbackMethod) {
this.ussdFallbackMethod = ussdFallbackMethod;
}
public void setUssdApplicationSid(final Sid ussdApplicationSid) {
this.ussdApplicationSid = ussdApplicationSid;
}
public void setOrganizationSid(final Sid organizationSid) {
this.organizationSid = organizationSid;
}
public URI getReferUrl() {
return referUrl;
}
public void setReferUrl(URI referUrl) {
this.referUrl = referUrl;
}
public String getReferMethod() {
return referMethod;
}
public void setReferMethod(String referMethod) {
this.referMethod = referMethod;
}
public Sid getReferApplicationSid() {
return referApplicationSid;
}
public Sid getOrganizationSid() {
return organizationSid;
}
public void setReferApplicationSid(Sid referApplicationSid) {
this.referApplicationSid = referApplicationSid;
}
public void setVoiceCapable(Boolean voiceCapable) {
this.voiceCapable = voiceCapable;
}
public void setSmsCapable(Boolean smsCapable) {
this.smsCapable = smsCapable;
}
public void setMmsCapable(Boolean mmsCapable) {
this.mmsCapable = mmsCapable;
}
public void setFaxCapable(Boolean faxCapable) {
this.faxCapable = faxCapable;
}
public void setPureSip(Boolean pureSip) {
this.pureSip = pureSip;
}
public static Builder builder() {
return new Builder();
}
@Override
public String toString() {
return "Builder [sid=" + sid + ", friendlyName=" + friendlyName + ", accountSid=" + accountSid
+ ", phoneNumber=" + phoneNumber + ", cost=" + cost + ", apiVersion=" + apiVersion
+ ", hasVoiceCallerIdLookup=" + hasVoiceCallerIdLookup + ", voiceUrl=" + voiceUrl + ", voiceMethod="
+ voiceMethod + ", voiceFallbackUrl=" + voiceFallbackUrl + ", voiceFallbackMethod="
+ voiceFallbackMethod + ", statusCallback=" + statusCallback + ", statusCallbackMethod="
+ statusCallbackMethod + ", voiceApplicationSid=" + voiceApplicationSid + ", smsUrl=" + smsUrl
+ ", smsMethod=" + smsMethod + ", smsFallbackUrl=" + smsFallbackUrl + ", smsFallbackMethod="
+ smsFallbackMethod + ", smsApplicationSid=" + smsApplicationSid + ", uri=" + uri + ", ussdUrl="
+ ussdUrl + ", ussdMethod=" + ussdMethod + ", ussdFallbackUrl=" + ussdFallbackUrl
+ ", ussdFallbackMethod=" + ussdFallbackMethod + ", ussdApplicationSid=" + ussdApplicationSid
+ ", referUrl=" + referUrl + ", referMethod=" + referMethod + ", referApplicationSid="
+ referApplicationSid + ", voiceCapable=" + voiceCapable + ", smsCapable=" + smsCapable
+ ", mmsCapable=" + mmsCapable + ", faxCapable=" + faxCapable + ", pureSip=" + pureSip
+ ", organizationSid=" + organizationSid + "]";
}
}
}
| 30,062 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Profile.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Profile.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.Calendar;
import java.util.Date;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class Profile{
public static final String DEFAULT_PROFILE_SID = "PRae6e420f425248d6a26948c17a9e2acf";
private final String sid;
private final String profileDocument;
private final Date dateCreated;
private final Date dateUpdated;
public Profile(final String sid, final String profileDocument, final Date dateCreated, final Date dateUpdated) {
super();
this.sid = sid;
this.profileDocument = profileDocument;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
}
public static Builder builder() {
return new Builder();
}
public String getSid() {
return sid;
}
public String getProfileDocument() {
return profileDocument;
}
public Date getDateCreated() {
return dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
public Profile setProfileDocument(String updatedProfileDocument){
return new Profile(this.sid, updatedProfileDocument, this.dateCreated, this.dateUpdated);
}
@NotThreadSafe
public static final class Builder {
private String sid;
private String profileDocument;
private Date dateCreated;
private Builder() {
super();
sid = null;
profileDocument = null;
dateCreated = null;
}
public Profile build() {
return new Profile(sid, profileDocument, dateCreated, Calendar.getInstance().getTime());
}
public void setProfileDocument(final String profileDocument) {
this.profileDocument = profileDocument;
}
public void setSid(final String sid) {
this.sid = sid;
}
public void setDateCreated(final Date dateCreated) {
this.dateCreated = dateCreated;
}
}
}
| 3,004 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Organization.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Organization.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Maria Farooq)
*/
@Immutable
public class Organization {
private final Sid sid;
private final String domainName;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final Status status;
/**
* @param sid
* @param domainName - such as customer.restcomm.com
* @param dateCreated
* @param dateUpdated
* @param status
* @throws IllegalArgumentException if sid or domainName are null/empty
*/
public Organization(final Sid sid, final String domainName, final DateTime dateCreated, final DateTime dateUpdated, final Status status) throws IllegalArgumentException {
super();
if(domainName == null || domainName.trim().isEmpty())
throw new IllegalArgumentException("Organization domainName can not be empty.");
if(sid == null)
throw new IllegalArgumentException("Organization sid can not be empty.");
this.sid = sid;
if(domainName.endsWith(".")){
this.domainName = domainName.substring(0, domainName.lastIndexOf('.'));
}else{
this.domainName = domainName;
}
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.status = status;
}
public enum Status {
// max length of a new status should be under 16 characters otherwise schema update is required.
ACTIVE("active"), CLOSED("closed");
private final String text;
private Status(final String text) {
this.text = text;
}
public static Status getValueOf(final String text) {
Status[] values = values();
for (final Status value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid organization status.");
}
@Override
public String toString() {
return text;
}
};
public static Builder builder() {
return new Builder();
}
public Sid getSid() {
return sid;
}
public String getDomainName() {
if(domainName != null && domainName.endsWith("."))
return domainName.substring(0, domainName.lastIndexOf('.'));
return domainName;
}
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public Status getStatus() {
return status;
}
/**
* @param domainName
* @return
* @throws IllegalArgumentException in case provided domainName is empty or null
*/
public Organization setDomainName(final String domainName) throws IllegalArgumentException {
if(domainName == null || domainName.trim().isEmpty())
throw new IllegalArgumentException("Organization domainName can not be empty.");
return new Organization(sid, domainName, dateCreated, DateTime.now(), status);
}
@NotThreadSafe
public static final class Builder {
private Sid sid;
private String domainName;
private DateTime dateCreated;
private DateTime dateUpdated;
private Status status;
private Builder() {
super();
sid = null;
domainName = null;
dateCreated = DateTime.now();
dateUpdated = DateTime.now();
status = null;
}
public Organization build() {
return new Organization(sid, domainName, dateCreated, dateUpdated, status);
}
public void setSid(final Sid sid) {
this.sid = sid;
}
public void setDomainName(final String domainName) {
this.domainName = domainName;
}
public void setStatus(final Status status) {
this.status = status;
}
@Override
public String toString() {
return "Organization.Builder [sid=" + sid + ", domainName=" + domainName + ", dateCreated=" + dateCreated
+ ", dateUpdated=" + dateUpdated + ", status=" + status + "]";
}
}
@Override
public String toString() {
return "Organization [sid=" + sid + ", domainName=" + domainName + ", dateCreated=" + dateCreated
+ ", dateUpdated=" + dateUpdated + ", status=" + status + "]";
}
}
| 5,567 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Announcement.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Announcement.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.net.URI;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author <a href="mailto:[email protected]">George Vagenas</a>
*/
@Immutable
public final class Announcement {
private Sid sid;
private DateTime dateCreated;
private Sid accountSid;
private String gender;
private String language;
private String text;
private URI uri;
public Announcement(final Sid sid, final Sid accountSid, final String gender, final String language, final String text,
final URI uri) {
this.sid = sid;
this.dateCreated = DateTime.now();
this.accountSid = accountSid;
this.gender = gender;
this.language = language;
this.text = text;
this.uri = uri;
}
public Announcement(final Sid sid, final DateTime dateCreated, final Sid accountSid, final String gender,
final String language, final String text, final URI uri) {
this.sid = sid;
this.dateCreated = dateCreated;
this.accountSid = accountSid;
this.gender = gender;
this.language = language;
this.text = text;
this.uri = uri;
}
public Sid getSid() {
return sid;
}
public DateTime getDateCreated() {
return dateCreated;
}
public Sid getAccountSid() {
return accountSid;
}
public String getGender() {
return gender;
}
public String getLanguage() {
return language;
}
public String getText() {
return text;
}
public URI getUri() {
return uri;
}
}
| 2,548 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
SmsMessageList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/SmsMessageList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class SmsMessageList {
private final List<SmsMessage> messages;
public SmsMessageList(final List<SmsMessage> messages) {
super();
this.messages = messages;
}
public List<SmsMessage> getSmsMessages() {
return messages;
}
}
| 1,314 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ConferenceRecordCountFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ConferenceRecordCountFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
@Immutable
public class ConferenceRecordCountFilter {
private final String accountSid;
private final String status;
private final Date dateCreated;
private final Date dateUpdated;
private final String friendlyName;
private final Integer limit;
private final Integer offset;
private final String masterMsId;
public ConferenceRecordCountFilter(String accountSid, String status, String dateCreated, String dateUpdated,
String friendlyName, Integer limit, Integer offset, String masterMsId) throws ParseException {
this.accountSid = accountSid;
this.status = status;
this.friendlyName = friendlyName;
this.limit = limit;
this.offset = offset;
this.masterMsId = masterMsId;
if (dateCreated != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(dateCreated);
this.dateCreated = date;
} else {
this.dateCreated = null;
}
if (dateUpdated != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(dateUpdated);
this.dateUpdated = date;
} else {
this.dateUpdated = null;
}
}
public String getSid() {
return accountSid;
}
public String getStatus() {
return status;
}
public String getFriendlyName() {
return friendlyName;
}
public Date getDateCreated() {
return dateCreated;
}
public Date getDateUpdated() {
return dateUpdated;
}
public int getLimit() {
return limit;
}
public int getOffset() {
return offset;
}
public String getMasterMsId() {
return masterMsId;
}
public static ConferenceRecordCountFilter.Builder builder() {
return new ConferenceRecordCountFilter.Builder();
}
public static final class Builder {
private String accountSid = null;
private String status = null;
private String dateCreated = null;
private String dateUpdated = null;
private String friendlyName = null;
private Integer limit = null;
private Integer offset = null;
private String masterMsId = null;
public ConferenceRecordCountFilter build() throws ParseException {
return new ConferenceRecordCountFilter(accountSid, status, dateCreated, dateUpdated, friendlyName, limit, offset, masterMsId);
}
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byStatus(String status) {
this.status = status;
return this;
}
public Builder byDateCreated(String dateCreated) {
this.dateCreated = dateCreated;
return this;
}
public Builder byDateUpdated(String dateUpdated) {
this.dateUpdated = dateUpdated;
return this;
}
public Builder byFriendlyName(String friendlyName) {
this.friendlyName = friendlyName;
return this;
}
public Builder byLimit(Integer limit) {
this.limit = limit;
return this;
}
public Builder byOffset(Integer offset) {
this.offset = offset;
return this;
}
public Builder byMasterMsId(String masterMsId) {
this.masterMsId = masterMsId;
return this;
}
}
}
| 4,624 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CallDetailRecordFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/CallDetailRecordFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.dao.common.Sorting;
/**
* @author <a href="mailto:[email protected]">gvagenas</a>
*/
@Immutable
public class CallDetailRecordFilter {
private final String accountSid;
private final List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private final String recipient;
private final String sender;
private final String status;
private final Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private final Date endTime;
private final String parentCallSid;
private final String conferenceSid;
private final Integer limit;
private final Integer offset;
private final String instanceid;
private final Sorting.Direction sortByDate;
private final Sorting.Direction sortByFrom;
private final Sorting.Direction sortByTo;
private final Sorting.Direction sortByDirection;
private final Sorting.Direction sortByStatus;
private final Sorting.Direction sortByDuration;
private final Sorting.Direction sortByPrice;
public CallDetailRecordFilter(String accountSid, List<String> accountSidSet, String recipient, String sender, String status, String startTime, String endTime,
String parentCallSid, String conferenceSid, Integer limit, Integer offset) throws ParseException {
this(accountSid, accountSidSet, recipient,sender,status,startTime,endTime,parentCallSid, conferenceSid, limit, offset, null, null,
null, null, null, null, null, null);
}
public CallDetailRecordFilter(String accountSid, List<String> accountSidSet, String recipient, String sender, String status, String startTime, String endTime,
String parentCallSid, String conferenceSid, Integer limit, Integer offset, String instanceId, Sorting.Direction sortByDate,
Sorting.Direction sortByFrom, Sorting.Direction sortByTo, Sorting.Direction sortByDirection, Sorting.Direction sortByStatus, Sorting.Direction sortByDuration,
Sorting.Direction sortByPrice) throws ParseException {
this.accountSid = accountSid;
this.accountSidSet = accountSidSet;
// The LIKE keyword uses '%' to match any (including 0) number of characters, and '_' to match exactly one character
// Add here the '%' keyword so +15126002188 will be the same as 15126002188 and 6002188
if (recipient != null)
recipient = "%".concat(recipient);
if (sender != null)
sender = "%".concat(sender);
this.recipient = recipient;
this.sender = sender;
this.status = status;
this.parentCallSid = parentCallSid;
this.conferenceSid = conferenceSid;
this.limit = limit;
this.offset = offset;
if (startTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(startTime);
this.startTime = date;
} else
this.startTime = null;
if (endTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(endTime);
this.endTime = date;
} else {
this.endTime = null;
}
if (instanceId != null && !instanceId.isEmpty()) {
this.instanceid = instanceId;
} else {
this.instanceid = null;
}
this.sortByDate = sortByDate;
this.sortByFrom = sortByFrom;
this.sortByTo = sortByTo;
this.sortByDirection = sortByDirection;
this.sortByStatus = sortByStatus;
this.sortByDuration = sortByDuration;
this.sortByPrice = sortByPrice;
}
public String getSid() {
return accountSid;
}
public List<String> getAccountSidSet() {
return accountSidSet;
}
public String getRecipient() {
return recipient;
}
public String getSender() {
return sender;
}
public String getStatus() {
return status;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public String getParentCallSid() {
return parentCallSid;
}
public String getConferenceSid() {
return conferenceSid;
}
public Integer getLimit() {
return limit;
}
public Integer getOffset() {
return offset;
}
public String getInstanceid() { return instanceid; }
public Sorting.Direction getSortByDate() { return sortByDate; }
public Sorting.Direction getSortByFrom() { return sortByFrom; }
public Sorting.Direction getSortByTo() { return sortByTo; }
public Sorting.Direction getSortByDirection() { return sortByDirection; }
public Sorting.Direction getSortByStatus() { return sortByStatus; }
public Sorting.Direction getSortByDuration() { return sortByDuration; }
public Sorting.Direction getSortByPrice() { return sortByPrice; }
public static final class Builder {
private String accountSid = null;
private List<String> accountSidSet = null;
private String recipient = null;
private String sender = null;
private String status = null;
private String startTime = null;
private String endTime = null;
private String parentCallSid = null;
private String conferenceSid = null;
private String instanceid = null;
private Sorting.Direction sortByDate = null;
private Sorting.Direction sortByFrom = null;
private Sorting.Direction sortByTo = null;
private Sorting.Direction sortByDirection = null;
private Sorting.Direction sortByStatus = null;
private Sorting.Direction sortByDuration = null;
private Sorting.Direction sortByPrice = null;
private Integer limit = null;
private Integer offset = null;
public static CallDetailRecordFilter.Builder builder() {
return new CallDetailRecordFilter.Builder();
}
public CallDetailRecordFilter build() throws ParseException {
return new CallDetailRecordFilter(accountSid,
accountSidSet,
recipient,
sender,
status,
startTime,
endTime,
parentCallSid,
conferenceSid,
limit,
offset,
instanceid,
sortByDate,
sortByFrom,
sortByTo,
sortByDirection,
sortByStatus,
sortByDuration,
sortByPrice);
}
// Filters
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byAccountSidSet(List<String> accountSidSet) {
this.accountSidSet = accountSidSet;
return this;
}
public Builder byRecipient(String recipient) {
this.recipient = recipient;
return this;
}
public Builder bySender(String sender) {
this.sender = sender;
return this;
}
public Builder byStatus(String status) {
this.status = status;
return this;
}
public Builder byStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public Builder byEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public Builder byParentCallSid(String parentCallSid) {
this.parentCallSid = parentCallSid;
return this;
}
public Builder byConferenceSid(String conferenceSid) {
this.conferenceSid = conferenceSid;
return this;
}
public Builder byInstanceId(String instanceid) {
this.instanceid = instanceid;
return this;
}
// Sorters
public Builder sortedByDate(Sorting.Direction sortDirection) {
this.sortByDate = sortDirection;
return this;
}
public Builder sortedByFrom(Sorting.Direction sortDirection) {
this.sortByFrom = sortDirection;
return this;
}
public Builder sortedByTo(Sorting.Direction sortDirection) {
this.sortByTo = sortDirection;
return this;
}
public Builder sortedByDirection(Sorting.Direction sortDirection) {
this.sortByDirection = sortDirection;
return this;
}
public Builder sortedByStatus(Sorting.Direction sortDirection) {
this.sortByStatus = sortDirection;
return this;
}
public Builder sortedByDuration(Sorting.Direction sortDirection) {
this.sortByDuration = sortDirection;
return this;
}
public Builder sortedByPrice(Sorting.Direction sortDirection) {
this.sortByPrice = sortDirection;
return this;
}
// Paging
public Builder limited(Integer limit, Integer offset) {
this.limit = limit;
this.offset = offset;
return this;
}
}
}
| 10,563 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
NotificationFilter.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/NotificationFilter.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.dao.common.Sorting;
/**
* @author <a href="mailto:[email protected]">vunguyen</a>
*/
@Immutable
public class NotificationFilter {
private final String accountSid;
private final List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private final Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private final Date endTime;
private final String errorCode;
private final String requestUrl;
private final String messageText;
private final Integer limit;
private final Integer offset;
private final String instanceid;
private final Sorting.Direction sortByDate;
private final Sorting.Direction sortByLog;
private final Sorting.Direction sortByErrorCode;
private final Sorting.Direction sortByCallSid;
private final Sorting.Direction sortByMessageText;
public NotificationFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime, String errorCode, String requestUrl,
String messageText, Integer limit, Integer offset) throws ParseException {
this(accountSid, accountSidSet, startTime,endTime, errorCode, requestUrl, messageText, limit,offset,null, null, null, null, null, null);
}
public NotificationFilter(String accountSid, List<String> accountSidSet, String startTime, String endTime, String errorCode, String requestUrl,
String messageText, Integer limit, Integer offset, String instanceId, Sorting.Direction sortByDate,
Sorting.Direction sortByLog, Sorting.Direction sortByErrorCode, Sorting.Direction sortByCallSid,
Sorting.Direction sortByMessageText) throws ParseException {
this.accountSid = accountSid;
this.accountSidSet = accountSidSet;
this.errorCode = errorCode;
this.requestUrl = requestUrl;
this.messageText = messageText;
this.limit = limit;
this.offset = offset;
if (startTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(startTime);
this.startTime = date;
} else
this.startTime = null;
if (endTime != null) {
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
Date date = parser.parse(endTime);
this.endTime = date;
} else {
this.endTime = null;
}
if (instanceId != null && !instanceId.isEmpty()) {
this.instanceid = instanceId;
} else {
this.instanceid = null;
}
this.sortByDate = sortByDate;
this.sortByLog = sortByLog;
this.sortByErrorCode = sortByErrorCode;
this.sortByCallSid = sortByCallSid;
this.sortByMessageText = sortByMessageText;
}
public String getSid() {
return accountSid;
}
public List<String> getAccountSidSet() {
return accountSidSet;
}
public String getErrorCode() {
return errorCode;
}
public String getRequestUrl() {
return requestUrl;
}
public Date getStartTime() {
return startTime;
}
public Date getEndTime() {
return endTime;
}
public String getMessageText() {
return messageText;
}
public Integer getLimit() {
return limit;
}
public Integer getOffset() {
return offset;
}
public String getInstanceid() { return instanceid; }
public Sorting.Direction getSortByDate() { return sortByDate; }
public Sorting.Direction getSortByLog() { return sortByLog; }
public Sorting.Direction getSortByErrorCode() { return sortByErrorCode; }
public Sorting.Direction getSortByCallSid() { return sortByCallSid; }
public Sorting.Direction getSortByMessageText() { return sortByMessageText; }
public static final class Builder {
private String accountSid = null;
private List<String> accountSidSet = null;
private String startTime = null;
private String endTime = null;
private String errorCode = null;
private String requestUrl = null;
private String messageText = null;
private String instanceid = null;
private Sorting.Direction sortByDate = null;
private Sorting.Direction sortByLog = null;
private Sorting.Direction sortByErrorCode = null;
private Sorting.Direction sortByCallSid = null;
private Sorting.Direction sortByMessageText = null;
private Integer limit = null;
private Integer offset = null;
public static NotificationFilter.Builder builder() {
return new NotificationFilter.Builder();
}
public NotificationFilter build() throws ParseException {
return new NotificationFilter(accountSid,
accountSidSet,
startTime,
endTime,
errorCode,
requestUrl,
messageText,
limit,
offset,
instanceid,
sortByDate,
sortByLog,
sortByErrorCode,
sortByCallSid,
sortByMessageText);
}
// Filters
public Builder byAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
public Builder byAccountSidSet(List<String> accountSidSet) {
this.accountSidSet = accountSidSet;
return this;
}
public Builder byStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public Builder byEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public Builder byErrorCode(String errorCode) {
this.errorCode = errorCode;
return this;
}
public Builder byRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
return this;
}
public Builder byMessageText(String messageText) {
this.messageText = messageText;
return this;
}
public Builder byInstanceId(String instanceid) {
this.instanceid = instanceid;
return this;
}
// Sorters
public Builder sortedByDate(Sorting.Direction sortDirection) {
this.sortByDate = sortDirection;
return this;
}
public Builder sortedByLog(Sorting.Direction sortDirection) {
this.sortByLog = sortDirection;
return this;
}
public Builder sortedByErrorCode(Sorting.Direction sortDirection) {
this.sortByErrorCode = sortDirection;
return this;
}
public Builder sortedByCallSid(Sorting.Direction sortDirection) {
this.sortByCallSid = sortDirection;
return this;
}
public Builder sortedByMessageText(Sorting.Direction sortDirection) {
this.sortByMessageText = sortDirection;
return this;
}
// Paging
public Builder limited(Integer limit, Integer offset) {
this.limit = limit;
this.offset = offset;
return this;
}
}
}
| 8,566 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Usage.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Usage.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
import java.io.Serializable;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Currency;
/**
* @author [email protected] (Alexandre Mendonca)
*/
@Immutable
public final class Usage implements Serializable {
private static final long serialVersionUID = 1L;
private final Category category;
private final String description;
private final Sid accountSid;
private final DateTime startDate;
private final DateTime endDate;
private final Long usage;
private final String usageUnit;
private final Long count;
private final String countUnit;
private final BigDecimal price;
private final Currency priceUnit;
private final URI uri;
public Usage(final Category category, final String description, final Sid accountSid, final DateTime startDate, final DateTime endDate,
final Long usage, final String usageUnit, final Long count, final String countUnit, final BigDecimal price,
final Currency priceUnit, final URI uri) {
super();
this.category = category;
this.description = description;
this.accountSid = accountSid;
this.startDate = startDate;
this.endDate = endDate;
this.usage = usage;
this.usageUnit = usageUnit;
this.count = count;
this.countUnit = countUnit;
this.price = price;
this.priceUnit = priceUnit;
this.uri = uri;
}
public Category getCategory() {
return category;
}
public String getDescription() {
return description;
}
public Sid getAccountSid() {
return accountSid;
}
public DateTime getStartDate() {
return startDate;
}
public DateTime getEndDate() {
return endDate;
}
public Long getUsage() {
return usage;
}
public String getUsageUnit() {
return usageUnit;
}
public Long getCount() {
return count;
}
public String getCountUnit() {
return countUnit;
}
public BigDecimal getPrice() {
return price;
}
public Currency getPriceUnit() {
return priceUnit;
}
public URI getUri() {
return uri;
}
public enum Category {
CALLS("calls"), CALLS_INBOUND("calls-inbound"), CALLS_INBOUND_LOCAL("calls-inbound-local"),
CALLS_INBOUND_TOLLFREE("calls-inbound-tollfree"), CALLS_OUTBOUND("calls-outbound"),
CALLS_CLIENT("calls-client"), CALLS_SIP("calls-sip"), SMS("sms"), SMS_INBOUND("sms-inbound"),
SMS_INBOUND_SHORTCODE("sms-inbound-shortcode"), SMS_INBOUND_LONGCODE("sms-inbound-longcode"),
SMS_OUTBOUND("sms-outbound"), SMS_OUTBOUND_SHORTCODE("sms-outbound-shortcode"),
SMS_OUTBOUND_LONGCODE("sms-outbound-longcode"), PHONENUMBERS("phonenumbers"),
PHONENUMBERS_TOLLFREE("phonenumbers-tollfree"), PHONENUMBERS_LOCAL("phonenumbers-local"),
SHORTCODES("shortcodes"), SHORTCODES_VANITY("shortcodes-vanity"),
SHORTCODES_RANDOM("shortcodes-random"), SHORTCODES_CUSTOMEROWNED("shortcodes-customerowned"),
CALLERIDLOOKUPS("calleridlookups"), RECORDINGS("recordings"), TRANSCRIPTIONS("transcriptions"),
RECORDINGSTORAGE("recordingstorage"), TOTALPRICE("totalprice");
private final String text;
private Category(final String text) {
this.text = text;
}
public static Category getCategoryValue(final String text) {
final Category[] values = values();
for (final Category value : values) {
if (value.toString().equals(text)) {
return value;
}
}
throw new IllegalArgumentException(text + " is not a valid category.");
}
@Override
public String toString() {
return text;
}
}
}
| 4,554 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
RecordingList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/RecordingList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class RecordingList {
private final List<Recording> recordings;
public RecordingList(final List<Recording> recordings) {
super();
this.recordings = recordings;
}
public List<Recording> getRecordings() {
return recordings;
}
}
| 1,318 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ShortCodeList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/ShortCodeList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class ShortCodeList {
private final List<ShortCode> shortCodes;
public ShortCodeList(final List<ShortCode> shortCodes) {
super();
this.shortCodes = shortCodes;
}
public List<ShortCode> getShortCodes() {
return shortCodes;
}
}
| 1,318 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
SearchFilterMode.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/SearchFilterMode.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
public enum SearchFilterMode {
PERFECT_MATCH,
WILDCARD_MATCH
}
| 927 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
IncomingPhoneNumberList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/IncomingPhoneNumberList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class IncomingPhoneNumberList {
private final List<IncomingPhoneNumber> incomingPhoneNumbers;
public IncomingPhoneNumberList(final List<IncomingPhoneNumber> incomingPhoneNumbers) {
super();
this.incomingPhoneNumbers = incomingPhoneNumbers;
}
public List<IncomingPhoneNumber> getIncomingPhoneNumbers() {
return incomingPhoneNumbers;
}
}
| 1,428 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
OutgoingCallerIdList.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/OutgoingCallerIdList.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import java.util.List;
import org.restcomm.connect.commons.annotations.concurrency.NotThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@NotThreadSafe
public final class OutgoingCallerIdList {
private final List<OutgoingCallerId> outgoingCallerIds;
public OutgoingCallerIdList(final List<OutgoingCallerId> outgoingCallerIds) {
super();
this.outgoingCallerIds = outgoingCallerIds;
}
public List<OutgoingCallerId> getOutgoingCallerIds() {
return outgoingCallerIds;
}
}
| 1,395 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Registration.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/Registration.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities;
import org.joda.time.DateTime;
import org.restcomm.connect.commons.annotations.concurrency.Immutable;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
* @author [email protected]
* @author [email protected]
*/
@Immutable
public final class Registration implements Comparable<Registration> {
private final Sid sid;
private final String instanceId;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final DateTime dateExpires;
private final String addressOfRecord;
private final String displayName;
private final String userName;
private final int timeToLive;
private final String location;
private final String userAgent;
private final boolean webrtc;
private final boolean isLBPresent;
private final Sid organizationSid;
public Registration(final Sid sid, final String instanceId, final DateTime dateCreated, final DateTime dateUpdated, final String addressOfRecord,
final String displayName, final String userName, final String userAgent, final int timeToLive,
final String location, final boolean webRTC, final boolean isLBPresent, final Sid organizationSid) {
this(sid, instanceId, dateCreated, dateUpdated, DateTime.now().plusSeconds(timeToLive), addressOfRecord, displayName, userName,
userAgent, timeToLive, location, webRTC, isLBPresent, organizationSid);
}
public Registration(final Sid sid, final String instanceId, final DateTime dateCreated, final DateTime dateUpdated, final DateTime dateExpires,
final String addressOfRecord, final String displayName, final String userName, final String userAgent,
final int timeToLive, final String location, final boolean webRTC, final boolean isLBPresent, final Sid organizationSid) {
super();
this.sid = sid;
this.instanceId = instanceId;
this.dateCreated = dateCreated;
this.dateUpdated = dateUpdated;
this.dateExpires = dateExpires;
this.addressOfRecord = addressOfRecord;
this.displayName = displayName;
this.userName = userName;
this.location = location;
this.userAgent = userAgent;
this.timeToLive = timeToLive;
this.webrtc = webRTC;
this.isLBPresent = isLBPresent; //(isLBPresent != null) ? isLBPresent : false;
//https://github.com/RestComm/Restcomm-Connect/issues/2106
this.organizationSid = organizationSid;
}
public Sid getSid() {
return sid;
}
public String getInstanceId() { return instanceId; }
public DateTime getDateCreated() {
return dateCreated;
}
public DateTime getDateUpdated() {
return dateUpdated;
}
public DateTime getDateExpires() {
return dateExpires;
}
public String getAddressOfRecord() {
return addressOfRecord;
}
public String getDisplayName() {
return displayName;
}
public String getUserName() {
return userName;
}
public String getLocation() {
return location;
}
public String getUserAgent() {
return userAgent;
}
public int getTimeToLive() {
return timeToLive;
}
public boolean isWebRTC() {
return webrtc;
}
public boolean isLBPresent() {
return isLBPresent;
}
public Sid getOrganizationSid() {
return organizationSid;
}
public Registration setTimeToLive(final int timeToLive) {
final DateTime now = DateTime.now();
return new Registration(sid, instanceId, dateCreated, now, now.plusSeconds(timeToLive), addressOfRecord, displayName, userName,
userAgent, timeToLive, location, webrtc, isLBPresent, organizationSid);
}
public Registration updated() {
final DateTime now = DateTime.now();
return new Registration(sid, instanceId, dateCreated, now, dateExpires, addressOfRecord, displayName, userName, userAgent, timeToLive, location, webrtc, isLBPresent, organizationSid);
}
@Override
public int compareTo(Registration registration) {
// use reverse order of comparator to have registrations sorted in descending order
if (this.getDateUpdated().toDate().getTime() > registration.getDateUpdated().toDate().getTime())
return -1;
else
return 1;
}
@Override
public String toString() {
return "Registration [sid=" + sid + ", instanceId=" + instanceId + ", dateCreated=" + dateCreated
+ ", dateUpdated=" + dateUpdated + ", dateExpires=" + dateExpires + ", addressOfRecord="
+ addressOfRecord + ", displayName=" + displayName + ", userName=" + userName + ", timeToLive="
+ timeToLive + ", location=" + location + ", userAgent=" + userAgent + ", webrtc=" + webrtc
+ ", isLBPresent=" + isLBPresent + ", organizationSid=" + organizationSid + "]";
}
}
| 5,898 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
ShiroResources.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/shiro/ShiroResources.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities.shiro;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.restcomm.connect.commons.annotations.concurrency.ThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@ThreadSafe
public final class ShiroResources {
private static final class SingletonHolder {
private static final ShiroResources instance = new ShiroResources();
}
private final Map<Class<?>, Object> services;
private ShiroResources() {
super();
this.services = new ConcurrentHashMap<Class<?>, Object>();
}
public <T> T get(final Class<T> klass) {
synchronized (klass) {
final Object service = services.get(klass);
if (service != null) {
return klass.cast(service);
} else {
return null;
}
}
}
public static ShiroResources getInstance() {
return SingletonHolder.instance;
}
public <T> void set(final Class<T> klass, final T instance) {
synchronized (klass) {
services.put(klass, instance);
}
}
}
| 1,968 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
CredentialsMatcher.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/shiro/CredentialsMatcher.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities.shiro;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
import org.restcomm.connect.commons.annotations.concurrency.ThreadSafe;
/**
* @author [email protected] (Thomas Quintana)
*/
@ThreadSafe
public final class CredentialsMatcher extends SimpleCredentialsMatcher {
public CredentialsMatcher() {
super();
}
@Override
public boolean doCredentialsMatch(final AuthenticationToken token, final AuthenticationInfo info) {
final String tokenCredentials = new String((char[]) token.getCredentials());
final String accountCredentials = new String((char[]) info.getCredentials());
if (accountCredentials.equals(tokenCredentials)){
return true;
} else {
final String hashedToken = DigestUtils.md5Hex(tokenCredentials);
return accountCredentials.equals(hashedToken);
}
}
}
| 1,904 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Realm.java | /FileExtraction/Java_unseen/RestComm_Restcomm-Connect/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/entities/shiro/Realm.java | /*
* TeleStax, Open Source Cloud Communications
* Copyright 2011-2014, Telestax Inc and individual contributors
* by the @authors tag.
*
* This program is free software: you can redistribute it and/or modify
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
package org.restcomm.connect.dao.entities.shiro;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.configuration.Configuration;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.authz.SimpleRole;
import org.apache.shiro.authz.permission.WildcardPermission;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.restcomm.connect.commons.annotations.concurrency.ThreadSafe;
import org.restcomm.connect.dao.AccountsDao;
import org.restcomm.connect.dao.DaoManager;
import org.restcomm.connect.dao.entities.Account;
import org.restcomm.connect.commons.dao.Sid;
/**
* @author [email protected] (Thomas Quintana)
*/
@ThreadSafe
public final class Realm extends AuthorizingRealm {
private volatile Map<String, SimpleRole> roles;
public Realm() {
super();
}
@Override
protected AuthorizationInfo doGetAuthorizationInfo(final PrincipalCollection principals) {
final Sid sid = new Sid((String) principals.getPrimaryPrincipal());
final ShiroResources services = ShiroResources.getInstance();
final DaoManager daos = services.get(DaoManager.class);
final AccountsDao accounts = daos.getAccountsDao();
final Account account = accounts.getAccount(sid);
final String roleName = account.getRole();
final Set<String> set = new HashSet<String>();
set.add(roleName);
final SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(set);
final SimpleRole role = getRole(roleName);
if (role != null) {
authorizationInfo.setObjectPermissions(role.getPermissions());
}
return authorizationInfo;
}
@Override
protected AuthenticationInfo doGetAuthenticationInfo(final AuthenticationToken token) throws AuthenticationException {
final UsernamePasswordToken authenticationToken = (UsernamePasswordToken) token;
String username = authenticationToken.getUsername();
Sid sid = null;
Account account = null;
String authToken = null;
final ShiroResources services = ShiroResources.getInstance();
final DaoManager daos = services.get(DaoManager.class);
final AccountsDao accounts = daos.getAccountsDao();
try {
if (Sid.pattern.matcher(username).matches()) {
sid = new Sid(username);
account = accounts.getAccount(sid);
} else {
account = accounts.getAccountToAuthenticate(username);
sid = account.getSid();
}
if (account != null) {
authToken = account.getAuthToken();
return new SimpleAuthenticationInfo(sid.toString(), authToken.toCharArray(), getName());
} else {
return null;
}
} catch (Exception ignored) {
return null;
}
}
private SimpleRole getRole(final String role) {
if (roles != null) {
return roles.get(role);
} else {
synchronized (this) {
if (roles == null) {
roles = new HashMap<String, SimpleRole>();
final ShiroResources services = ShiroResources.getInstance();
final Configuration configuration = services.get(Configuration.class);
loadSecurityRoles(configuration.subset("security-roles"));
}
}
return roles.get(role);
}
}
private void loadSecurityRoles(final Configuration configuration) {
@SuppressWarnings("unchecked")
final List<String> roleNames = (List<String>) configuration.getList("role[@name]");
final int numberOfRoles = roleNames.size();
if (numberOfRoles > 0) {
for (int roleIndex = 0; roleIndex < numberOfRoles; roleIndex++) {
StringBuilder buffer = new StringBuilder();
buffer.append("role(").append(roleIndex).append(")").toString();
final String prefix = buffer.toString();
final String name = configuration.getString(prefix + "[@name]");
@SuppressWarnings("unchecked")
final List<String> permissions = configuration.getList(prefix + ".permission");
final int numberOfPermissions = permissions.size();
if (name != null) {
if (numberOfPermissions > 0) {
final SimpleRole role = new SimpleRole(name);
for (int permissionIndex = 0; permissionIndex < numberOfPermissions; permissionIndex++) {
String permissionName = permissions.get(permissionIndex);
//buffer = new StringBuilder();
//buffer.append(prefix).append(".permission(").append(permissionIndex).append(")");
final Permission permission = new WildcardPermission(permissionName);
role.add(permission);
}
roles.put(name, role);
}
}
}
}
}
}
| 6,505 | Java | .java | RestComm/Restcomm-Connect | 239 | 214 | 788 | 2012-08-17T17:47:44Z | 2023-04-14T20:58:19Z |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.