Пример #1
0
        public static WebDavProperty parseProperty(XmlTextReader reader)
        {
            WebDavProperty property;

            String propertyName = reader.Name;

            while (true)
            {
                if (propertyName.EndsWith("D:" + DavProperty.DISPLAYNAME))
                {
                    property = new DisplayNameProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.RESOURCETYPE))
                {
                    property = new ResourceTypeProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.GETCONTENTTYPE))
                {
                    property = new ContentTypeProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.CREATIONDATE))
                {
                    property = new CreationDateProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.GETLASTMODIFIED))
                {
                    property = new LastModifiedProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.SUPPORTEDLOCK))
                {
                    property = new SupportedLockProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.CHECKEDIN)) {
                    property = new CheckedInProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.SUPPORTEDQUERYGRAMMARSET)) {
                    property = new SupportedQueryGrammarSetProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.GETCONTENTLENGTH))
                {
                    property = new ContentLenghtProperty();
                    break;
                }

                if (propertyName.EndsWith("D:" + DavProperty.ORDERINGTYPE)) {
                    property = new OrderingTypeProperty();
                    break;
                }

                property = new WebDavProperty(propertyName);
                break;
            }

            property.init(reader);

            return property;
        }
Пример #2
0
        private int getImageIdByMimeType(WebDavProperty mimeTypeProperty)
        {
            if (mimeTypeProperty == null) {
                return 9;
            }

            String mimeType = mimeTypeProperty.getTextContent();

            if (mimeType == MimeTypes.MIMETYPE_TXT || mimeType == MimeTypes.MIMETYPE_TXTPLAIN)
            {
                return 9;
            }

            if (mimeType == MimeTypes.MIMETYPE_DOC || mimeType == MimeTypes.MIMETYPE_WORD)
            {
                return 10;
            }

            if (mimeType == MimeTypes.MIMETYPE_DOT)
            {
                return 11;
            }

            if (mimeType == MimeTypes.MIMETYPE_HTML)
            {
                return 12;
            }

            if (mimeType == MimeTypes.MIMETYPE_XLS) {
                return 13;
            }

            if (mimeType == MimeTypes.MIMETYPE_PPT) {
                return 14;
            }

            if (mimeType == MimeTypes.MIMETYPE_XLT) {
                return 15;
            }

            if (mimeType == MimeTypes.MIMETYPE_XML) {
                return 16;
            }

            return 9;
        }