org.dspace.content.Bundle.getItems()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(218)

本文整理了Java中org.dspace.content.Bundle.getItems()方法的一些代码示例,展示了Bundle.getItems()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.getItems()方法的具体详情如下:
包路径:org.dspace.content.Bundle
类名称:Bundle
方法名:getItems

Bundle.getItems介绍

[英]Get the items this bundle appears in
[中]获取此捆绑包出现的项目

代码示例

代码示例来源:origin: DSpace/DSpace

/**
 * Set the item this bundle appears in
 *
 * @return array of <code>Item</code> s this bundle appears in
 */
void addItem(Item item) {
  getItems().add(item);
}

代码示例来源:origin: DSpace/DSpace

void removeItem(Item item) {
  getItems().remove(item);
}

代码示例来源:origin: DSpace/DSpace

@Override
public DSpaceObject getParentObject(Context context, Bundle bundle) throws SQLException {
  List<Item> items = bundle.getItems();
  if (CollectionUtils.isNotEmpty(items)) {
    return items.iterator().next();
  } else {
    return null;
  }
}

代码示例来源:origin: DSpace/DSpace

/**
 * Is allowed manage (create, remove, edit) bundle's policies in the
 * current context?
 *
 * @param context the DSpace Context Object
 * @param bundle  the bundle that the policy refer to
 * @throws AuthorizeException if authorization error
 *                            if the current context (current user) is not allowed to
 *                            manage the bundle's policies
 * @throws SQLException       if database error
 *                            if a db error occur
 */
public static void authorizeManageBundlePolicy(Context context,
                        Bundle bundle) throws AuthorizeException, SQLException {
  Item item = bundle.getItems().get(0);
  authorizeManageItemPolicy(context, item);
}

代码示例来源:origin: DSpace/DSpace

