@Override public ModuleService getModule(Serializable moduleID) { Module module; if (moduleID instanceof Long) module = (Module) moduleEngine.getModule((Long) moduleID); else module = (Module) moduleEngine.getModule(moduleID.toString()); if (module == null) return null; SFTSystem mainSystem = (SFTSystem) moduleEngine.getSystem(module); // TableService mainDataTable = this.makeBizTable(mainSystem); DemsyModuleService ret = new DemsyModuleService(module, mainDataTable); // List<TableService> childrenDataTables = new ArrayList(); List<IBizField> fkFields = bizEngine.getFieldsOfSlave(mainSystem); for (IBizField fkField : fkFields) { SFTSystem fkSystem = (SFTSystem) fkField.getSystem(); DemsyEntityTableService bizTable = this.makeBizTable(fkSystem); childrenDataTables.add(bizTable); // 设置该子表通过哪个字段引用了主表? bizTable.set("fkfield", fkField.getPropName()); // TODO:应通过模块表达式来解析数据表对象,目前暂时不支持模块对数据表的引用表达式。 } ret.setChildrenDataTables(childrenDataTables); return ret; }
@Override public TableService getTable(ModuleService moduleService) { Module module = (Module) moduleService.getEntity(); SFTSystem system = (SFTSystem) moduleEngine.getSystem(module); return this.makeBizTable(system); }
@Override public OperationService getOperation(ModuleService module, String opMode) { if (opMode == null) return null; BizAction action = (BizAction) moduleEngine.getAction((IModule) module.getEntity(), opMode); if (action == null) return null; return new DemsyEntityOperationService(action); }
@Override public SoftService getSoftService(String domain) { if (domain == null) domain = ""; synchronized (cacheSoft) { SoftService ret = cacheSoft.get(domain); if (ret == null) { DemsySoft ds = (DemsySoft) moduleEngine.getSoft(domain); if (ds != null) { ret = new DemsySoftService(ds); cacheSoft.put(domain, ret); } } return ret; } }