Esempio n. 1
0
  public void walk()
      throws InvalidCredentialsException, MethodFailedException, InvalidResourceException {
    List<Relation> relations = domsAPI.getInverseRelations("doms:ContentModel_Program");

    for (Relation relation : relations) {
      String programPid = relation.getObject();
      domsAPI.getDatastreamContents(programPid, "PBCORE");
    }
  }
 /**
  * Returns either a list of all the files connected to this program or the single file that
  * represents this program exactly, if such a file exists.
  *
  * @param request
  * @param context
  * @return
  * @throws InvalidCredentialsException
  * @throws InvalidResourceException
  * @throws MethodFailedException
  */
 private List<String> findFileObjects(TranscodeRequest request, InfrastructureContext context)
     throws InvalidCredentialsException, InvalidResourceException, MethodFailedException {
   CentralWebservice doms = CentralWebserviceFactory.getServiceInstance(context);
   List<String> fileObjectPids = new ArrayList<String>();
   List<Relation> relations = doms.getRelations(request.getObjectPid());
   for (Relation relation : relations) {
     logger.debug(
         "Relation: "
             + request.getObjectPid()
             + " "
             + relation.getPredicate()
             + " "
             + relation.getObject());
     if (relation.getPredicate().equals(HAS_EXACT_FILE_RELATION)) {
       fileObjectPids = new ArrayList<String>();
       fileObjectPids.add(relation.getObject());
       request.setHasExactFile(true);
       logger.debug(
           "Program " + request.getObjectPid() + " has an exact file " + relation.getObject());
       return fileObjectPids;
     } else if (relation.getPredicate().equals(HAS_FILE_RELATION)) {
       fileObjectPids.add(relation.getObject());
     }
   }
   return fileObjectPids;
 }