String projectPath) {
// check to see if one of our parents names a registered schedule.
StringBuffer path = new StringBuffer(projectPath);
SaveableData sd = data.getInheritableValue(path, PROJECT_SCHEDULE_NAME);
if (sd == null) return null;
SimpleData val = sd.getSimpleValue();
if (val == null || !val.test()) return null;
// We found a named schedule. Remember the prefix of the project that
// registered this schedule name. Also, save the data name for the
// corresponding schedule ID attribute.
String prefix = path.toString();
String projSchedIdDataName = DataRepository.createDataName(
prefix, PROJECT_SCHEDULE_ID);
// Next, check to see if the named schedule actually exists.
String taskListName = val.format();
if (EVTaskListData.exists(data, taskListName)
|| EVTaskListRollup.exists(data, taskListName)) {
// The named schedule exists! Retrieve its actual task list ID,
// and record this for posterity. Note that in the most common
// case, we will be recording the exact same ID value that is
// already present - but the data repository will be able to
// efficiently figure out whether a real change was made.
String taskListIdDataName = DataRepository.createDataName(
MAIN_DATA_PREFIX + taskListName, ID_DATA_NAME);
SimpleData taskListID = data.getSimpleValue(taskListIdDataName);
data.putValue(projSchedIdDataName, taskListID);
// Finally, return the name we found.
return taskListName;
}