Nuxeo Enterprise Platform 5.4

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:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class InputFileSizeValidator
extends java.lang.Object
implements javax.faces.validator.Validator, javax.faces.component.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 java.lang.String MAXIMUM_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the maximum size check fails.
static java.lang.String VALIDATOR_ID
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
InputFileSizeValidator()
           
 
Method Summary
 java.lang.String getMaxSize()
           
 long getMaxSizeBytes()
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setMaxSize(java.lang.String maxSizeString)
           
 void setTransient(boolean newTransientValue)
           
 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.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 java.lang.String VALIDATOR_ID
See Also:
Constant Field Values

MAXIMUM_MESSAGE_ID

public static final java.lang.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(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     java.lang.Object value)
              throws javax.faces.validator.ValidatorException
Specified by:
validate in interface javax.faces.validator.Validator
Throws:
javax.faces.validator.ValidatorException

getMaxSize

public java.lang.String getMaxSize()

getMaxSizeBytes

public long getMaxSizeBytes()

setMaxSize

public void setMaxSize(java.lang.String maxSizeString)

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.