All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vfny.geoserver.global.dto.StyleDTO Maven / Gradle / Ivy

There is a newer version: 1.7.0
Show newest version
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */

/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org.  All rights reserved.
 * This code is licensed under the GPL 2.0 license, availible at the root
 * application directory.
 */
package org.vfny.geoserver.global.dto;

import java.io.File;


/**
 * Data Transfer Object for style information.
 *
 * 

* Defines the style ids to be used by the wms. The files must be contained * in geoserver/misc/wms/styles. We're working on finding a better place for * them, but for now that's where you must put them if you want them on the * server. *

* *

* StyleDTO styleDto = new StyleDTO(); styleDto.setDefault(false); * styleDto.setId("My Style"); styleDto.setFilename(new File(myStyle.sld)); *

* * @author dzwiers, Refractions Research, Inc. * @version $Id: StyleDTO.java 6326 2007-03-15 18:36:40Z jdeolive $ */ public final class StyleDTO implements DataTransferObject { /** The syle id. */ private String id; /** The file which contains more information about the style. */ private File filename; /** whether this is the system's default style. */ private boolean _default; /** * StyleConfig constructor. * *

* does nothing *

*/ public StyleDTO() { } /** * StyleConfig constructor. * *

* Creates a copy of the StyleConfig provided. If the StyleConfig provided * is null then default values are used. All the data structures are * cloned. *

* * @param style The style to copy. * * @throws NullPointerException DOCUMENT ME! */ public StyleDTO(StyleDTO style) { if (style == null) { throw new NullPointerException(); } id = style.getId(); filename = new File(style.getFilename().toString()); _default = style.isDefault(); } /** * Implement clone. * *

* creates a clone of this object *

* * @return A copy of this StyleConfig * * @see java.lang.Object#clone() */ public Object clone() { return new StyleDTO(this); } /** * Implement equals. * *

* recursively tests to determine if the object passed in is a copy of this * object. *

* * @param obj The StyleConfig object to test. * * @return true when the object passed is the same as this object. * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if ((obj == null) || !(obj instanceof StyleDTO)) { return false; } StyleDTO style = (StyleDTO) obj; boolean r = true; r = r && (id == style.getId()); if (filename != null) { r = r && filename.equals(style.getFilename()); } r = r && (_default == style.isDefault()); return r; } /** * Implement hashCode. * * @return Service hashcode or 0 * * @see java.lang.Object#hashCode() */ public int hashCode() { int r = 1; if (id != null) { r *= id.hashCode(); } if (filename != null) { r *= filename.hashCode(); } return r; } /** * isDefault purpose. * *

* Description ... *

* * @return */ public boolean isDefault() { return _default; } /** * getFilename purpose. * *

* Description ... *

* * @return */ public File getFilename() { return filename; } /** * getId purpose. * *

* Description ... *

* * @return */ public String getId() { return id; } /** * setDefault purpose. * *

* Description ... *

* * @param b */ public void setDefault(boolean b) { _default = b; } /** * setFilename purpose. * *

* Description ... *

* * @param file */ public void setFilename(File file) { filename = file; } /** * setId purpose. * *

* Description ... *

* * @param string */ public void setId(String string) { id = string; } public String toString() { return "Style: " + id + " at " + filename + (_default ? "default" : ""); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy