@@ -0,0 +1,2045 @@
+/*%0A * Copyright 2016 E-System LLC%0A *%0A *    Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *    you may not use this file except in compliance with the License.%0A *    You may obtain a copy of the License at%0A *%0A *        http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *    Unless required by applicable law or agreed to in writing, software%0A *    distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *    See the License for the specific language governing permissions and%0A *    limitations under the License.%0A */%0Apackage com.es.lib.common.model;%0A%0Aimport org.apache.commons.lang3.StringUtils;%0A%0Aimport java.io.Serializable;%0A%0A/**%0A * @author Dmitriy Zuzoev - zuzoev.d@ext-system.com%0A * @since 01.02.16%0A */%0Apublic interface IStore extends Serializable %7B%0A%0A    String getFileName();%0A%0A    String getFileExt();%0A%0A    String getFullName();%0A%0A    long getCrc32();%0A%0A    long getSize();%0A%0A    String getMime();%0A%0A    String getAbbreviatedFileName(int maxWidth);%0A%0A    boolean isImage();%0A%0A    default String getUrl() %7B%0A        return null;%0A    %7D%0A%0A    default boolean isOnlyLink() %7B%0A        return StringUtils.isNotBlank(getUrl());%0A    %7D%0A%0A    static String fullName(IStore item) %7B%0A        return item.getFileName() + %22.%22 + item.getFileExt();%0A    %7D%0A%0A    static String abbreviatedFileName(IStore item, int maxWidth) %7B%0A        int extSize = item.getFileExt().length();%0A        int nameSize = item.getFileName().length();%0A        if ((nameSize + extSize + 1) %3C maxWidth) %7B%0A            return item.getFullName();%0A        %7D%0A        return StringUtils.abbreviateMiddle(item.getFileName(), %22..%22, maxWidth - extSize - 1) + %22.%22 + item.getFileExt();%0A    %7D%0A%0A    static boolean isImage(IStore store) %7B%0A        return store != null && isImage(store.getMime());%0A    %7D%0A%0A    static boolean isMime(String mime, String part) %7B%0A        return mime != null && mime.contains(part);%0A    %7D%0A%0A    static boolean isImage(String mime) %7B%0A        return isMime(mime, %22image%22);%0A    %7D%0A%7D%0A

Add IStore