Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.component.file
Class InputFileSizeValidator

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.component.file.InputFileSizeValidator
All Implemented Interfaces:
EventListener, StateHolder, Validator

public class InputFileSizeValidator
extends Object
implements Validator, StateHolder

Input file size validator.

Validates an InputFileInfo blob value in case it's been uploaded. Value is set using the "maxSize" attribute and setting it to (for instance) "10Ko", "10Mo" or "10Go".

Author:
Anahide Tchertchian

Field Summary
static String MAXIMUM_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the maximum size check fails.
static String VALIDATOR_ID
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
InputFileSizeValidator()
           
 
Method Summary
 String getMaxSize()
           
 long getMaxSizeBytes()
           
 boolean isTransient()
           
 void restoreState(FacesContext context, Object state)
           
 Object saveState(FacesContext context)
           
 void setMaxSize(String maxSizeString)
           
 void setTransient(boolean newTransientValue)
           
 void validate(FacesContext context, UIComponent component, Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final String VALIDATOR_ID
See Also:
Constant Field Values

MAXIMUM_MESSAGE_ID

public static final String MAXIMUM_MESSAGE_ID
The message identifier of the FacesMessage to be created if the maximum size check fails. The message format string for this message may optionally include the following placeholders:

See Also:
Constant Field Values
Constructor Detail

InputFileSizeValidator

public InputFileSizeValidator()
Method Detail

validate

public void validate(FacesContext context,
                     UIComponent component,
                     Object value)
              throws ValidatorException
Specified by:
validate in interface Validator
Throws:
ValidatorException

getMaxSize

public String getMaxSize()

getMaxSizeBytes

public long getMaxSizeBytes()

setMaxSize

public void setMaxSize(String maxSizeString)

isTransient

public boolean isTransient()
Specified by:
isTransient in interface StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface StateHolder

saveState

public Object saveState(FacesContext context)
Specified by:
saveState in interface StateHolder

restoreState

public void restoreState(FacesContext context,
                         Object state)
Specified by:
restoreState in interface StateHolder

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.