Example usage for org.joda.time DateTime toString

List of usage examples for org.joda.time DateTime toString

Introduction

In this page you can find the example usage for org.joda.time DateTime toString.

Prototype

@ToString
public String toString() 

Source Link

Document

Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).

Usage

From source file:de.escidoc.core.oum.business.renderer.VelocityXmlOrganizationalUnitRenderer.java

License:Open Source License

/**
 * Adds the common values to the provided map.
 *
 * @param organizationalUnit The organizational unit for that data shall be created.
 * @param values             The map to add values to.
 * @throws WebserverSystemException Thrown in case of an internal error.
 *//*from w w  w .j a v a  2 s  . c om*/
private static void addCommonValues(final OrganizationalUnit organizationalUnit,
        final Map<String, Object> values) throws WebserverSystemException {

    DateTime lmd = null;
    try {
        lmd = organizationalUnit.getLastModificationDate();
        values.put(XmlTemplateProviderConstants.VAR_LAST_MODIFICATION_DATE, lmd.toString());
    } catch (final Exception e) {
        throw new WebserverSystemException("Unable to parse last-modification-date '" + lmd
                + "' of organizational-unit '" + organizationalUnit.getId() + "'!", e);
    }
    addXlinkValues(values);
    addNamespaceValues(values);
}

From source file:de.escidoc.core.test.EscidocRestSoapTestBase.java

License:Open Source License

/**
 * Create a Param structure for PID assignments.
 *
 * @param lstModDate The last-modification-date.
 * @param url        URL of the resource (not checked)
 * @return param XML snippet./*  ww  w  .  ja v  a 2 s . c  om*/
 */
protected final String getPidParam2(final DateTime lstModDate, final URL url) {

    String extUrl = url.toString();
    if (!extUrl.endsWith("/")) {
        extUrl += "/";
    }
    extUrl += System.nanoTime();

    String param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<param last-modification-date=\""
            + lstModDate.toString() + "\"><url>" + extUrl + "</url></param>";
    return (param);
}

From source file:de.fatalix.book.importer.Main.java

License:Open Source License

private static void parseDateTime() {
    DateTime dtTime = new DateTime();
    String timeString = dtTime.toString();
    System.out.println(timeString);
    DateTime dtTimeParsed = new DateTime(timeString);

    System.out.println(dtTimeParsed);
}

From source file:de.geeksfactory.opacclient.OpacClient.java

License:MIT License

