List of usage examples for org.joda.time.format ISODateTimeFormat dateTimeNoMillis
public static DateTimeFormatter dateTimeNoMillis()
From source file:org.n52.oxf.ses.adapter.SESRequestBuilder_00.java
License:Open Source License
@Deprecated public String buildSubscribeRequestLegacy(ParameterContainer parameters) { EnvelopeDocument request = aSesRequest().addSoapAction(SOAP_ACTION_SUBSCRIBE_REQUEST) .addRecipient(getStringValueFor(SUBSCRIBE_SES_URL, parameters)) .addFrom(getFromAddress(SUBSCRIBE_FROM, parameters)).addMessageId().build(); XmlObject body = request.getEnvelope().getBody(); XmlCursor xmlCursor = body.newCursor(); xmlCursor.toFirstContentToken();/* w ww . java2s .c o m*/ xmlCursor.beginElement(WSN_B.createQNameFor("Subscribe")); xmlCursor.beginElement(WSN_B.createQNameFor("ConsumerReference")); String consumer = getStringValueFor(SUBSCRIBE_CONSUMER_REFERENCE_ADDRESS, parameters); xmlCursor.insertElementWithText(WSA.createQNameFor("Address"), consumer); xmlCursor.toNextToken(); addFilter(xmlCursor, parameters); // // if a initial termination time is not wanted add attribute xsi:nil="true" // xmlCursor.toNextToken(); String initialTermination = getStringValueFor(SUBSCRIBE_INITIAL_TERMINATION_TIME, parameters); if (initialTermination == null) { xmlCursor.beginElement(WSN_B.createQNameFor("InitialTerminationTime")); xmlCursor.insertAttributeWithValue(XSD.createQNameFor("nil"), "true"); xmlCursor.toNextToken(); } else { xmlCursor.insertElementWithText(WSN_B.createQNameFor("InitialTerminationTime"), new DateTime(createTerminationTime(initialTermination)) .toString(ISODateTimeFormat.dateTimeNoMillis())); } xmlCursor.dispose(); String messageContentFilter = getStringValueFor(SUBSCRIBE_FILTER_MESSAGE_CONTENT, parameters); String toReplace = request.xmlText(); return messageContentFilter != null ? toReplace.replaceAll("@MSG_CONT_FILTER@", messageContentFilter) : toReplace; }
From source file:org.neotree.export.SummaryPrintDocumentAdapter.java
License:Open Source License
private String formatDateTime(Context context, String value) { return (TextUtils.isEmpty(value)) ? context.getString(R.string.label_not_set) : DateTime.parse(value, ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.DATETIME); }
From source file:org.neotree.model.realm.Session.java
License:Open Source License
public Session(String sessionId, String scriptId) { setSessionId(sessionId); setScriptId(scriptId); setCreatedAt(DateTime.now().toString(ISODateTimeFormat.dateTimeNoMillis())); }
From source file:org.neotree.model.realm.Session.java
License:Open Source License
public void completeSession() { setCompletedAt(DateTime.now().toString(ISODateTimeFormat.dateTimeNoMillis())); }
From source file:org.neotree.model.realm.SessionValue.java
License:Open Source License
@SuppressWarnings("unchecked") public <T> T getValue() { switch (getDataTypeAsObject()) { case BOOLEAN: return (T) getBooleanValue(); case DATETIME: case DATE:/* w ww . j a va 2s .c om*/ case TIME: return (T) ((getStringValue() != null) ? DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) : null); case ID: return (T) getStringValue(); case NUMBER: return (T) getDoubleValue(); case PERIOD: return (T) ((getStringValue() != null) ? Period.parse(getStringValue(), ISOPeriodFormat.standard()) : null); case SET_ID: return (T) getStringValue(); case STRING: return (T) getStringValue(); case VOID: default: return null; } }
From source file:org.neotree.model.realm.SessionValue.java
License:Open Source License
@JsonIgnore @SuppressWarnings("unchecked") public String getValueAsFormattedString(Context context) { switch (getDataTypeAsObject()) { case BOOLEAN: return (getBooleanValue() != null && getBooleanValue()) ? "Yes" : "No"; case DATETIME: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.DATETIME); case DATE://from ww w .jav a 2s. c om return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.DATE); case SET_ID: case ID: //return String.format("%s - %s", getStringValue(), getValueLabel()); return getValueLabel(); case NUMBER: final int decimalDigits = (TextUtils.isEmpty(getFormat())) ? 0 : getFormat().length(); return (getDoubleValue() == null) ? context.getString(R.string.label_not_set) : String.format("%." + decimalDigits + "f", getDoubleValue()); case PERIOD: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : Period.parse(getStringValue(), ISOPeriodFormat.standard()) .toString(NeoTree.NeoTreeFormat.PERIOD); case STRING: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : getStringValue(); case TIME: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.TIME); case VOID: default: break; } return ""; }
From source file:org.neotree.model.realm.SessionValue.java
License:Open Source License
@JsonIgnore @SuppressWarnings("unchecked") public String getValueAsExportString(Context context) { switch (getDataTypeAsObject()) { case BOOLEAN: return (getBooleanValue() != null && getBooleanValue()) ? "Yes" : "No"; case DATETIME: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.DATETIME_EXPORT); case DATE://from w w w . j ava 2 s. c om return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.DATE_EXPORT); case ID: case STRING: return getStringValue(); case NUMBER: final int decimalDigits = (TextUtils.isEmpty(getFormat())) ? 0 : getFormat().length(); return (getDoubleValue() == null) ? context.getString(R.string.label_not_set) : String.format("%." + decimalDigits + "f", getDoubleValue()); case PERIOD: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : Period.parse(getStringValue(), ISOPeriodFormat.standard()) .toString(NeoTree.NeoTreeFormat.PERIOD); case TIME: return (getStringValue() == null) ? context.getString(R.string.label_not_set) : DateTime.parse(getStringValue(), ISODateTimeFormat.dateTimeNoMillis()) .toString(NeoTree.NeoTreeFormat.TIME); case SET_ID: case VOID: default: break; } return null; }
From source file:org.neotree.model.realm.SessionValue.java
License:Open Source License
public void setValue(Object value) { if (value == null) { setBooleanValue(null);/*from w w w. j av a2s .co m*/ setDoubleValue(null); setStringValue(null); } else if (value instanceof Boolean) { setBooleanValue((Boolean) value); } else if (value instanceof Double) { setDoubleValue((Double) value); } else if (value instanceof String) { setStringValue((String) value); } else if (value instanceof DateTime) { setStringValue(((DateTime) value).toString(ISODateTimeFormat.dateTimeNoMillis())); } else if (value instanceof Period) { setStringValue(((Period) value).toString(ISOPeriodFormat.standard())); } }
From source file:org.neotree.support.datastore.RealmStore.java
License:Open Source License
public static void finishSession(Realm realm, Session session) { realm.executeTransactionAsync(bgRealm -> { session.setCompletedAt(DateTime.now().toString(ISODateTimeFormat.dateTimeNoMillis())); bgRealm.copyToRealmOrUpdate(session); }, () -> {// www. j av a 2s .c o m // Transaction was a success. Log.v(TAG, "finishSession(): success"); }, error -> { // Transaction failed and was automatically canceled. Log.e(TAG, "finishSession(): failure", error); }); }
From source file:org.ojbc.bundles.adapters.staticmock.samplegen.IncidentSampleGenerator.java
License:RPL License
private void addIncidentActivityElement(Incident incident, Element digestElement) { Element entityActivityElement = appendElement(digestElement, OjbcNamespaceContext.NS_LEXSDIGEST, "EntityActivity"); Element activityElement = appendElement(entityActivityElement, OjbcNamespaceContext.NS_NC, "Activity"); XmlUtils.addAttribute(activityElement, OjbcNamespaceContext.NS_STRUCTURES, "id", incident.incidentID); Element e = appendElement(activityElement, OjbcNamespaceContext.NS_NC, "ActivityIdentification"); e = appendElement(e, OjbcNamespaceContext.NS_NC, "IdentificationID"); e.setTextContent(incident.incidentID); e = appendElement(activityElement, OjbcNamespaceContext.NS_NC, "ActivityCategoryText"); e.setTextContent("Incident"); Element dateRangeElement = appendElement(activityElement, OjbcNamespaceContext.NS_NC, "ActivityDateRange"); e = appendElement(dateRangeElement, OjbcNamespaceContext.NS_NC, "StartDate"); e = appendElement(e, OjbcNamespaceContext.NS_NC, "DateTime"); e.setTextContent(ISODateTimeFormat.dateTimeNoMillis().print(incident.startDate)); e = appendElement(dateRangeElement, OjbcNamespaceContext.NS_NC, "EndDate"); e = appendElement(e, OjbcNamespaceContext.NS_NC, "DateTime"); e.setTextContent(ISODateTimeFormat.dateTimeNoMillis().print(incident.endDate)); e = appendElement(activityElement, OjbcNamespaceContext.NS_NC, "ActivityDescriptionText"); e.setTextContent(incident.offense);/*from w w w . j a v a2 s . c o m*/ }