protected boolean isAnyItemInstalled(Context ctx, List<Bundle> bundles)
  throws SQLException {
  for (Bundle bundle : bundles) {
    for (Item item : bundle.getItems()) {
      if (workspaceItemService.findByItem(ctx, item) == null
        && workflowItemService.findByItem(ctx, item) == null) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: DSpace/DSpace

private Date getLastModified(Context context, Bitstream bitstream)
  throws SQLException {
  Date lm = null;
  List<Bundle> bundles = bitstream.getBundles();
  for (Bundle bundle : bundles) {
    List<Item> items = bundle.getItems();
    for (Item item : items) {
      Date possible = item.getLastModified();
      if (lm == null) {
        lm = possible;
      } else if (possible.getTime() > lm.getTime()) {
        lm = possible;
      }
    }
  }
  if (lm == null) {
    return new Date();
  }
  return lm;
}

代码示例来源:origin: DSpace/DSpace

List<Item> items = parent.getItems();
Item item;
if (!items.isEmpty()) {

代码示例来源:origin: DSpace/DSpace

public void deleteBitstream(Context context, Bitstream bitstream)
  throws SwordError, DSpaceSwordException {
  // this is equivalent to asking whether the media resource in the item can be deleted
  try {
    List<Bundle> bundles = bitstream.getBundles();
    for (Bundle bundle : bundles) {
      // is the bitstream in the ORIGINAL bundle?  If not, it can't be worked on
      if (!Constants.CONTENT_BUNDLE_NAME
        .equals(bundle.getName())) {
        throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
                   "The file is not in a bundle which can be modified");
      }
      List<Item> items = bundle.getItems();
      for (Item item : items) {
        this.deleteMediaResource(context, item);
      }
    }
  } catch (SQLException e) {
    throw new DSpaceSwordException(e);
  }
}

代码示例来源:origin: DSpace/DSpace

public void deleteBitstream(Context context, Bitstream bitstream)
  throws SwordError, DSpaceSwordException {
  // this is equivalent to asking whether the media resource in the item can be deleted
  try {
    List<Bundle> bundles = bitstream.getBundles();
    for (Bundle bundle : bundles) {
      // is the bitstream in the ORIGINAL bundle?  If not, it can't be worked on
      if (!Constants.CONTENT_BUNDLE_NAME
        .equals(bundle.getName())) {
        throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
                   "The file is not in a bundle which can be modified");
      }
      List<Item> items = bundle.getItems();
      for (Item item : items) {
        this.deleteMediaResource(context, item);
      }
    }
  } catch (SQLException e) {
    throw new DSpaceSwordException(e);
  }
}

代码示例来源:origin: DSpace/DSpace

public void replaceBitstream(Context context, Bitstream bitstream)
  throws SwordError, DSpaceSwordException {
  // this is equivalent to asking whether the media resource in the item can be deleted
  try {
    List<Bundle> bundles = bitstream.getBundles();
    for (Bundle bundle : bundles) {
      // is the bitstream in the ORIGINAL bundle?  If not, it can't be worked on
      if (!Constants.CONTENT_BUNDLE_NAME
        .equals(bundle.getName())) {
        throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
                   "The file is not in a bundle which can be modified");
      }
      List<Item> items = bundle.getItems();
      for (Item item : items) {
        this.replaceResourceContent(context, item);
      }
    }
  } catch (SQLException e) {
    throw new DSpaceSwordException(e);
  }
}

代码示例来源:origin: DSpace/DSpace

@Override
public void delete(Context context, Bundle bundle) throws SQLException, AuthorizeException, IOException {
  log.info(LogManager.getHeader(context, "delete_bundle", "bundle_id="
    + bundle.getID()));
  authorizeService.authorizeAction(context, bundle, Constants.DELETE);
  context.addEvent(new Event(Event.DELETE, Constants.BUNDLE, bundle.getID(),
                bundle.getName(), getIdentifiers(context, bundle)));
  // Remove bitstreams
  List<Bitstream> bitstreams = bundle.getBitstreams();
  bundle.clearBitstreams();
  for (Bitstream bitstream : bitstreams) {
    removeBitstream(context, bundle, bitstream);
  }
  List<Item> items = new LinkedList<>(bundle.getItems());
  bundle.getItems().clear();
  for (Item item : items) {
    item.removeBundle(bundle);
  }
  // Remove ourself
  bundleDAO.delete(context, bundle);
}

代码示例来源:origin: DSpace/DSpace

List<Item> items = bundle.getItems();
if (items.isEmpty()) {
  log.error("Found orphaned bundle: " + bundle.getID());

代码示例来源:origin: DSpace/DSpace

List<Item> items = parent.getItems();
Item item;
if (!items.isEmpty()) {

代码示例来源:origin: DSpace/DSpace

@Override
public Bundle create(Context context, Item item, String name) throws SQLException, AuthorizeException {
  if (StringUtils.isBlank(name)) {
    throw new SQLException("Bundle must be created with non-null name");
  }
  authorizeService.authorizeAction(context, item, Constants.ADD);
  // Create a table row
  Bundle bundle = bundleDAO.create(context, new Bundle());
  bundle.setName(context, name);
  itemService.addBundle(context, item, bundle);
  if (!bundle.getItems().contains(item)) {
    bundle.addItem(item);
  }
  log.info(LogManager.getHeader(context, "create_bundle", "bundle_id="
    + bundle.getID()));
  // if we ever use the identifier service for bundles, we should
  // create the bundle before we create the Event and should add all
  // identifiers to it.
  context.addEvent(new Event(Event.CREATE, Constants.BUNDLE, bundle.getID(), null));
  return bundle;
}

代码示例来源:origin: DSpace/DSpace

List<Item> items = parent.getItems();
Item item;
if (!items.isEmpty()) {

代码示例来源:origin: DSpace/DSpace

List<Item> items = b.getItems();
for (Item i : items) {
  if (workspaceItemService.findByItem(ctx, i) != null

代码示例来源:origin: DSpace/DSpace

return;
List<Item> items = bundle.getItems();
for (Item i : items) {
  if (workspaceItemService.findByItem(ctx, i) != null

代码示例来源:origin: DSpace/DSpace

for (Item item : bundle.getItems()) {
  this.replaceResourceContent(context, item);

代码示例来源:origin: org.dspace/dspace-sword-api

Item[] items = parent.getItems();
Item item;
if (items.length > 0)

代码示例来源:origin: DSpace/DSpace

List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles) {
  List<Item> items = bundle.getItems();
  for (Item item : items) {
    doc1.addField("owningItem", item.getID());

相关文章