/*
 * Created on 08 December 2005, 12:45
 *
 * (C) 2005-2007 Copyright ANSTO. All rights reserved.
 */

package au.gov.ansto.bragg.nexus.base;

//import au.gov.ansto.bragg.base.entity.EntityBean;
//import au.gov.ansto.bragg.base.entity.EntityBean_;

import java.beans.PropertyVetoException;
import java.util.HashMap;
import java.util.Map;


//import javax.persistence.*;

/** Default implementation of NXobject, and thus the root of all default NeXusBean implementation classes.
 *
 * <p>
 * Provides support for registration of attribute properties that are NeXus fields
 * to assist customised serialization engines (such as the customised XStream-based
 * NeXusBean reader/writer already presented at NIAC2006).
 * </p>
 *
 * <b>metadoc:</b> throughout Darren Kelly's APIs default implementation classes are indicated with a trailing underscore
 * (rather than the verbose trailing 'Impl' convention popular amongst Eclipse advocates). The '_' convention
 * is important for concise representation of port-based systems in UML diagrams.
 *
 * @author dke
 */

//abstract
//@Entity

public class NXobject_ 
//        extends EntityBean_ 
        implements NXobject
{   
    static final protected String NX_PREFIX = "NX_";//TODO justify default strategy
    //dke: WARNING: some meta-DTDs inconsistent on prefix use

    /**
     * 
     * Creates a new instance of NXobject_
     */
    public NXobject_() {
    }
     
//    //@Transient
//    /** A registry of fields known to be specific to NeXus.
//     */
//    static private Map neXusFields_;
//    static private Map NeXusFields() {
//        if (neXusFields_==null) neXusFields_ = new HashMap();
//        return neXusFields_;
//    }
//    
//    //@Transient
//    /** Whether the given attribute property is a nexus field */
//    static public boolean isNeXusField(String property) {
//        return NeXusFields().containsKey(property);
//    }
//    
//    /** Whether the given attribute property is a nexus field within the given class */
//    static public boolean isNeXusField(String property, Class clazz) {
//        return NeXusFields().containsKey(property) && 
//                ((Class)NeXusFields().get(property)).isAssignableFrom(clazz);
//    }
//    
//    /** Registers the given attribute property as a nexus field for the given class 
//     */
//    static public void registerNeXusField(String property,Class clazz)  {
//        NeXusFields().put(property,clazz);
//    }

    /** Standard logging of exception events.
     */
    protected void error(Exception e) {
        System.out.println(getClass().getName()+" ERROR:"+e.getMessage());
        e.printStackTrace();
    }    

    /** <b>metadoc:</b> private fields for bean properties are indicated with trailing underscore 
     */
    private String name_;
    /** @inheritDoc */
    public String getName() {
        return name_;
    }

    /** @inheritDoc */
    public void setName(String name) {
        name_ = name;
    }

    private Object id_;
    
    /** @inheritDoc */
    public Object getId() {
        return id_;
    }

    /** @inheritDoc */
    public void setId(Object id) {
        id_ = id;
    }
    
}
