Pages

Monday, December 28, 2009

Method to return the names of a particular set or all design elements from a databas

/**
* Method to return the names of a particular set or all design elements from a database
* depending upon the user's input
* @param targetDB- The database from which the design elements needs to be obtained
* @param DESIGN_ELEMENT_TYPE - An integer representation of the design element type
* @return String[]
* @author karthikeyan_a
* @since 30-April-2009
* @see NotesCollection selectDesigns(Database targetDB,int DESIGN_ELEMENT_TYPE) ---> http://ozinisle.blogspot.com/2009/12/select-specific-design-elements-from.html
* @see ArrayList filterHiddenElements(ArrayList designElementNames) ---> http://ozinisle.blogspot.com/2009/12/remove-names-of-hidden-elements-from.html
* @see ArrayList removeAlias(ArrayList designElementNames) ---> http://ozinisle.blogspot.com/2009/12/remove-alias-names-from-design-element.html
* @see String[] CreateStringArrayFromVector(ArrayList stringVector) ---> http://ozinisle.blogspot.com/2009/12/create-string-array-from-vector.html
*/

public String[] getDesignElementNames(Database targetDB,int DESIGN_ELEMENT_TYPE) {

if (targetDB==null) return null;

String noteID=null;
String noteIDTemp=null;
Document dsgnDoc=null;
NoteCollection nc=null;
ArrayList designElementNames=null;
//initialize the return value
String[] designElementNamesString=null;

try {
//create an empty note collection
nc =selectDesigns(targetDB,DESIGN_ELEMENT_TYPE);
//initiate return value
designElementNames=new ArrayList();

if (nc.getCount()>0){
noteID=nc.getFirstNoteID();
//check if the noteID is neither empty nor null and get the design doc's name associated with the id
while (noteID!=null && !noteID.equals("")) { //start of noteID while
try {
noteIDTemp = noteID;
dsgnDoc=targetDB.getDocumentByID(noteIDTemp);
//add the names of the design elements into the vector
designElementNames.add(dsgnDoc.getItemValueString("$TITLE"));
noteID=nc.getNextNoteID(noteID);
} catch (NotesException ne) {
ne.printStackTrace();
}
} //end of noteID while
}
} catch (NotesException e) {
e.printStackTrace();
}

// remove alias names of design elements
designElementNames=removeAlias(designElementNames);
//filter hidden design elements
designElementNames=filterHiddenElements(designElementNames);
//create a string array of the resultant design elements name
designElementNamesString=arrayListToStringArray(designElementNames);

//recycle objects
noteID=null;
nc=null;
noteIDTemp=null;
dsgnDoc=null;
targetDB=null;
designElementNames=null;

//return the array of names
return designElementNamesString;
} //end of function::getDesignElementNames

2 comments:

  1. Thank U Sir...

    Using this Coding I came to know how to get a Design Elements names of a database at Run time...

    ReplyDelete
  2. Thanks U..

    Now I know from this coding How to get Design element names from a Database during Run time...

    ReplyDelete