@Test @Override public void testGetAdminObject() throws SQLException { assertThat("testGetAdminObject 0", b.getAdminObject(Constants.REMOVE), nullValue()); assertThat("testGetAdminObject 1", b.getAdminObject(Constants.ADD), nullValue()); }
public DSpaceObject getAdminObject(int action) throws SQLException { DSpaceObject adminObject = null; Item[] items = getItems(); Item item = null; Collection collection = null; Community community = null; if (items != null && items.length > 0) { item = items[0]; collection = item.getOwningCollection(); if (collection != null) { Community[] communities = collection.getCommunities(); if (communities != null && communities.length > 0) { community = communities[0]; } } } switch (action) { case Constants.REMOVE: if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion()) { adminObject = item; } else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamDeletion()) { adminObject = community; } break; case Constants.ADD: if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation()) { adminObject = item; } else if (AuthorizeConfiguration .canCollectionAdminPerformBitstreamCreation()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamCreation()) { adminObject = community; } break; default: adminObject = this; break; } return adminObject; }
Bundle extends DSpaceObject { public DSpaceObject getAdminObject(int action) throws SQLException { DSpaceObject adminObject = null; Item[] items = getItems(); Item item = null; Collection collection = null; Community community = null; if (items != null && items.length > 0) { item = items[0]; collection = item.getOwningCollection(); if (collection != null) { Community[] communities = collection.getCommunities(); if (communities != null && communities.length > 0) { community = communities[0]; } } } switch (action) { case Constants.REMOVE: if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion()) { adminObject = item; } else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamDeletion()) { adminObject = community; } break; case Constants.ADD: if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation()) { adminObject = item; } else if (AuthorizeConfiguration .canCollectionAdminPerformBitstreamCreation()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamCreation()) { adminObject = community; } break; default: adminObject = this; break; } return adminObject; } }
Bundle extends DSpaceObject { public DSpaceObject getAdminObject(int action) throws SQLException { DSpaceObject adminObject = null; Item[] items = getItems(); Item item = null; Collection collection = null; Community community = null; if (items != null && items.length > 0) { item = items[0]; collection = item.getOwningCollection(); if (collection != null) { Community[] communities = collection.getCommunities(); if (communities != null && communities.length > 0) { community = communities[0]; } } } switch (action) { case Constants.REMOVE: if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion()) { adminObject = item; } else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamDeletion()) { adminObject = community; } break; case Constants.ADD: if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation()) { adminObject = item; } else if (AuthorizeConfiguration .canCollectionAdminPerformBitstreamCreation()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamCreation()) { adminObject = community; } break; default: adminObject = this; break; } return adminObject; } Bundle(Context context, TableRow row); }
Bundle extends DSpaceObject { public DSpaceObject getAdminObject(int action) throws SQLException { DSpaceObject adminObject = null; Item[] items = getItems(); Item item = null; Collection collection = null; Community community = null; if (items != null && items.length > 0) { item = items[0]; collection = item.getOwningCollection(); if (collection != null) { Community[] communities = collection.getCommunities(); if (communities != null && communities.length > 0) { community = communities[0]; } } } switch (action) { case Constants.REMOVE: if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion()) { adminObject = item; } else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamDeletion()) { adminObject = community; } break; case Constants.ADD: if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation()) { adminObject = item; } else if (AuthorizeConfiguration .canCollectionAdminPerformBitstreamCreation()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamCreation()) { adminObject = community; } break; default: adminObject = this; break; } return adminObject; } Bundle(Context context, TableRow row); static Bundle find(Context context, int id); int getID(); String getName(); void setName(String name); int getPrimaryBitstreamID(); void setPrimaryBitstreamID(int bitstreamID); void unsetPrimaryBitstreamID(); String getHandle(); Bitstream getBitstreamByName(String name); Bitstream[] getBitstreams(); Item[] getItems(); Bitstream createBitstream(InputStream is); Bitstream registerBitstream(int assetstore, String bitstreamPath); void addBitstream(Bitstream b); void setOrder(int bitstreamIds[]); void removeBitstream(Bitstream b); void update(); int getType(); void inheritCollectionDefaultPolicies(Collection c); void replaceAllBitstreamPolicies(List<ResourcePolicy> newpolicies); List<ResourcePolicy> getBundlePolicies(); List<ResourcePolicy> getBitstreamPolicies(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject(); }
Bundle extends DSpaceObject { public DSpaceObject getAdminObject(int action) throws SQLException { DSpaceObject adminObject = null; Item[] items = getItems(); Item item = null; Collection collection = null; Community community = null; if (items != null && items.length > 0) { item = items[0]; collection = item.getOwningCollection(); if (collection != null) { Community[] communities = collection.getCommunities(); if (communities != null && communities.length > 0) { community = communities[0]; } } } switch (action) { case Constants.REMOVE: if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion()) { adminObject = item; } else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamDeletion()) { adminObject = community; } break; case Constants.ADD: if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation()) { adminObject = item; } else if (AuthorizeConfiguration .canCollectionAdminPerformBitstreamCreation()) { adminObject = collection; } else if (AuthorizeConfiguration .canCommunityAdminPerformBitstreamCreation()) { adminObject = community; } break; default: adminObject = this; break; } return adminObject; } Bundle(Context context, TableRow row); static Bundle find(Context context, int id); int getID(); String getName(); void setName(String name); int getPrimaryBitstreamID(); void setPrimaryBitstreamID(int bitstreamID); void unsetPrimaryBitstreamID(); String getHandle(); Bitstream getBitstreamByName(String name); Bitstream[] getBitstreams(); Item[] getItems(); Bitstream createBitstream(InputStream is); Bitstream registerBitstream(int assetstore, String bitstreamPath); void addBitstream(Bitstream b); void setOrder(int bitstreamIds[]); void removeBitstream(Bitstream b); void update(); int getType(); void inheritCollectionDefaultPolicies(Collection c); void replaceAllBitstreamPolicies(List<ResourcePolicy> newpolicies); List<ResourcePolicy> getBundlePolicies(); List<ResourcePolicy> getBitstreamPolicies(); DSpaceObject getAdminObject(int action); DSpaceObject getParentObject();  }