Changeset 4906


Ignore:
Timestamp:
Apr 24, 2009, 3:53:14 PM (13 years ago)
Author:
Martin Svensson
Message:

References #1128 More item-pages updated

Location:
trunk/www/admin
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/admin/groups/index.jsp

    r4889 r4906  
    3939  import="net.sf.basedb.core.PermissionDeniedException"
    4040  import="net.sf.basedb.core.ItemAlreadyExistsException"
     41  import="net.sf.basedb.core.query.Expressions"
     42  import="net.sf.basedb.core.query.Hql"
     43  import="net.sf.basedb.core.query.Orders"
     44  import="net.sf.basedb.core.query.Restrictions"
    4145  import="net.sf.basedb.util.RemovableUtil"
    4246  import="net.sf.basedb.clients.web.Base"
    4347  import="net.sf.basedb.clients.web.WebException"
    4448  import="net.sf.basedb.util.Values"
     49  import="net.sf.basedb.util.formatter.NameableFormatter"
    4550  import="net.sf.basedb.clients.web.util.HTML"
     51  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    4652  import="java.util.Enumeration"
    4753  import="java.util.Set"
     
    5561  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,isDefault,description");
    5662  private static final Item itemType = Item.GROUP;
     63 
     64  private static void registerExportUtils(ItemContext cc)
     65  {
     66    // Register formatters
     67    cc.setObject("export.formatter.&children(name)", new NameableFormatter());
     68    cc.setObject("export.formatter.&users(name)", new NameableFormatter());
     69   
     70   
     71    // Register dataloaders
     72    String groupParameter = "group";
     73    // Groups
     74    ItemQuery<Group> groupQuery = Group.getQuery();
     75    groupQuery.include(cc.getInclude());
     76    groupQuery.join(Hql.innerJoin("parents", "p"));
     77    groupQuery.restrict(Restrictions.eq(Hql.alias("p"), Expressions.parameter(groupParameter)));
     78    groupQuery.order(Orders.asc(Hql.property("name")));
     79    cc.setObject("export.dataloader.&children(name)", new ItemQueryLoader(groupQuery, groupParameter));
     80
     81    // Users
     82    ItemQuery<User> userQuery = User.getQuery();
     83    userQuery.include(cc.getInclude());
     84    userQuery.join(Hql.innerJoin("groups", "grp"));
     85    userQuery.restrict(Restrictions.eq(Hql.alias("grp"), Expressions.parameter(groupParameter)));
     86    userQuery.order(Orders.asc(Hql.property("name")));
     87    cc.setObject("export.dataloader.&users(name)", new ItemQueryLoader(userQuery, groupParameter));
     88  }
    5789%>
    5890<%
     
    230262    cc.configureQuery(query, true);
    231263    cc.setQuery(query);
     264    registerExportUtils(cc);
    232265    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+groups";
    233266  }
     
    236269    // Run an export plugin in single-item context
    237270    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     271    registerExportUtils(cc);
    238272    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+group";
    239273  }
  • trunk/www/admin/groups/list_groups.jsp

    r4889 r4906  
    277277        datatype="string"
    278278        filterable="true"
     279        exportable="true"
    279280      />
    280281      <tbl:columndef
     
    284285        datatype="string"
    285286        filterable="true"
     287        exportable="true"
    286288      />
    287289      <tbl:columndef
  • trunk/www/admin/platforms/index.jsp

    r4510 r4906  
    3838  import="net.sf.basedb.core.MultiPermissions"
    3939  import="net.sf.basedb.core.PermissionDeniedException"
     40  import="net.sf.basedb.core.PlatformVariant"
    4041  import="net.sf.basedb.core.ItemAlreadyExistsException"
    41   import="net.sf.basedb.util.RemovableUtil"
     42  import="net.sf.basedb.core.query.Expressions"
     43  import="net.sf.basedb.core.query.Hql"
     44  import="net.sf.basedb.core.query.Orders"
     45  import="net.sf.basedb.core.query.Restrictions"
     46  import="net.sf.basedb.util.RemovableUtil"
    4247  import="net.sf.basedb.clients.web.Base"
    4348  import="net.sf.basedb.clients.web.WebException"
     
    4550  import="net.sf.basedb.clients.web.util.HTML"
    4651  import="net.sf.basedb.util.formatter.Formatter"
     52  import="net.sf.basedb.util.formatter.NameableFormatter"
     53  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    4754  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
    4855  import="java.util.Date"
     
    5764  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,fileOnly,externalId,description");
    5865  private static final Item itemType = Item.PLATFORM;
     66 
     67  private static void registerExportUtils(ItemContext cc)
     68  {
     69    // Register formatters
     70    cc.setObject("export.formatter.&variants(name)", new NameableFormatter());
     71   
     72    // Register dataloaders
     73    String platformParameter = "platform";
     74    final ItemQuery<PlatformVariant> variantQuery = PlatformVariant.getQuery();
     75    variantQuery.include(cc.getInclude());
     76    variantQuery.restrict(Restrictions.eq(Hql.property("platform"), Expressions.parameter(platformParameter)));
     77    variantQuery.order(Orders.asc(Hql.property("name")));
     78    cc.setObject("export.dataloader.&variants(name)", new ItemQueryLoader(variantQuery, platformParameter));
     79  }
    5980%>
    6081<%
     
    232253    cc.configureQuery(query, true);
    233254    cc.setQuery(query);
     255    registerExportUtils(cc);
    234256    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+platforms";
    235257  }
     
    238260    // Run an export plugin in single-item context
    239261    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     262    registerExportUtils(cc);
    240263    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+platform";
    241264  }
  • trunk/www/admin/platforms/list_platforms.jsp

    r4886 r4906  
    272272        datatype="string"
    273273        filterable="true"
     274        exportable="true"
    274275      />
    275276      <tbl:columndef
  • trunk/www/admin/plugindefinitions/index.jsp

    r4889 r4906  
    4242  import="net.sf.basedb.core.BaseException"
    4343  import="net.sf.basedb.core.PermissionDeniedException"
     44  import="net.sf.basedb.core.PluginConfiguration"
    4445  import="net.sf.basedb.core.ItemAlreadyExistsException"
    4546  import="net.sf.basedb.core.RoleKey"
    4647  import="net.sf.basedb.core.plugin.Plugin"
     48  import="net.sf.basedb.core.query.Expressions"
    4749  import="net.sf.basedb.core.query.Hql"
     50  import="net.sf.basedb.core.query.Orders"
     51  import="net.sf.basedb.core.query.Restrictions"
    4852  import="net.sf.basedb.util.FileUtil"
    4953  import="net.sf.basedb.util.PluginInfo"
     
    5458  import="net.sf.basedb.util.JarClassLoader"
    5559  import="net.sf.basedb.util.RegexpFileFilter"
     60  import="net.sf.basedb.util.Values"
     61  import="net.sf.basedb.util.formatter.NameableFormatter"
    5662  import="net.sf.basedb.clients.web.Base"
    5763  import="net.sf.basedb.clients.web.PermissionUtil"
    58   import="net.sf.basedb.clients.web.WebException"
    59   import="net.sf.basedb.util.Values"
     64  import="net.sf.basedb.clients.web.WebException" 
     65  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    6066  import="net.sf.basedb.clients.web.util.HTML"
    6167  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
     
    7682  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,pluginType,className,description");
    7783  private static final Item itemType = Item.PLUGINDEFINITION;
     84 
     85  private static void registerExportUtils(ItemContext cc)
     86  {
     87    // Register formatters
     88    cc.setObject("export.formatter.&configurations(name)", new NameableFormatter());
     89   
     90    // Register dataloaders
     91    String pluginParameter = "plugin";
     92    ItemQuery<PluginConfiguration> configQuery = PluginConfiguration.getQuery();
     93    configQuery.include(cc.getInclude());
     94    configQuery.restrict(Restrictions.eq(Hql.property("pluginDefinition"), Expressions.parameter("plugin")));
     95    configQuery.order(Orders.asc(Hql.property("name")));
     96    cc.setObject("export.dataloader.&configurations(name)", new ItemQueryLoader(configQuery, pluginParameter));
     97  }
    7898%>
    7999<%
     
    454474    cc.configureQuery(query, true);
    455475    cc.setQuery(query);
     476    registerExportUtils(cc);
    456477    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+plugins";
    457478  }
     
    460481    // Run an export plugin in single-item context
    461482    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     483    registerExportUtils(cc);
    462484    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+plugin";
    463485  }
  • trunk/www/admin/plugindefinitions/list_plugins.jsp

    r4889 r4906  
    334334        datatype="string"
    335335        filterable="true"
     336        exportable="true"
    336337      />
    337338      <tbl:columndef
  • trunk/www/admin/plugintypes/index.jsp

    r4889 r4906  
    3535  import="net.sf.basedb.core.MultiPermissions"
    3636  import="net.sf.basedb.core.PermissionDeniedException"
     37  import="net.sf.basedb.core.PluginDefinition"
    3738  import="net.sf.basedb.core.ItemAlreadyExistsException"
     39  import="net.sf.basedb.core.query.Expressions"
     40  import="net.sf.basedb.core.query.Hql"
     41  import="net.sf.basedb.core.query.Orders"
     42  import="net.sf.basedb.core.query.Restrictions"
    3843  import="net.sf.basedb.util.RemovableUtil"
     44  import="net.sf.basedb.util.formatter.NameableFormatter"
    3945  import="net.sf.basedb.clients.web.Base"
    4046  import="net.sf.basedb.clients.web.WebException"
    4147  import="net.sf.basedb.util.Values"
     48  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    4249  import="net.sf.basedb.clients.web.util.HTML"
    4350  import="java.util.Enumeration"
     
    5259  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,interfaceName,description");
    5360  private static final Item itemType = Item.PLUGINTYPE;
     61 
     62  private static void registerExportUtils(ItemContext cc)
     63  {
     64    // Register formatters
     65    cc.setObject("export.formatter.&plugins(name)", new NameableFormatter());
     66   
     67    // Register dataloaders
     68    String typeParameter = "pluginType";
     69    ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery();
     70    pluginQuery.include(cc.getInclude());
     71    pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
     72    pluginQuery.join(Hql.innerJoin("pluginTypes", "pt"));
     73    pluginQuery.restrict(Restrictions.eq(Hql.alias("pt"), Expressions.parameter(typeParameter)));
     74    pluginQuery.order(Orders.asc(Hql.property("name")));
     75    cc.setObject("export.dataloader.&plugins(name)", new ItemQueryLoader(pluginQuery, typeParameter));
     76  }
    5477%>
    5578<%
     
    196219    cc.configureQuery(query, true);
    197220    cc.setQuery(query);
     221    registerExportUtils(cc);
    198222    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+plugin+types";
    199223  }
     
    202226    // Run an export plugin in single-item context
    203227    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     228    registerExportUtils(cc);
    204229    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+plugin+type";
    205230  }
  • trunk/www/admin/plugintypes/list_plugintypes.jsp

    r4889 r4906  
    262262        datatype="string"
    263263        filterable="true"
     264        exportable="true"
    264265      />
    265266      <tbl:columndef
  • trunk/www/admin/protocoltypes/index.jsp

    r4889 r4906  
    3232  import="net.sf.basedb.core.ItemQuery"
    3333  import="net.sf.basedb.core.Permission"
     34  import="net.sf.basedb.core.Protocol"
    3435  import="net.sf.basedb.core.ItemContext"
    3536  import="net.sf.basedb.core.MultiPermissions"
    3637  import="net.sf.basedb.core.PermissionDeniedException"
    3738  import="net.sf.basedb.core.ItemAlreadyExistsException"
     39  import="net.sf.basedb.core.query.Expressions"
     40  import="net.sf.basedb.core.query.Hql"
     41  import="net.sf.basedb.core.query.Orders"
     42  import="net.sf.basedb.core.query.Restrictions"
    3843  import="net.sf.basedb.util.RemovableUtil"
     44  import="net.sf.basedb.util.formatter.NameableFormatter"
    3945  import="net.sf.basedb.clients.web.Base"
    4046  import="net.sf.basedb.clients.web.WebException"
    4147  import="net.sf.basedb.util.Values"
     48  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    4249  import="net.sf.basedb.clients.web.util.HTML"
    4350  import="java.util.Enumeration"
     
    5259  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,protocols,description");
    5360  private static final Item itemType = Item.PROTOCOLTYPE;
     61 
     62  private static void registerExportUtils(ItemContext cc)
     63  {
     64    // Register formatter
     65    cc.setObject("export.formatter.&protocols(name)", new NameableFormatter());   
     66   
     67    // Register dataloader
     68    String typeParameter = "protocolType";
     69    ItemQuery<Protocol> protocolQuery = Protocol.getQuery();
     70    protocolQuery.include(cc.getInclude());
     71    protocolQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
     72    protocolQuery.restrict(Restrictions.eq(Hql.property("protocolType"), Expressions.parameter(typeParameter)));
     73    protocolQuery.order(Orders.asc(Hql.property("name")));
     74    cc.setObject("export.dataloader.&protocols(name)", new ItemQueryLoader(protocolQuery, typeParameter));
     75  }
    5476%>
    5577<%
     
    193215    cc.configureQuery(query, true);
    194216    cc.setQuery(query);
     217    registerExportUtils(cc);
    195218    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+protocol+types";
    196219  }
     
    199222    // Run an export plugin in single-item context
    200223    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     224    registerExportUtils(cc);
    201225    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+protocol+type";
    202226  }
  • trunk/www/admin/protocoltypes/list_protocoltype.jsp

    r4889 r4906  
    257257        datatype="string"
    258258        filterable="true"
     259        exportable="true"
    259260      />
    260261      <tbl:columndef
  • trunk/www/admin/roles/index.jsp

    r4889 r4906  
    4040  import="net.sf.basedb.core.PermissionDeniedException"
    4141  import="net.sf.basedb.core.ItemAlreadyExistsException"
     42  import="net.sf.basedb.core.query.Expressions"
     43  import="net.sf.basedb.core.query.Hql"
     44  import="net.sf.basedb.core.query.Orders"
     45  import="net.sf.basedb.core.query.Restrictions"
    4246  import="net.sf.basedb.util.RemovableUtil"
     47  import="net.sf.basedb.util.formatter.NameableFormatter"
    4348  import="net.sf.basedb.clients.web.Base"
    4449  import="net.sf.basedb.clients.web.PermissionUtil"
     
    4651  import="net.sf.basedb.util.Values"
    4752  import="net.sf.basedb.clients.web.util.HTML"
     53  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    4854  import="java.util.Enumeration"
    4955  import="java.util.Set"
     
    5763  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,isDefault,description");
    5864  private static final Item itemType = Item.ROLE;
     65 
     66  private static void registerExportUtils(ItemContext cc)
     67  {
     68    // Register formatter
     69    cc.setObject("export.formatter.&users(name)", new NameableFormatter());
     70   
     71    // Register dataloader
     72    String roleParameter = "role";
     73    ItemQuery<User> userQuery = User.getQuery();
     74    userQuery.include(cc.getInclude());
     75    userQuery.join(Hql.innerJoin("roles", "rle"));
     76    userQuery.restrict(Restrictions.eq(Hql.alias("rle"), Expressions.parameter(roleParameter)));
     77    userQuery.order(Orders.asc(Hql.property("name")));
     78    cc.setObject("export.dataloader.&users(name)", new ItemQueryLoader(userQuery, roleParameter));
     79  }
    5980%>
    6081<%
     
    224245    cc.configureQuery(query, true);
    225246    cc.setQuery(query);
     247    registerExportUtils(cc);
    226248    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+roles";
    227249  }
     
    230252    // Run an export plugin in single-item context
    231253    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     254    registerExportUtils(cc);
    232255    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+role";
    233256  }
  • trunk/www/admin/roles/list_roles.jsp

    r4889 r4906  
    261261        datatype="string"
    262262        filterable="true"
     263        exportable="true"
    263264      />
    264265      <tbl:columndef
  • trunk/www/admin/users/index.jsp

    r4889 r4906  
    4444  import="net.sf.basedb.core.ItemAlreadyExistsException"
    4545  import="net.sf.basedb.core.DatabaseException"
    46   import="net.sf.basedb.util.RemovableUtil"
     46  import="net.sf.basedb.core.query.Expressions"
     47  import="net.sf.basedb.core.query.Hql"
     48  import="net.sf.basedb.core.query.Orders"
     49  import="net.sf.basedb.core.query.Restrictions"
     50  import="net.sf.basedb.util.RemovableUtil"
     51  import="net.sf.basedb.util.Values"
    4752  import="net.sf.basedb.clients.web.Base"
    4853  import="net.sf.basedb.clients.web.WebException"
    49   import="net.sf.basedb.util.Values"
    5054  import="net.sf.basedb.clients.web.util.HTML"
    5155  import="net.sf.basedb.util.formatter.Formatter"
     56  import="net.sf.basedb.util.formatter.NameableFormatter"
    5257  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
     58  import="net.sf.basedb.clients.web.plugins.ItemQueryLoader"
    5359  import="java.util.Date"
    5460  import="java.util.Enumeration"
     
    6369  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,login,expirationDate,groups,roles,email,description");
    6470  private static final Item itemType = Item.USER;
     71 
     72  private static void registerExportUtils(ItemContext cc)
     73  {
     74    // Register formatters
     75    cc.setObject("export.formatter.&groups(name)", new NameableFormatter());
     76    cc.setObject("export.formatter.&roles(name)", new NameableFormatter());
     77   
     78    // Register dataloaders
     79    String userParameter = "user";
     80    // Groups
     81    ItemQuery<Group> groupQuery = Group.getQuery();
     82    groupQuery.include(cc.getInclude());
     83    groupQuery.join(Hql.innerJoin("users", "usr"));
     84    groupQuery.restrict(Restrictions.eq(Hql.alias("usr"), Expressions.parameter(userParameter)));
     85    groupQuery.order(Orders.asc(Hql.property("name")));
     86    cc.setObject("export.dataloader.&groups(name)", new ItemQueryLoader(groupQuery, userParameter));
     87    // Roles
     88    ItemQuery<Role> roleQuery = Role.getQuery();
     89    roleQuery.include(cc.getInclude());
     90    roleQuery.join(Hql.innerJoin("users", "usr"));
     91    roleQuery.restrict(Restrictions.eq(Hql.alias("usr"), Expressions.parameter(userParameter)));
     92    roleQuery.order(Orders.asc(Hql.property("name")));
     93    cc.setObject("export.dataloader.&roles(name)", new ItemQueryLoader(roleQuery, userParameter));   
     94  }
    6595%>
    6696<%
     
    327357    cc.configureQuery(query, true);
    328358    cc.setQuery(query);
     359    registerExportUtils(cc);
    329360    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&title=Export+users";
    330361  }
     
    333364    // Run an export plugin in single-item context
    334365    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext);
     366    registerExportUtils(cc);
    335367    redirect = "../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=ITEM&title=Export+user";
    336368  }
  • trunk/www/admin/users/list_users.jsp

    r4889 r4906  
    334334        datatype="string"
    335335        filterable="true"
     336        exportable="true"
    336337      />
    337338      <tbl:columndef
     
    341342        datatype="string"
    342343        filterable="true"
     344        exportable="true"
    343345      />
    344346      <tbl:columndef
Note: See TracChangeset for help on using the changeset viewer.