Example usage for org.joda.time DateTimeZone UTC

List of usage examples for org.joda.time DateTimeZone UTC

Introduction

In this page you can find the example usage for org.joda.time DateTimeZone UTC.

Prototype

DateTimeZone UTC

To view the source code for org.joda.time DateTimeZone UTC.

Click Source Link

Document

The time zone for Universal Coordinated Time

Usage

From source file:com.enonic.cms.core.timezone.TimeZoneServiceImpl.java

License:Open Source License

@SuppressWarnings({ "unchecked" })
public TimeZoneServiceImpl() {
    Set<String> ids = DateTimeZone.getAvailableIDs();
    this.timeZones.add(DateTimeZone.UTC);
    for (final String id : ids) {
        if (!id.equals("UTC")) {
            this.timeZones.add(DateTimeZone.forID(id));
        }//from  w ww  . j a v  a  2s  .c o  m
    }
}

From source file:com.epam.ta.reportportal.core.project.impl.GetProjectStatisticHandler.java

License:Open Source License

/**
 * Utility method for calculation of start interval date
 * //from   w w  w.  j av  a 2 s .com
 * @param input
 * @return
 */
private static Date getStartIntervalDate(InfoInterval input) {
    DateTime now = new DateTime().toDateTime(DateTimeZone.UTC);
    DateTime range = now.minusMonths(input.getCount());
    return range.toDate();
}

From source file:com.esofthead.mycollab.configuration.SiteConfiguration.java

License:Open Source License

public static void loadConfiguration() {
    TimeZone.setDefault(DateTimeZone.UTC.toTimeZone());
    DateTimeZone.setDefault(DateTimeZone.UTC);
    int serverPort = Integer.parseInt(System.getProperty(ApplicationProperties.MYCOLLAB_PORT, "8080"));
    ApplicationProperties.loadProps();//  w w w.  j av  a 2  s  .com
    instance = new SiteConfiguration();

    instance.sentErrorEmail = ApplicationProperties.getString(ERROR_SENDTO, "support@mycollab.com");
    instance.siteName = ApplicationProperties.getString(SITE_NAME, "MyCollab");
    instance.serverAddress = ApplicationProperties.getString(SERVER_ADDRESS, "localhost");
    instance.serverPort = serverPort;

    String pullMethodValue = ApplicationProperties.getString(ApplicationProperties.PULL_METHOD, "push");
    instance.pullMethod = PullMethod.valueOf(pullMethodValue);

    instance.cdnUrl = String.format(ApplicationProperties.getString(CDN_URL), instance.serverAddress,
            instance.serverPort);

    instance.appUrl = String.format(ApplicationProperties.getString(APP_URL), instance.serverAddress,
            instance.serverPort);
    if (!instance.appUrl.endsWith("/")) {
        instance.appUrl += "/";
    }

    instance.endecryptPassword = ApplicationProperties.getString(BI_ENDECRYPT_PASSWORD, "esofthead321");

    // load email
    String host = ApplicationProperties.getString(MAIL_SMTPHOST);
    String user = ApplicationProperties.getString(MAIL_USERNAME);
    String password = ApplicationProperties.getString(MAIL_PASSWORD);
    Integer port = Integer.parseInt(ApplicationProperties.getString(MAIL_PORT, "25"));
    Boolean isTls = Boolean.parseBoolean(ApplicationProperties.getString(MAIL_IS_TLS, "false"));
    Boolean isSsl = Boolean.parseBoolean(ApplicationProperties.getString(MAIL_IS_SSL, "false"));
    String noreplyEmail = ApplicationProperties.getString(MAIL_NOTIFY, "");
    instance.emailConfiguration = new EmailConfiguration(host, user, password, port, isTls, isSsl,
            noreplyEmail);

    // load database configuration
    String driverClass = ApplicationProperties.getString(DB_DRIVER_CLASS);
    String dbUrl = ApplicationProperties.getString(DB_URL);
    String dbUser = ApplicationProperties.getString(DB_USERNAME);
    String dbPassword = ApplicationProperties.getString(DB_PASSWORD);
    instance.databaseConfiguration = new DatabaseConfiguration(driverClass, dbUrl, dbUser, dbPassword);

    instance.resourceDownloadUrl = ApplicationProperties.getString(RESOURCE_DOWNLOAD_URL);
    if (!"".equals(instance.resourceDownloadUrl)) {
        instance.resourceDownloadUrl = String.format(instance.resourceDownloadUrl, instance.serverAddress,
                instance.serverPort);
    } else {
        instance.resourceDownloadUrl = instance.appUrl + "file/";
    }

    instance.dropboxCallbackUrl = ApplicationProperties.getString(DROPBOX_AUTH_LINK);
    instance.ggDriveCallbackUrl = ApplicationProperties.getString(GOOGLE_DRIVE_LINK);

    instance.facebookUrl = ApplicationProperties.getString(FACEBOOK_URL, "https://www.facebook.com/mycollab2");
    instance.twitterUrl = ApplicationProperties.getString(TWITTER_URL, "https://twitter.com/mycollabdotcom");
    instance.googleUrl = ApplicationProperties.getString(GOOGLE_URL,
            "https://plus.google.com/u/0/b/112053350736358775306/+Mycollab/about/p/pub");
    instance.linkedinUrl = ApplicationProperties.getString(LINKEDIN_URL,
            "http://www.linkedin.com/company/mycollab");

    Configuration configuration = new Configuration(Configuration.VERSION_2_3_24);
    configuration.setDefaultEncoding("UTF-8");
    try {
        List<TemplateLoader> loaders = new ArrayList<>();
        File i18nFolder = new File(FileUtils.getUserFolder(), "i18n");
        File confFolder1 = new File(FileUtils.getUserFolder(), "conf");
        File confFolder2 = new File(FileUtils.getUserFolder(), "src/main/conf");
        if (i18nFolder.exists()) {
            loaders.add(new FileTemplateLoader(i18nFolder));
        }
        if (confFolder1.exists()) {
            loaders.add(new FileTemplateLoader(confFolder1));
        }
        if (confFolder2.exists()) {
            loaders.add(new FileTemplateLoader(confFolder2));
        }
        loaders.add(new ClassTemplateLoader(SiteConfiguration.class.getClassLoader(), ""));
        configuration.setTemplateLoader(
                new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()])));
        instance.freemarkerConfiguration = configuration;
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.components.CreatedDateOrderComponent.java

