public void writeObjects(java.io.DataOutputStream file, java.lang.String path2remove) throws java.io.IOException {  Object obj; String name; Group group; Template template; Record record; VDBFieldData fieldData = null; VDBRecordData recordData; Enumeration e2;  int pos; VDBFieldData dtypFieldData;   Enumeration e = getSubObjectsV().elements(); while (e.hasMoreElements()) { obj = e.nextElement();   if (obj instanceof Record) { record = (Record)obj; recordData = record.getRecordData();  name = StringUtils.quoteIfMacro( StringUtils.removeBegining(recordData.getName(), path2remove) );   if (recordData.getComment()!=null) file.writeBytes("\n"+recordData.getComment());   file.writeBytes("\nrecord("+recordData.getType()+","+name+") {\n");    dtypFieldData = recordData.getField("DTYP"); if (dtypFieldData!=null) {   pos = 0; e2 = recordData.getFieldsV().elements(); while (e2.hasMoreElements() && fieldData!=dtypFieldData) { fieldData = (VDBFieldData)(e2.nextElement()); if ((fieldData.getType()==DBDConstants.DBF_INLINK) || (fieldData.getType()==DBDConstants.DBF_OUTLINK)) break; pos++; }  if (fieldData!=dtypFieldData) {  recordData.getFieldsV().removeElement(fieldData); recordData.getFieldsV().insertElementAt(fieldData, pos); } }    e2 = recordData.getFieldsV().elements(); while (e2.hasMoreElements()) { fieldData = (VDBFieldData)(e2.nextElement());   if (fieldData.getComment()!=null) file.writeBytes(fieldData.getComment()+"\n");   if (!fieldData.hasDefaultValue() ) {   if ((fieldData.getType()==DBDConstants.DBF_INLINK) || (fieldData.getType()==DBDConstants.DBF_OUTLINK) || (fieldData.getType()==DBDConstants.DBF_FWDLINK)) file.writeBytes("  field("+fieldData.getName()+",\""+StringUtils.removeBegining(fieldData.getValue(), path2remove)+"\")\n"); else file.writeBytes("  field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n");  }  else if (fieldData.getComment()!=null) {  if ((((fieldData.getType()==DBDConstants.DBF_MENU) || (fieldData.getType()==DBDConstants.DBF_DEVICE)) && (fieldData.getValue().equals(com.cosylab.vdct.Constants.NONE) || fieldData.getValue().equals(fieldData.getDbdData().getInit_value()+Constants.MENU_DEFAULT_VALUE_INDICATOR))) || fieldData.getValue().equals(nullString))    file.writeBytes("  "+com.cosylab.vdct.db.DBConstants.commentString+ "field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n"); else file.writeBytes("  field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n");  } }  file.writeBytes("}\n"); } else if (obj instanceof Group) { group = (Group)obj; group.writeObjects(file, path2remove); } else if (obj instanceof Template) { template = (Template)obj; template.writeObjects(file, path2remove); } }
public void writeObjects(java.io.DataOutputStream file, NameManipulator namer) throws java.io.IOException { writeObjects(getSubObjectsV(), file, namer);
public void writeObjects(java.io.DataOutputStream file, java.lang.String path2remove) throws java.io.IOException { Object obj; String name; Group group; Template template; Record record; VDBFieldData fieldData = null; VDBRecordData recordData; Enumeration e2; int pos; VDBFieldData dtypFieldData;  	 Enumeration e = getSubObjectsV().elements(); while (e.hasMoreElements())  	{	 	obj = e.nextElement();		 	// go throught the records		 	if (obj instanceof Record)	 		{			 	record = (Record)obj;	 			recordData = record.getRecordData();			 	name = StringUtils.quoteIfMacro(				 		StringUtils.removeBegining(recordData.getName(), path2remove)				 		);			 	// write comment			 	if (recordData.getComment()!=null)			 		file.writeBytes("\n"+recordData.getComment());			 						// write "record" block		 		file.writeBytes("\nrecord("+recordData.getType()+","+name+") {\n");		 		// locate DTYP field 				dtypFieldData = recordData.getField("DTYP"); 				if (dtypFieldData!=null) 					{			 		// check if DTYP field is before DBF_INLINK/DBF_OUTLINK fields	 				pos = 0;			 		e2 = recordData.getFieldsV().elements();					while (e2.hasMoreElements() && fieldData!=dtypFieldData)						{							fieldData = (VDBFieldData)(e2.nextElement());							if ((fieldData.getType()==DBDConstants.DBF_INLINK) ||							    (fieldData.getType()==DBDConstants.DBF_OUTLINK)) 								break;							pos++;						}						 		if (fieldData!=dtypFieldData)			 			{					 		// move DTYP before first occurence of DBF_INLINK/DBF_OUTLINK fields					 		recordData.getFieldsV().removeElement(fieldData);	 						recordData.getFieldsV().insertElementAt(fieldData, pos);				 		} 					}				// write fields	 					 		e2 = recordData.getFieldsV().elements();				while (e2.hasMoreElements())					{						fieldData = (VDBFieldData)(e2.nextElement());						// write comment						if (fieldData.getComment()!=null)							file.writeBytes(fieldData.getComment()+"\n");													// if value is different from init value						if (!fieldData.hasDefaultValue() /*&&					!!! is default value enough							!(((fieldData.getType()==DBDConstants.DBF_MENU) ||							   (fieldData.getType()==DBDConstants.DBF_DEVICE)) && 							  fieldData.getValue().equals(com.cosylab.vdct.Constants.NONE) && menu...)*/)							{											    				// write field value								if ((fieldData.getType()==DBDConstants.DBF_INLINK) ||								    (fieldData.getType()==DBDConstants.DBF_OUTLINK) ||								    (fieldData.getType()==DBDConstants.DBF_FWDLINK))									file.writeBytes("  field("+fieldData.getName()+",\""+StringUtils.removeBegining(fieldData.getValue(), path2remove)+"\")\n");						 		 else	 								file.writeBytes("  field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n");				    			 				}						// write field value if has a comment		 				else if (fieldData.getComment()!=null)		 			       	{							if ((((fieldData.getType()==DBDConstants.DBF_MENU) ||							   	  (fieldData.getType()==DBDConstants.DBF_DEVICE)) && 							  	 (fieldData.getValue().equals(com.cosylab.vdct.Constants.NONE) ||							  	 fieldData.getValue().equals(fieldData.getDbdData().getInit_value()+Constants.MENU_DEFAULT_VALUE_INDICATOR))) || 							  	fieldData.getValue().equals(nullString))								// up code is a little bi messy, consider using hasDefaultValue(), etc. !!!															// comment it out if it has null value				 				file.writeBytes("  "+com.cosylab.vdct.db.DBConstants.commentString+					 							  "field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n");							else								file.writeBytes("  field("+fieldData.getName()+",\""+fieldData.getValue()+"\")\n");											 				}	 				}						file.writeBytes("}\n"); 			 } 	 	else if (obj instanceof Group) 	 		{			 	 group = (Group)obj;			 	 group.writeObjects(file, path2remove);	 		} 	    else if (obj instanceof Template) 	 		{			 	 template = (Template)obj;			 	 template.writeObjects(file, path2remove);	 		}  }}