Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6dea84c authored by davigonz's avatar davigonz
Browse files

Include CreationDate, GetContentLength and quota properties

parent 8f7b0821
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

package at.bitfire.dav4android

import at.bitfire.dav4android.property.*

object PropertyUtils {
    fun getAllPropSet(): Array<Property.Name>{
        return arrayOf(
                DisplayName.NAME,
                GetContentType.NAME,
                ResourceType.NAME,
                GetContentLength.NAME,
                GetLastModified.NAME,
                CreationDate.NAME,
                GetETag.NAME,
                QuotaUsedBytes.NAME,
                QuotaAvailableBytes.NAME
        );
    }
}
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class CreationDate(
        var creationDate: String
): Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "creationdate")
    }

    class Factory: PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): CreationDate? {
            XmlUtils.readText(parser)?.let { it ->
                return CreationDate(it)
            }
            return null
        }
    }
}
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

/**
 * @author David González Verdugo
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class GetContentLength(
        val contentLength: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getcontentlength")
    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): GetContentLength? {
            XmlUtils.readText(parser)?.let {
                return GetContentLength(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

/**
 * @author David González Verdugo
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class QuotaAvailableBytes(
        val quotaAvailableBytes: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "quota-available-bytes")
    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): QuotaAvailableBytes? {
            XmlUtils.readText(parser)?.let {
                return QuotaAvailableBytes(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright © Ricki Hirner (bitfire web engineering).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 */

/**
 * @author David González Verdugo
 */

package at.bitfire.dav4android.property

import at.bitfire.dav4android.Property
import at.bitfire.dav4android.PropertyFactory
import at.bitfire.dav4android.XmlUtils
import org.xmlpull.v1.XmlPullParser

data class QuotaUsedBytes(
        val quotaUsedBytes: Long
) : Property {
    companion object {
        @JvmField
        val NAME = Property.Name(XmlUtils.NS_WEBDAV, "quota-used-bytes")

    }

    class Factory : PropertyFactory {
        override fun getName() = NAME

        override fun create(parser: XmlPullParser): QuotaUsedBytes? {
            XmlUtils.readText(parser)?.let {
                return QuotaUsedBytes(it.toLong())
            }
            return null
        }
    }
}
 No newline at end of file
Loading