Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.eyeq.kona.model.resource;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import org.apache.commons.lang.builder.EqualsBuilder;
- import org.apache.commons.lang.builder.HashCodeBuilder;
- import org.apache.commons.lang.builder.ToStringBuilder;
- import com.eyeq.kona.util.SerializeUtils;
- public class MondrianResource extends AbstractResource implements OLAPResource {
- private static final long serialVersionUID = 8633821094895837285L;
- private JDBCResource resource;
- private String catalog;
- /**
- * @see com.eyeq.kona.model.datasource.EISDataSource#getType()
- */
- public final ResourceType getType() {
- return ResourceType.Mondrian;
- }
- /**
- * @return the resource
- */
- public JDBCResource getResource() {
- return resource;
- }
- /**
- * @param resource
- * the resource to set
- */
- public void setResource(JDBCResource resource) {
- this.resource = resource;
- }
- /**
- * @return the catalog
- */
- public String getCatalog() {
- return catalog;
- }
- /**
- * @param catalog
- * the catalog to set
- */
- public void setCatalog(String catalog) {
- this.catalog = catalog;
- }
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof MondrianResource)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- MondrianResource resource = (MondrianResource) obj;
- return new EqualsBuilder().append(getId(), resource.getId())
- .append(getName(), resource.getName())
- .append(catalog, resource.getCatalog())
- .append(getResource(), resource.getResource()).isEquals();
- }
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getId()).append(getName())
- .append(catalog).append(resource).toHashCode();
- }
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("id", getId())
- .append("name", getName()).append("catalog", catalog)
- .toString();
- }
- /**
- * @param os
- * @throws IOException
- */
- private void writeObject(ObjectOutputStream os) throws IOException {
- SerializeUtils.writeNullSafeUTF(getId(), os);
- SerializeUtils.writeNullSafeUTF(getName(), os);
- SerializeUtils.writeNullSafeUTF(catalog, os);
- os.writeObject(resource);
- }
- /**
- * @param is
- * @throws IOException
- * @throws ClassNotFoundException
- */
- private void readObject(ObjectInputStream is) throws IOException,
- ClassNotFoundException {
- setId(SerializeUtils.readNullSafeUTF(is));
- setName(SerializeUtils.readNullSafeUTF(is));
- this.catalog = SerializeUtils.readNullSafeUTF(is);
- this.resource = (JDBCResource) is.readObject();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement