ContentImage.java :  » Web-Framework » rife-1.6.1 » com » uwyn » rife » cmf » dam » Java Open Source

Java Open Source » Web Framework » rife 1.6.1 
rife 1.6.1 » com » uwyn » rife » cmf » dam » ContentImage.java
/*
 * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
 * Distributed under the terms of either:
 * - the common development and distribution license (CDDL), v1.0; or
 * - the GNU Lesser General Public License, v2.1 or later
 * $Id: ContentImage.java 3634 2007-01-08 21:42:24Z gbevin $
 */
package com.uwyn.rife.cmf.dam;

import com.uwyn.rife.cmf.MimeType;
import com.uwyn.rife.site.ConstrainedProperty;
import com.uwyn.rife.site.Validation;

public class ContentImage extends Validation
{
  private int     mId = -1;
  private String     mName = null;
  private byte[]    mImage = null;

  public ContentImage()
  {
  }

  protected void activateValidation()
  {
    addConstraint(new ConstrainedProperty("name")
              .maxLength(64)
              .notNull(true)
              .notEmpty(true));
    addConstraint(new ConstrainedProperty("image")
              .notNull(true)
              .mimeType(MimeType.IMAGE_PNG)
            .name("myimage.png"));
  }

  public void setId(int id)
  {
    mId = id;
  }

  public int getId()
  {
    return mId;
  }

  public void setName(String name)
  {
    mName = name;
  }

  public String getName()
  {
    return mName;
  }

  public ContentImage name(String name)
  {
    mName = name;

    return this;
  }

  public byte[] getImage()
  {
    return mImage;
  }

  public void setImage(byte[] image)
  {
    mImage = image;
  }

  public ContentImage image(byte[] image)
  {
    mImage = image;

    return this;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.