public String value1() { if (item1 == null) return null; if (item1 instanceof String) return (String) item1; String format = (String) indexItem.valueForKeyPath("local.titlePath"); if (format != null) return WOMessage.stringByEscapingHTMLString( (String) NSKeyValueCodingAdditions.Utility.valueForKeyPath(item1, format)); format = (String) indexItem.valueForKeyPath("local.format"); if (format == null) return item1.toString(); NSArray fa = (NSArray) indexItem.valueForKeyPath("local.formatArgs"); Object[] args = null; if (fa != null && fa.count() > 0) { args = new Object[fa.count()]; for (int i = 0; i < args.length; i++) { args[i] = DisplayAny.ValueReader.evaluateValue(fa.objectAtIndex(i), item1, this); } } return WOMessage.stringByEscapingHTMLString(String.format(format, args)); }
private String localValue() { if (item1 == null || item1 instanceof String) { return (String) item1; } else { String path = (String) indexItem.valueForKeyPath("local.valuePath"); if (path == null) { return MyUtility.getID((EOEnterpriseObject) item1); } else { return NSKeyValueCodingAdditions.Utility.valueForKeyPath(item1, path).toString(); } } }
public static WOActionResults exportJournalZPU( NSArray journal, WOContext context, String filename) { WOSession ses = context.session(); if (journal == null || journal.count() == 0) { WOResponse response = WOApplication.application().createResponseInContext(context); response.appendContentString( (String) ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.Tabel.noData")); response.setHeader("application/octet-stream", "Content-Type"); response.setHeader("attachment; filename=\"noData.txt\"", "Content-Disposition"); return response; } Export export = new ExportCSV(context, filename); export.beginRow(); export.addValue(ses.valueForKeyPath("strings.Reusables_Strings.dataTypes.Date")); export.addValue(ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.OrigTeacher")); export.addValue(ses.valueForKeyPath("strings.RujelInterfaces_Names.EduCycle.subject")); export.addValue(ses.valueForKeyPath("strings.RujelInterfaces_Names.EduGroup.this")); export.addValue(ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.Reason.Reason")); export.addValue(ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.Reason.verification")); export.addValue( ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.Substitute.Substitutor")); export.addValue(ses.valueForKeyPath("strings.RujelInterfaces_Names.EduCycle.subject")); export.addValue(ses.valueForKeyPath("strings.RujelCurriculum_Curriculum.Substitute.factor")); Enumeration enu = journal.objectEnumerator(); StringBuilder buf = new StringBuilder(); while (enu.hasMoreElements()) { NSDictionary dict = (NSDictionary) enu.nextElement(); export.beginRow(); export.addValue(MyUtility.dateFormat().format(dict.valueForKey("date"))); EduCourse course = (EduCourse) dict.valueForKey("minusCourse"); if (course != null) { Teacher teacher = (Teacher) dict.valueForKey("minusTeacher"); if (teacher != null) export.addValue(Person.Utility.fullName(teacher, true, 2, 1, 1)); else export.addValue(ses.valueForKeyPath("strings.RujelBase_Base.vacant")); if (course.comment() == null) { export.addValue(course.cycle().subject()); } else { buf.delete(0, buf.length()); buf.append(course.cycle().subject()); buf.append(' ').append('(').append(course.comment()).append(')'); export.addValue(buf.toString()); } } else { export.addValue(null); export.addValue(null); } if (dict.valueForKey("eduGroup") != null) export.addValue(dict.valueForKeyPath("eduGroup.name")); else export.addValue(dict.valueForKey("grade")); export.addValue(dict.valueForKeyPath("reason.title")); export.addValue(dict.valueForKeyPath("reason.verification")); course = (EduCourse) dict.valueForKey("plusCourse"); if (course != null) { Teacher teacher = (Teacher) dict.valueForKey("plusTeacher"); export.addValue(Person.Utility.fullName(teacher, true, 2, 1, 1)); if (course.comment() == null) { export.addValue(course.cycle().subject()); } else { buf.delete(0, buf.length()); buf.append(course.cycle().subject()); buf.append(' ').append('(').append(course.comment()).append(')'); export.addValue(buf.toString()); } } else { export.addValue(null); export.addValue(null); } export.addValue(dict.valueForKey("value")); } return export; }