/**
 * <!-- LICENSE_TEXT_START -->
The contents of this file are subject to the caAdapter Software License (the "License"). You may obtain a copy of the License at the following location: 
[caAdapter Home Directory]\docs\caAdapter_license.txt, or at:
http://ncicb.nci.nih.gov/infrastructure/cacore_overview/caadapter/indexContent/docs/caAdapter_License
 * <!-- LICENSE_TEXT_END -->
 */

package gov.nih.nci.caadapter.common.metadata;

import gov.nih.nci.caadapter.common.MetaObjectImpl;
import gov.nih.nci.caadapter.common.SDKMetaData;
/**
 * This class holds attributemetadata during the mapping.
 * @version 1.0
 * @created 11-Aug-2006 8:18:15 AM
 * @author LAST UPDATE $Author: wangeug $
 * @since      caAdapter  v4.2    
 * @version    $Revision: 1.7 $
 * @date       $Date: 2009-07-30 17:31:55 $
 */
public class AttributeMetadata extends MetaObjectImpl implements SDKMetaData{

	private String datatype;
	/**
	 * This attribute represents the name of an object attribute
	 * concatenated with the fully qualified domain name of the parent
	 * object.
	 */
	private String name;
	private String xPath;
	private boolean derived;
	private boolean childTag=true; //define if a child tag is required to represent this the attribute
									//as GME present a object metadata as an XML
	
	public String getDatatype(){
		return datatype;
	}

	public String getName(){
		return name;
	}

	public String toString() {  
		if (isDerived()) {
			return getName() + " (A - Derived)";
		}

        if (isChildTag()){
			return getName() + " (A)";
		}
		else
			return "@"+getName() + " (A)";
		//TODO: check for xmi
	}

	public String getTitle() {
		return getName();
	}

	public String getXPath(){
		return xPath;
	}

	public String getParentXPath() {
		String parentXPath;
		int attributeStartPoint = this.xPath.lastIndexOf(".");
		parentXPath = this.xPath.substring(0,attributeStartPoint);
		return parentXPath;
	}
	/**
	 *
	 * @param datatype
	 */
	public void setDatatype(String datatype){
 		this.datatype = datatype;
	}
	
	
	/**
	 *
	 * @param name
	 */
	public void setName(String name){
		this.name = name;
	}

	/**
	 *
	 * @param xPath
	 */
	public void setXPath(String xPath){
		this.xPath = xPath;
	}

	public boolean isDerived() {
		return derived;
	}

	public void setDerived(boolean derived) {
		this.derived = derived;
	}
	public boolean isChildTag() {
		return childTag;
	}
	public void setChildTag(boolean childTag) {
		this.childTag = childTag;
	}

}

/**
 * HISTORY      : $Log: not supported by cvs2svn $
 * HISTORY      : Revision 1.6  2008/09/25 19:30:38  phadkes
 * HISTORY      : Changes for code standards
 * HISTORY      :
*/

@@ -1411,16 +1411,35 @@
 g() %7B  %0A
+%09%09String rtnSt=%22%22;%0A
 %09%09if (is
@@ -1451,29 +1451,29 @@
 ed()) %7B%0A%09%09%09r
-eturn
+tnSt=
  getName() +
@@ -1480,21 +1480,23 @@
  %22 (A - 
-Deriv
+Inherit
 ed)%22;%0A%09%09
@@ -1501,15 +1501,14 @@
 %09%09%7D%0A
-%0A      
+%09%09else
   if
@@ -1524,26 +1524,31 @@
 Tag())%7B%0A
-%09%09%09return 
+        %09rtnSt=
 getName(
@@ -1574,21 +1574,21 @@
 lse%0A%09%09%09r
-eturn
+tnSt=
  %22@%22+get
@@ -1604,16 +1604,136 @@
 %22 (A)%22;%0A
+        if (this.getDatatype()==null)%0A        %09return rtnSt;%0A        else%0A        %09return rtnSt+%22:%22+this.getDatatype();%0A
 %09%09//TODO

Set display names for tree nodes