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

nl.cloudfarming.client.farm.model.Farm Maven / Gradle / Ivy

There is a newer version: 13.03-beta
Show newest version
/**
 * Copyright (C) 2010-2012 Agrosense [email protected]
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain a
 * copy of the License at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package nl.cloudfarming.client.farm.model;

import java.io.Serializable;
import nl.cloudfarming.client.model.*;

/**
 * Farm bean class representing a farm.
 *
 *
 * @author Timon Veenstra
 */
public class Farm extends AbstractEntity implements Serializable, EnterpriseIdProvider {
    
    private static final long serialVersionUID = 1L;
    public static final ItemIdType ITEM_ID_TYPE = ItemIdType.FRM;
    private IssuingAgency issuingAgency;
    public static final String PROP_ISSUING_AGENCY = "issuingAgency";
    private String registrationNumber;
    public static final String PROP_REGISTRATIONNUMBER = "registrationNumber";
    private Address address;
    public static final String PROP_ADDRESS = "farmAddress";

    public Farm(IssuingAgency issuingAgency, String registrationNumber) {
        super(new AgroURIFactory(issuingAgency, registrationNumber).createURI(ITEM_ID_TYPE, "1"));
        this.issuingAgency = issuingAgency;
        this.registrationNumber = registrationNumber;
    }
   
        
    private String name;
    public static final String PROP_NAME = "name";
    
    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        getPropertyChangeSupport().firePropertyChange(PROP_NAME, oldName, name);
    }
    
    

    @Override
    public IssuingAgency getIssuingAgency() {
        return issuingAgency;
    }

    /**
     * Get the value of registrationNumber
     *
     * @return the value of registrationNumber
     */
    public String getRegistrationNumber() {
        return registrationNumber;
    }

//    /**
//     * Set the value of registrationNumber
//     *
//     * @param registrationNumber new value of registrationNumber
//     */
//    public void setRegistrationNumber(String registrationNumber) {
//        String oldRegistrationNumber = this.registrationNumber;
//        this.registrationNumber = registrationNumber;
//        getPropertyChangeSupport().firePropertyChange(PROP_REGISTRATIONNUMBER, oldRegistrationNumber, registrationNumber);
//    }

    @Override
    public String getEnterpriseId() {
        return registrationNumber;
    }

    /**
     * Get the address of this farm
     * @return 
     */
    public Address getAddress() {
        return address;
    }

    /**
     * Set the address of this farm
     * @param address 
     */
    public void setAddress(Address address) {
        Address old = this.address;
        this.address = address;
        getPropertyChangeSupport().firePropertyChange(PROP_ADDRESS, old, address);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy