protected string[] getMimeTypes(cmisRenditionType[] renditions) { HashSet<string> result = null; if (renditions != null) { result = new HashSet<string>(); foreach (cmisRenditionType rendition in renditions) { result.Add(rendition.mimetype); } } return result != null ? toArray(result) : null; }
protected void assertRendition(cmisRenditionType rendition) { Assert.IsNotNull(rendition, "Rendition is null"); Assert.IsNotNull(rendition.streamId, "Rendition streamId is null"); Assert.IsNotNull(rendition.kind, "Rendition kind is null"); Assert.IsNotNull(rendition.mimetype, "Rendition mimetype is null"); if (rendition.mimetype.StartsWith(IMAGE_BASE_MIMETYPE)) { Assert.IsNotNull("Rendition width is null", rendition.width); Assert.IsNotNull("Rendition height is null", rendition.height); } logger.log("Rendition(kind='" + rendition.kind + "',mimetype='" + rendition.mimetype + "')"); }
protected string[] getBaseMimeTypes(cmisRenditionType[] renditions) { HashSet<string> result = null; if (renditions != null) { result = new HashSet<string>(); foreach (cmisRenditionType rendition in renditions) { result.Add(getBaseType(rendition.mimetype) + RENDITION_FILTER_SUBTYPES_POSTFIX); } } return result != null ? toArray(result) : null; }
protected void assertContains(cmisRenditionType rendition, string[] expectedKinds, string[] expectedMimetypes) { bool contains = false; if (expectedKinds != null) { foreach (string kind in expectedKinds) { if (rendition.kind.Equals(kind)) { contains = true; break; } } } if (expectedMimetypes != null) { foreach (string mimetype in expectedMimetypes) { if (mimetype.EndsWith(RENDITION_FILTER_SUBTYPES_POSTFIX)) { string baseMimetype = getBaseType(mimetype); if (rendition.mimetype.StartsWith(baseMimetype)) { contains = true; break; } } if (rendition.mimetype.Equals(mimetype)) { contains = true; break; } } } Assert.IsTrue(contains, "Received rendition doesn't satisfy the filter conditions"); }