Exemplo n.º 1
0
 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);
   }
 }
Exemplo n.º 2
0
 public void deletePart(org.osid.shared.Id partId) throws org.osid.repository.RepositoryException {
   try {
     for (int i = 0, size = this.partVector.size(); i < size; i++) {
       org.osid.repository.Part part = (org.osid.repository.Part) this.partVector.elementAt(i);
       if (part.getId().isEqual(partId)) {
         this.partVector.removeElementAt(i);
         return;
       }
     }
     throw new org.osid.repository.RepositoryException(org.osid.shared.SharedException.UNKNOWN_ID);
   } catch (Throwable t) {
     Utilities.log(t.getMessage());
     throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
   }
 }
Exemplo n.º 3
0
 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);
   }
 }
Exemplo n.º 4
0
 public java.io.Serializable getPartValue(org.osid.shared.Id partId)
     throws org.osid.repository.RepositoryException {
   org.osid.repository.Part part = getPart(partId);
   return part.getValue();
 }