@Override
public void onCreate() {
    super.onCreate();
    sp = PreferenceManager.getDefaultSharedPreferences(this);

    if (!BuildConfig.DEBUG) {
        ACRAConfiguration config = ACRA.getNewDefaultConfig(this);
        config.setResToastText(R.string.crash_toast_text);
        config.setResDialogText(R.string.crash_dialog_text);
        config.setResToastText(R.string.crash_toast_text);
        config.setResNotifTickerText(R.string.crash_notif_ticker_text);
        config.setResNotifTitle(R.string.crash_notif_title);
        config.setResNotifText(R.string.crash_notif_text);
        config.setResNotifIcon(android.R.drawable.stat_notify_error);
        config.setResDialogText(R.string.crash_dialog_text);
        ACRA.init(this, config);

        if (getLibrary() != null) {
            ACRA.getErrorReporter().putCustomData("library", getLibrary().getIdent());
        }//from  ww w.  j a  va  2 s  .  c  o  m
        DateTime lastUpdate = new PreferenceDataSource(getApplicationContext()).getLastLibraryConfigUpdate();
        ACRA.getErrorReporter().putCustomData("data_version",
                lastUpdate != null ? lastUpdate.toString() : "null");
    }
    DebugTools.init(this);

    OpacClient.context = getApplicationContext();

    try {
        OpacClient.versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    // Schedule alarms
    WakefulIntentService.scheduleAlarms(new SyncAccountAlarmListener(), this);
}

From source file:de.geeksfactory.opacclient.storage.AccountDataSource.java

License:MIT License

public long addAlarm(LocalDate deadline, long[] media, DateTime alarmTime) {
    for (long mid : media) {
        if (getLentItem(mid) == null) {
            throw new DataIntegrityException("Cannot add alarm with deadline " + deadline.toString()
                    + " that has dependency on the non-existing media item " + mid);
        }//from   w w w. j  a va  2  s. c o m
    }

    ContentValues values = new ContentValues();
    values.put("deadline", deadline.toString());
    values.put("media", joinLongs(media, ","));
    values.put("alarm", alarmTime.toString());
    values.put("notified", 0);
    values.put("finished", 0);
    return database.insert(AccountDatabase.TABLENAME_ALARMS, null, values);
}

From source file:de.geeksfactory.opacclient.storage.PreferenceDataSource.java

License:MIT License

public void setLastLibraryConfigUpdate(DateTime lastUpdate) {
    sp.edit().putString(LAST_LIBRARY_CONFIG_UPDATE, lastUpdate.toString()).apply();
}

From source file:de.geeksfactory.opacclient.webservice.LibraryConfigUpdateService.java

License:MIT License

@Override
protected void onHandleIntent(Intent intent) {
    WebService service = WebServiceManager.getInstance();
    PreferenceDataSource prefs = new PreferenceDataSource(this);
    File filesDir = new File(getFilesDir(), LIBRARIES_DIR);
    filesDir.mkdirs();//from   ww w.  ja  va2 s.c o m
    try {
        int count = ((OpacClient) getApplication()).getUpdateHandler().updateConfig(service, prefs,
                new FileOutput(filesDir), new JsonSearchFieldDataSource(this));
        if (!BuildConfig.DEBUG) {
            DateTime lastUpdate = prefs.getLastLibraryConfigUpdate();
            ACRA.getErrorReporter().putCustomData("data_version",
                    lastUpdate != null ? lastUpdate.toString() : "null");
        }
        if (BuildConfig.DEBUG) {
            Log.d("LibraryConfigUpdate", "updated config for " + String.valueOf(count) + " libraries");
        }
        Intent broadcast = new Intent(ACTION_SUCCESS).putExtra(EXTRA_UPDATE_COUNT, count);
        LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast);
        ((OpacClient) getApplication()).resetCache();
    } catch (IOException e) {
        Intent broadcast = new Intent(ACTION_FAILURE);
        LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast);
    } catch (JSONException e) {
        Intent broadcast = new Intent(ACTION_FAILURE);
        LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast);
        ErrorReporter.handleException(e);
    }
}

From source file:de.taimos.dvalin.jpa.JodaDateTimeType.java

License:Apache License

@Override
public String toString(DateTime value) throws HibernateException {
    return value.toString();
}

From source file:de.weltraumschaf.citer.domain.CiteRepository.java

License:BEER-WARE LICENSE

@Override
public Cite create(Map<String, Object> params) {
    Transaction tx = graphDb.beginTx();/*ww  w . ja v a2  s  . c o  m*/

    try {
        Node newCiteNode = graphDb.createNode();
        referenceNode.createRelationshipTo(newCiteNode, A_CITE);

        for (String paramName : params.keySet()) {
            newCiteNode.setProperty(paramName, params.get(paramName));
        }

        String id = UUID.randomUUID().toString();
        DateTime now = new DateTime();
        newCiteNode.setProperty(Cite.ID, id);
        newCiteNode.setProperty(Cite.DATE_CREATED, now.toString());
        newCiteNode.setProperty(Cite.DATE_UPDATED, now.toString());
        index.add(newCiteNode, Cite.ID, id);
        tx.success();
        return new Cite(newCiteNode);
    } finally {
        tx.finish();
    }
}

From source file:de.weltraumschaf.citer.domain.NodeEntity.java

License:BEER-WARE LICENSE

public void setDateCreated(DateTime date) {
    setProperty(DATE_CREATED, date.toString());
}