src/main/java/edu/kit/informatik/pcc/webinterface/datamanagement/VideoDataManager.java
/**
     * This method parses the meta object to a String
     * @param ret meta info as json
     * @return the created string
     */
This method parses the meta object to a String
@param ret meta info as json
@return the created string
This method parses the meta object to a String @param ret meta info as json @return the created string
private static String parseMetaJSON(String ret) {
        String date;
        double gForceX;
        double gForceY;
        double gForceZ;
        String triggerType;
        String editingDate = null;
        try {
            JSONObject obj = new JSONObject(ret);
            date = new SimpleDateFormat("HH:mm:ss.SSS dd.MM.yyyy")
                    .format(new Date(obj.getLong("date")));
            triggerType = obj.getString("triggerType");
            gForceX = obj.getDouble("triggerForceX");
            gForceY = obj.getDouble("triggerForceY");
            gForceZ = obj.getDouble("triggerForceZ");
            if (obj.has("editingDate")) {
                editingDate = new SimpleDateFormat("HH:mm:ss.SSS dd.MM.yyyy")
                        .format(new Date(obj.getLong("editingDate")));
            }
        } catch (JSONException e) {
            return errors.getString("metadataFail");
        }
        final StringBuilder builder = new StringBuilder();
        builder.append("Recording Date: ").append(date).append("\n");
        builder.append("Trigger type: ").append(triggerType).append("\n");
        builder.append("G-Force (X): ").append(gForceX).append("\n");
        builder.append("G-Force (Y): ").append(gForceY).append("\n");
        builder.append("G-Force (Z): ").append(gForceZ);
        if (editingDate != null) {
            builder.append("\n").append("Editing Date: ").append(editingDate);
        }
        return builder.toString();
    }
private static String parseMetaJSON ( String ret ) { String date ; double gForceX ; double gForceY ; double gForceZ ; String triggerType ; String editingDate = null ; try { JSONObject obj = new JSONObject ( ret ) ; date = new SimpleDateFormat ( "HH:mm:ss.SSS dd.MM.yyyy" ) . format ( new Date ( obj . getLong ( "date" ) ) ) ; triggerType = obj . getString ( "triggerType" ) ; gForceX = obj . getDouble ( "triggerForceX" ) ; gForceY = obj . getDouble ( "triggerForceY" ) ; gForceZ = obj . getDouble ( "triggerForceZ" ) ; if ( obj . has ( "editingDate" ) ) { editingDate = new SimpleDateFormat ( "HH:mm:ss.SSS dd.MM.yyyy" ) . format ( new Date ( obj . getLong ( "editingDate" ) ) ) ; } } catch ( JSONException e ) { return errors . getString ( "metadataFail" ) ; } final StringBuilder builder = new StringBuilder ( ) ; builder . append ( "Recording Date: " ) . append ( date ) . append ( "\n" ) ; builder . append ( "Trigger type: " ) . append ( triggerType ) . append ( "\n" ) ; builder . append ( "G-Force (X): " ) . append ( gForceX ) . append ( "\n" ) ; builder . append ( "G-Force (Y): " ) . append ( gForceY ) . append ( "\n" ) ; builder . append ( "G-Force (Z): " ) . append ( gForceZ ) ; if ( editingDate != null ) { builder . append ( "\n" ) . append ( "Editing Date: " ) . append ( editingDate ) ; } return builder . toString ( ) ; }
This method parses the meta object to a String
 @param ret meta info as json
 @return the created string
This method parses the meta object to a String @param ret meta info as json @return the created string