コード例 #1
0
ファイル: Asset.java プロジェクト: karthiks/Learn_guild
 public org.osid.repository.PartIterator getPartsByPartStructure(
     org.osid.shared.Id partStructureId) throws org.osid.repository.RepositoryException {
   if (partStructureId == null) {
     throw new org.osid.repository.RepositoryException(
         org.osid.shared.SharedException.NULL_ARGUMENT);
   }
   try {
     java.util.Vector results = new java.util.Vector();
     org.osid.repository.RecordIterator recordIterator = getRecords();
     while (recordIterator.hasNextRecord()) {
       org.osid.repository.Record record = recordIterator.nextRecord();
       org.osid.repository.PartIterator partIterator = record.getParts();
       while (partIterator.hasNextPart()) {
         org.osid.repository.Part part = partIterator.nextPart();
         if (part.getPartStructure().getId().isEqual(partStructureId)) {
           results.addElement(part);
         }
       }
     }
     return new PartIterator(results);
   } catch (Throwable t) {
     LOG.warn(t.getMessage());
     throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
   }
 }
コード例 #2
0
ファイル: Asset.java プロジェクト: karthiks/Learn_guild
 public org.osid.repository.Record getRecord(org.osid.shared.Id recordId)
     throws org.osid.repository.RepositoryException {
   if (recordId == null) {
     throw new org.osid.repository.RepositoryException(
         org.osid.shared.SharedException.NULL_ARGUMENT);
   }
   try {
     for (int i = 0, size = this.recordVector.size(); i < size; i++) {
       org.osid.repository.Record record =
           (org.osid.repository.Record) this.recordVector.elementAt(i);
       if (record.getId().isEqual(recordId)) {
         return record;
       }
     }
     throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID);
   } catch (Throwable t) {
     LOG.warn(t.getMessage());
     throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
   }
 }
コード例 #3
0
ファイル: Asset.java プロジェクト: karthiks/Learn_guild
  public org.osid.repository.RecordIterator getRecordsByRecordStructureType(
      org.osid.shared.Type recordStructureType) throws org.osid.repository.RepositoryException {
    if (recordStructureType == null) {
      throw new org.osid.repository.RepositoryException(
          org.osid.shared.SharedException.NULL_ARGUMENT);
    }

    if ((!recordStructureType.isEqual(this.recordStructureType))) {
      throw new org.osid.repository.RepositoryException(
          org.osid.shared.SharedException.UNKNOWN_TYPE);
    }

    java.util.Vector results = new java.util.Vector();
    for (int i = 0, size = this.recordVector.size(); i < size; i++) {
      org.osid.repository.Record r = (org.osid.repository.Record) this.recordVector.elementAt(i);
      if (r.getRecordStructure().getType().isEqual(recordStructureType)) {
        results.addElement(r);
      }
    }
    return new RecordIterator(results);
  }
コード例 #4
0
ファイル: Asset.java プロジェクト: karthiks/Learn_guild
 public org.osid.repository.Part getPart(org.osid.shared.Id partId)
     throws org.osid.repository.RepositoryException {
   if (partId == null) {
     throw new org.osid.repository.RepositoryException(
         org.osid.shared.SharedException.NULL_ARGUMENT);
   }
   try {
     for (int i = 0, size = this.recordVector.size(); i < size; i++) {
       org.osid.repository.Record record =
           (org.osid.repository.Record) this.recordVector.elementAt(i);
       org.osid.repository.PartIterator partIterator = record.getParts();
       while (partIterator.hasNextPart()) {
         org.osid.repository.Part part = partIterator.nextPart();
         if (part.getId().isEqual(partId)) {
           return part;
         }
       }
     }
     throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID);
   } catch (Throwable t) {
     LOG.warn(t.getMessage());
     throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
   }
 }