use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class Subform method getExplicitSubformsRecursive.
/* (non-Javadoc)
* @see org.openntf.domino.design.AnyFormOrSubform#getExplicitSubformsRecursive(java.util.List)
*/
@Override
public List<String> getExplicitSubformsRecursive(final List<String> existingList) {
Database db = getAncestorDatabase();
DatabaseDesign dbDesign = db.getDesign();
XMLNodeList nodes = getSubformNodes();
ArrayList<String> subforms = new ArrayList<String>();
for (XMLNode node : nodes) {
// $NON-NLS-1$
String name = node.getAttribute("name");
if (!Strings.isBlankString(name)) {
if (!existingList.contains(name)) {
// $NON-NLS-1$
existingList.add(node.getAttribute("name"));
org.openntf.domino.design.Subform sf = dbDesign.getSubform(name);
existingList.addAll(sf.getExplicitSubformsRecursive(subforms));
}
}
}
return existingList;
}
use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class DesignClassTest method testDesignClass.
// @Test
public void testDesignClass() throws IOException {
Session sess = Factory.getSession(SessionType.CURRENT);
// Database db = sess.getDatabase("D:/Daten/notesdaten_9/localdb/empty.ns9");
// Database db = sess.getDatabase("D:/Daten/notesdaten_9/empty2.nsf");
// Database db = sess.getDatabase("D:/Daten/notesdaten_9/localdb/proglib4work2.nsf");
Database db = sess.getDatabase("srv-01-ndev2!!entwicklung/alex/proglib4work22.nsf");
testDb(db);
DatabaseDesign design = db.getDesign();
// -X = no AgentData
DesignCollection<DesignBase> elems = design.getDesignElements(//
"!@Contains($Flags;{X}) & !($TITLE={WEB-INF/classes/plugin/Activator.class}:{$BEProfileR7}) " + "");
// + "& @IsAvailable($ACLDigest) ");
// + "& @contains($TITLE;{gadproxy}) ");
System.out.println("Count: " + elems.getCount());
Path root = Paths.get("D:/daten/temp/ods3");
OnDiskProject odp = new OnDiskProject(root);
// PrintWriter pw = new PrintWriter(oFile);
for (DesignBase elem : elems) {
// + elem.getDocument().getItemValueString("$FLAGS"));
try {
odp.export(elem);
// //elem.getDxlString(null)
// String odp = elem.getOnDiskPath();
// if (StringUtil.isEmpty(odp)) {
// odp = elem.getNoteID() + ".note";
// }
// File odsFile = new File(root, odp);
// System.out.println(elem.getClass().getName() + "\t\t\t" + odsFile);
// odsFile.getParentFile().mkdirs(); // ensure the path exists
// elem.writeOnDiskFile(odsFile);
// if (elem instanceof HasMetadata) {
// File meta = new File(odsFile.getAbsolutePath() + ".metadata");
// ((HasMetadata) elem).writeOnDiskMeta(meta);
// }
} catch (Exception ne) {
ne.printStackTrace();
}
// String path = "./" + elem.getOnDiskPath();
// String ext = elem.getOnDiskExtension();
// if (path != null && ext != null && !path.endsWith(ext))
// path = path + ext;
// pw.println(path + "\t'" + elem.getClass().getSimpleName() + "\t" + elem.getNoteID() + "\t" + elem.getName() + "\t"
// + elem.getDocument().getItemValueString("$FLAGS"));
// if (elem instanceof HasMetadata) {
// pw.println(path + ".metadata");
// }
// if (elem instanceof CustomControl) {
// pw.println(path + "-config");
// }
}
}
use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class Engage17DesignView method run.
@Override
public void run() {
Session sess = Factory.getSession(SessionType.NATIVE);
Database extLib = sess.getDatabase("oda_1.nsf");
View contacts = extLib.getView("AllContactsProgrammatic");
if (null != contacts) {
contacts.remove();
}
DatabaseDesign dbDesign = extLib.getDesign();
DesignView newView = dbDesign.createView();
newView.setSelectionFormula("SELECT Form=\"Contact\"");
newView.setName("AllContactsProgrammatic");
DesignColumn col = newView.addColumn();
col.setItemName("State");
col.setSortOrder(SortOrder.ASCENDING);
col.setTitle("STATE");
col.setCategorized(true);
DesignColumn name = newView.addColumn();
name.setFormula("FirstName+\" \"+LastName");
name.setSortOrder(SortOrder.ASCENDING);
name.setTitle("NAME");
DesignColumn name2 = newView.addColumn();
name2.setFormula("LastName");
name2.setSortOrder(SortOrder.ASCENDING);
name2.setTitle("NAME");
DesignColumn city = newView.addColumn();
city.setItemName("City");
city.setTitle("CITY");
city.setResortOrder(ResortOrder.ASCENDING);
city.setSecondarySortColumn(2);
newView.save();
}
use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class XotsNsfScanner method scanDatabase.
/**
* @param session
* @param db
* @return true, if the database has XOTS-Classes
* @throws @throws
* ServletException
*/
protected Future<List<ScheduleData>> scanDatabase(final Database db) {
// NTF Keeping JG's implementation since he made an enhancement to the IconNote class for it! :)
log_.finest("Scanning database " + db.getApiPath() + " for Xots Tasklets");
try {
Database template = db.getXPageSharedDesignTemplate();
DatabaseDesign design = template == null ? db.getDesign() : template.getDesign();
if (design.isAPIEnabled()) {
log_.info("ODA enabled database: " + db.getApiPath());
return Xots.submit(new XotsClassScanner(db.getApiPath()));
}
//
//
//
//
//
// IconNote icon = design.getIconNote();
//
// if (icon != null) {
// String[] xotsClassNames = icon.getXotsClassNames();
// if (xotsClassNames != null && xotsClassNames.length > 0) {
// if (log_.isLoggable(Level.FINE)) {
// log_.fine("Adding Xots Tasklets for database " + db.getApiPath());
// }
//
// // String dbPath = db.getFilePath().replace('\\', '/');
// // dbPath = NSFService.FILE_CASE_INSENSITIVE ? dbPath.toLowerCase() : dbPath;
// // if (!StringUtil.isEmpty(db.getServer())) {
// // dbPath = db.getServer() + "!!" + dbPath;
// // }
// //
// // NSFComponentModule module = OpenntfHttpService.sGetNsfService().loadModule(dbPath);
// //
// // Runnable loader = new LoaderRunnable(db.getApiPath(), xotsClassNames, module);
// // XotsDaemon.addToQueue(loader);
// return true;
// }
// }
} catch (UserAccessException uae) {
Factory.println(this, "WARNING: " + uae.getMessage());
// we don't log the warning in the log, as this may confuse admins.
log_.log(Level.INFO, uae.getMessage(), uae);
} catch (FileNotFoundException e) {
Factory.println(this, "WARNING: " + e.getMessage());
log_.log(Level.INFO, e.getMessage(), e);
}
return null;
}
use of org.openntf.domino.design.DatabaseDesign in project org.openntf.domino by OpenNTF.
the class AgentLog method run.
@SuppressWarnings("unchecked")
@Override
public void run() {
try {
Session sess = Factory.getSession(SessionType.NATIVE);
Database db = sess.getDatabase("PrivateTest.nsf");
DatabaseDesign dbDesign = db.getDesign();
StringBuilder sb = new StringBuilder();
for (Agent agent : db.getAgents()) {
if (null != agent.getLastRunDate()) {
DesignAgent agentDesign = dbDesign.getAgent(agent.getActualName());
sb.append(agentDesign.getRunLog());
addNewLine(sb);
List<String> strings = agentDesign.getRunLogAsList();
sb.append("Lines = " + strings.size());
addNewLine(sb);
sb.append("Duration = " + agentDesign.getLastRunDuration() + " seconds");
addNewLine(sb);
sb.append("Exceeded timeout? " + agentDesign.isLastRunExceededTimeLimit());
addNewLine(sb);
}
}
System.out.println(sb.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations