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

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

The newest version!
/**
 * Copyright (C) 2008-2012 AgroSense Foundation.
 *
 * AgroSense is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
 * this software, see the FLOSS License Exception
 * .
 *
 * AgroSense is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AgroSense.  If not, see .
 */
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