Subversion Repositories SmartDukaan

Rev

Rev 4212 | Rev 4214 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4212 Rev 4213
Line 47... Line 47...
47
 *
47
 *
48
 * @author rajveer
48
 * @author rajveer
49
 *
49
 *
50
 */
50
 */
51
public class NewVUI {
51
public class NewVUI {
-
 
52
    private static final long CUTOFF_TIME_FOR_CREATION_TS = 1324030341995l;
52
    private static final String ICON_JPG = "icon.jpg";
53
    private static final String ICON_JPG = "icon.jpg";
53
    private static final String THUMBNAIL_JPG = "thumbnail.jpg";
54
    private static final String THUMBNAIL_JPG = "thumbnail.jpg";
54
    private static final String DEFAULT_JPG = "default.jpg";
55
    private static final String DEFAULT_JPG = "default.jpg";
55
    private static final String SPACE = " ";
56
    private static final String SPACE = " ";
56
    private static final String DOT = ".";
57
    private static final String DOT = ".";
Line 149... Line 150...
149
 
150
 
150
        // This flag basically determines whether 'default' labelled image has changed or not
151
        // This flag basically determines whether 'default' labelled image has changed or not
151
        // If defaultImageCreationTime is zero, i.e. either the entity is old so its image/media 
152
        // If defaultImageCreationTime is zero, i.e. either the entity is old so its image/media 
152
        // object does not have creationTime field set; or, the default image itself does'not exist!
153
        // object does not have creationTime field set; or, the default image itself does'not exist!
153
        // In either case, we shuld assume that default image does not exist
154
        // In either case, we shuld assume that default image does not exist
154
        boolean existsNewVersionedDefaultJPGFile = newVersionedDefaultJPGFile.exists() && (defaultImageCreationTime != 0);
155
        boolean existsNewVersionedDefaultJPGFile = newVersionedDefaultJPGFile.exists() && defaultImageCreationTime > CUTOFF_TIME_FOR_CREATION_TS;
155
 
156
 
156
        // If default images are not generated before, or default labelled images are absent, or the global
157
        // If default images are not generated before, or default labelled images are absent, or the global
157
        // image itself got changed, we need to copy these images.
158
        // image itself got changed, we need to copy these images.
158
        if (defaultImageCreationTime == 0 && (!existsNewVersionedDefaultJPGFile ||
159
        if (defaultImageCreationTime == 0 && (!existsNewVersionedDefaultJPGFile ||
159
                globalDefaultJPGFile.lastModified() > Long.parseLong(contentVersion)))
160
                globalDefaultJPGFile.lastModified() > Long.parseLong(contentVersion)))
Line 279... Line 280...
279
 
280
 
280
    /**
281
    /**
281
     * Retuens true in case a given image is the default one. False, otherwise.
282
     * Retuens true in case a given image is the default one. False, otherwise.
282
     */
283
     */
283
    private boolean isDefaultImage(Media image) {
284
    private boolean isDefaultImage(Media image) {
284
        return "default".equals(image.getLabel());
285
        String label = image.getLabel();
-
 
286
        return label != null && "default".equals(label.trim());
285
    }
287
    }
286
 
288
 
287
    /**
289
    /**
288
     * Copies the contents of the source file into the destination file. Creates
290
     * Copies the contents of the source file into the destination file. Creates
289
     * the destination file if it doesn't exist already.
291
     * the destination file if it doesn't exist already.