Exemplo n.º 1
0
  public AIP ingestCorpora()
      throws RequestNotValidException, NotFoundException, GenericException, AlreadyExistsException,
          AuthorizationDeniedException, InvalidParameterException, InterruptedException,
          IOException, FileAlreadyExistsException, SolrServerException, IsStillUpdatingException {
    String parentId = null;
    String aipType = RodaConstants.AIP_TYPE_MIXED;
    AIP root = model.createAIP(parentId, aipType, new Permissions(), aipCreator);

    Map<String, String> parameters = new HashMap<>();
    parameters.put(RodaConstants.PLUGIN_PARAMS_PARENT_ID, root.getId());

    List<TransferredResource> transferredResources = new ArrayList<TransferredResource>();
    transferredResources = createCorpora();

    AssertJUnit.assertEquals(1, transferredResources.size());

    Job job =
        TestsHelper.executeJob(
            TransferredResourceToAIPPlugin.class,
            parameters,
            PluginType.SIP_TO_AIP,
            SelectedItemsList.create(
                TransferredResource.class,
                transferredResources
                    .stream()
                    .map(tr -> tr.getUUID())
                    .collect(Collectors.toList())));

    TestsHelper.getJobReports(index, job, true);

    index.commitAIPs();

    IndexResult<IndexedAIP> find =
        index.find(
            IndexedAIP.class,
            new Filter(new SimpleFilterParameter(RodaConstants.AIP_PARENT_ID, root.getId())),
            null,
            new Sublist(0, 10));

    AssertJUnit.assertEquals(1L, find.getTotalCount());
    IndexedAIP indexedAIP = find.getResults().get(0);

    return model.retrieveAIP(indexedAIP.getId());
  }
Exemplo n.º 2
0
 /**
  * Constructs a new {@link IndexedAIP} cloning the one given by argument.
  *
  * @param other the {@link IndexedAIP} to be cloned.
  */
 public IndexedAIP(IndexedAIP other) {
   this(
       other.getId(),
       other.getState(),
       other.getLevel(),
       other.getTitle(),
       other.getDateInitial(),
       other.getDateFinal(),
       other.getDescription(),
       other.getParentID(),
       other.getAncestors(),
       other.getPermissions(),
       other.getNumberOfSubmissionFiles(),
       other.getNumberOfDocumentationFiles(),
       other.getNumberOfSchemaFiles(),
       other.getHasRepresentations(),
       other.getGhost());
 }