Monday, December 28, 2009

Select specific design elements from a Lotus Notes database

/**
* Method to return 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 NoteCollection
* @author karthikeyan_a
* @since 29-April-2009
*/

public NoteCollection selectDesignElements(Database targetDB,int DESIGN_ELEMENT_TYPE) throws NotesException {

//declaration of constants
int ACL=1;
int ACTIONS=2;
int AGENTS=3;
int DATABASE_SCRIPT=4;
int DATA_CONNECTIONS=5;
int DOCUMENTS=6;
int FOLDERS=7;
int FORMS=8;
int FRAMESETS=9;
int HELP_ABOUT=10;
int HELP_INDEX=11;
int HELP_USING=12;
int ICON=13;
int IMAGE_RESOURCES=14;
int JAVA_RESOURCES=15;
int MISC_CODE_ELEMENTS=16;
int MISC_FORMAT_ELEMENTS=17;
int MISC_INDEX_ELEMENTS=18;
int NAVIGATORS=19;
int OUTLINES=20;
int PAGES=21;
int PROFILES=22;
int REPLICATION_FORMULAS=23;
int SCRIPT_LIBRARIES=24;
int SHARED_FIELDS=25;
int STYLE_SHEET_RESOURCES=26;
int SUB_FORMS=27;
int VIEWS=28;

NoteCollection nc=null;
nc = targetDB.createNoteCollection(false);
switch (DESIGN_ELEMENT_TYPE) {
case 1:
nc.setSelectAcl(true);
break;
case 2:
nc.setSelectActions(true);
break;
case 3:
nc.setSelectAgents(true);
break;
case 4:
nc.setSelectDatabaseScript(true);
break;
case 5:
nc.setSelectDataConnections(true);
break;
case 6:
nc.setSelectDocuments(true);
break;
case 7:
nc.setSelectFolders(true);
break;
case 8:
nc.setSelectForms(true);
case 9:
nc.setSelectFramesets(true);
break;
case 10:
nc.setSelectHelpAbout(true);
break;
case 11:
nc.setSelectHelpIndex(true);
break;
case 12:
nc.setSelectHelpUsing(true);
break;
case 13:
nc.setSelectIcon(true);
break;
case 14:
nc.setSelectImageResources(true);
break;
case 15:
nc.setSelectJavaResources(true);
break;
case 16:
nc.setSelectMiscCodeElements(true);
break;
case 17:
nc.setSelectMiscFormatElements(true);
break;
case 18:
nc.setSelectMiscIndexElements(true);
break;
case 19:
nc.setSelectNavigators(true);
break;
case 20:
nc.setSelectOutlines(true);
break;
case 21:
nc.setSelectPages(true);
break;
case 22:
nc.setSelectProfiles(true);
break;
case 23:
nc.setSelectReplicationFormulas(true);
break;
case 24:
nc.setSelectScriptLibraries(true);
break;
case 25:
nc.setSelectSharedFields(true);
break;
case 26:
nc.setSelectStylesheetResources(true);
break;
case 27:
nc.setSelectSubforms(true);
break;
case 28:
nc.setSelectViews(true);
break;
default: nc.selectAllNotes(true);
}
//build the design document collection of the resultant collection
nc.buildCollection();
//return the design collection
return nc;
} //end of function::selectDesigns

No comments:

Post a Comment