License:Open Source License

@Override
public void insertBugs(List<SimpleBug> bugs) {
    for (SimpleBug bug : bugs) {
        if (bug.getCreatedtime() != null) {
            Date createdDate = bug.getCreatedtime();
            DateTime jodaTime = new DateTime(createdDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (createdDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = createdDateAvailables.get(monDay);
                groupComponent.insertTask(bug);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                createdDateAvailables.put(monDay, groupComponent);
                addComponent(groupComponent);
                groupComponent.insertTask(bug);
            }/* ww w. java 2s  .  c o  m*/
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks);
            }
            unspecifiedTasks.insertTask(bug);
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.components.DueDateOrderComponent.java

License:Open Source License

@Override
public void insertBugs(List<SimpleBug> bugs) {
    for (SimpleBug bug : bugs) {
        if (bug.getDuedate() != null) {
            Date dueDate = bug.getDuedate();
            DateTime jodaTime = new DateTime(dueDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (dueDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = dueDateAvailables.get(monDay);
                groupComponent.insertTask(bug);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                dueDateAvailables.put(monDay, groupComponent);
                int index = dueDateAvailables.getKeyIndex(monDay);
                if (index > -1) {
                    addComponent(groupComponent, index);
                } else {
                    addComponent(groupComponent);
                }/*from  w ww.  ja  v a 2 s.co m*/
                groupComponent.insertTask(bug);
            }
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks);
            }
            unspecifiedTasks.insertTask(bug);
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.bug.components.StartDateOrderComponent.java

License:Open Source License

@Override
public void insertBugs(List<SimpleBug> bugs) {
    for (SimpleBug bug : bugs) {
        if (bug.getCreatedtime() != null) {
            Date startDate = bug.getCreatedtime();
            DateTime jodaTime = new DateTime(startDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (startDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = startDateAvailables.get(monDay);
                groupComponent.insertTask(bug);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                startDateAvailables.put(monDay, groupComponent);
                addComponent(groupComponent);
                groupComponent.insertTask(bug);
            }//from w w  w  .  j ava  2s. c o m
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks, 0);
            }
            unspecifiedTasks.insertTask(bug);
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.task.components.CreatedDateOrderComponent.java

License:Open Source License

@Override
public void insertTasks(List<SimpleTask> tasks) {
    for (SimpleTask task : tasks) {
        if (task.getCreatedtime() != null) {
            Date createdDate = task.getCreatedtime();
            DateTime jodaTime = new DateTime(createdDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (createdDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = createdDateAvailables.get(monDay);
                groupComponent.insertTask(task);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                createdDateAvailables.put(monDay, groupComponent);
                int index = createdDateAvailables.getKeyIndex(monDay);
                if (index > -1) {
                    addComponent(groupComponent, index);
                } else {
                    addComponent(groupComponent);
                }//w  w  w . jav a 2s.  com

                groupComponent.insertTask(task);
            }
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks, 0);
            }
            unspecifiedTasks.insertTask(task);
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.task.components.DueDateOrderComponent.java

License:Open Source License

@Override
public void insertTasks(List<SimpleTask> tasks) {
    for (SimpleTask task : tasks) {
        if (task.getDeadline() != null) {
            Date dueDate = task.getDeadline();
            DateTime jodaTime = new DateTime(dueDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (dueDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = dueDateAvailables.get(monDay);
                groupComponent.insertTask(task);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                dueDateAvailables.put(monDay, groupComponent);
                int index = dueDateAvailables.getKeyIndex(monDay);
                if (index > -1) {
                    addComponent(groupComponent, index);
                } else {
                    addComponent(groupComponent);
                }/*from w  ww. j a  va 2  s .  c om*/

                groupComponent.insertTask(task);
            }
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks);
            }
            unspecifiedTasks.insertTask(task);
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.task.components.StartDateOrderComponent.java

License:Open Source License

@Override
public void insertTasks(List<SimpleTask> tasks) {
    for (SimpleTask task : tasks) {
        if (task.getStartdate() != null) {
            Date startDate = task.getStartdate();
            DateTime jodaTime = new DateTime(startDate, DateTimeZone.UTC);
            DateTime monDay = jodaTime.dayOfWeek().withMinimumValue();
            if (startDateAvailables.containsKey(monDay)) {
                GroupComponent groupComponent = startDateAvailables.get(monDay);
                groupComponent.insertTask(task);
            } else {
                GroupComponent groupComponent = new GroupComponent(monDay);
                startDateAvailables.put(monDay, groupComponent);
                int index = startDateAvailables.getKeyIndex(monDay);
                if (index > -1) {
                    addComponent(groupComponent, index);
                } else {
                    addComponent(groupComponent);
                }//w ww .  j av a  2s . c  o m

                groupComponent.insertTask(task);
            }
        } else {
            if (unspecifiedTasks == null) {
                unspecifiedTasks = new GroupComponent();
                addComponent(unspecifiedTasks, 0);
            }
            unspecifiedTasks.insertTask(task);
        }
    }
}

From source file:com.esofthead.mycollab.test.rule.EssentialInitRule.java

License:Open Source License

@Override
public Statement apply(Statement base, Description description) {
    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    DateTimeZone.setDefault(DateTimeZone.UTC);

    URL resourceUrl = IntergrationServiceTest.class.getClassLoader().getResource("log4j-test.properties");
    if (resourceUrl != null) {
        PropertyConfigurator.configure(resourceUrl);
    }//  w w w  . j  ava2s  .c om
    return base;
}