Codota Logo
Representation
Code IndexAdd Codota to your IDE (free)

How to use
Representation
in
org.roda.core.data.v2.ip

Best Java code snippets using org.roda.core.data.v2.ip.Representation (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: keeps/roda

doc.addField(RodaConstants.REPRESENTATION_AIP_ID, rep.getAipId());
doc.addField(RodaConstants.REPRESENTATION_ORIGINAL, rep.isOriginal());
doc.addField(RodaConstants.REPRESENTATION_TYPE, rep.getType());
doc.addField(RodaConstants.REPRESENTATION_CREATED_ON, SolrUtils.formatDate(rep.getCreatedOn()));
doc.addField(RodaConstants.REPRESENTATION_CREATED_BY, rep.getCreatedBy());
doc.addField(RodaConstants.REPRESENTATION_UPDATED_ON, SolrUtils.formatDate(rep.getUpdatedOn()));
doc.addField(RodaConstants.REPRESENTATION_UPDATED_BY, rep.getUpdatedBy());
if (!rep.getRepresentationStates().isEmpty()) {
 doc.addField(RodaConstants.REPRESENTATION_STATES, rep.getRepresentationStates());
} else if (rep.isOriginal()) {
 doc.addField(RodaConstants.REPRESENTATION_STATES, Arrays.asList(RepresentationState.ORIGINAL));
 SolrUtils.indexDescriptiveMetadataFields(RodaCoreFactory.getModelService(), rep.getAipId(), rep.getId(),
  rep.getDescriptiveMetadata(), doc);
Long numberOfDocumentationFiles;
try {
 Directory documentationDirectory = model.getDocumentationDirectory(rep.getAipId(), rep.getId());
 numberOfDocumentationFiles = storage.countResourcesUnderDirectory(documentationDirectory.getStoragePath(), true);
} catch (NotFoundException e) {
 Directory schemasDirectory = model.getSchemasDirectory(rep.getAipId(), rep.getId());
 numberOfSchemaFiles = storage.countResourcesUnderDirectory(schemasDirectory.getStoragePath(), true);
} catch (NotFoundException e) {
origin: keeps/roda

@Override
public String toString() {
 return "IndexedRepresentation [uuid=" + uuid + ", title=" + title + ", sizeInBytes=" + sizeInBytes
  + ", numberOfDataFiles=" + numberOfDataFiles + ", numberOfDataFolders=" + numberOfDataFolders
  + " numberOfDocumentationFiles=" + numberOfDocumentationFiles + ", numberOfSchemaFiles=" + numberOfSchemaFiles
  + ", ancestors=" + ancestors + ", createdOn=" + super.getCreatedOn() + ", createdBy=" + super.getCreatedBy()
  + ", updatedOn=" + super.getUpdatedOn() + ", updatedBy=" + super.getUpdatedBy() + ", representationStates="
  + super.getRepresentationStates() + ']';
}
origin: keeps/roda

public static String getRepresentationId(Representation representation) {
 return getRepresentationId(representation.getAipId(), representation.getId());
}
origin: keeps/roda

public void addDescriptiveMetadata(DescriptiveMetadata descriptiveMetadata) {
 if (descriptiveMetadata.isFromAIP()) {
  this.descriptiveMetadata.add(descriptiveMetadata);
 } else {
  for (Representation representation : this.representations) {
   if (representation.getId().equals(descriptiveMetadata.getRepresentationId())) {
    representation.addDescriptiveMetadata(descriptiveMetadata);
    break;
   }
  }
 }
}
origin: keeps/roda

public static Representation convertResourceToRepresentation(Resource resource)
 throws GenericException, NotFoundException, AuthorizationDeniedException, RequestNotValidException {
 if (resource == null) {
  throw new RequestNotValidException(RESOURCE_CANNOT_BE_NULL);
 }
 StoragePath resourcePath = resource.getStoragePath();
 String id = resourcePath.getName();
 String aipId = ModelUtils.extractAipId(resourcePath).orElse(null);
 AIP aip = RodaCoreFactory.getModelService().retrieveAIP(aipId);
 Optional<Representation> rep = aip.getRepresentations().stream().filter(r -> r.getId().equals(id)).findFirst();
 if (rep.isPresent()) {
  return rep.get();
 } else {
  throw new NotFoundException("Unable to find representation with storage path " + resourcePath);
 }
}
origin: keeps/roda

for (Representation representation : aip.getRepresentations()) {
 DefaultStoragePath representationStoragePath = DefaultStoragePath.parse(RodaConstants.STORAGE_CONTAINER_AIP,
  aip.getId(), RodaConstants.STORAGE_DIRECTORY_REPRESENTATIONS, representation.getId());
 Path representationPath = storage.getDirectAccess(representationStoragePath).getPath();
 Date updateDate = new Date(attr.lastModifiedTime().toMillis());
 representation.setCreatedOn(createDate);
 representation.setCreatedBy(aip.getCreatedBy());
 representation.setUpdatedOn(updateDate);
 representation.setUpdatedBy(aip.getUpdatedBy());
 if (representation.isOriginal()) {
  representation.setRepresentationStates(Arrays.asList(RepresentationState.ORIGINAL));
 } else {
  representation.setRepresentationStates(Arrays.asList(RepresentationState.OTHER));
origin: keeps/roda

private void processRepresentation(ModelService model, Report report, JobPluginInfo jobPluginInfo, Job job,
 List<Representation> representations) {
 for (Representation representation : representations) {
  Report reportItem = PluginHelper.initPluginReportItem(this, representation.getId(), Representation.class);
  PluginHelper.updatePartialJobReport(this, model, reportItem, false, job);
  PluginState state = PluginState.SUCCESS;
  try {
   model.changeRepresentationType(representation.getAipId(), representation.getId(), newType, job.getUsername());
  } catch (RequestNotValidException | NotFoundException | GenericException | AuthorizationDeniedException e) {
   state = PluginState.FAILURE;
  } finally {
   jobPluginInfo.incrementObjectsProcessed(state);
   reportItem.setPluginState(state);
   StringBuilder outcomeText = new StringBuilder().append("The representation '").append(representation.getId())
    .append(" of AIP ").append(representation.getAipId()).append("' changed its type from '")
    .append(representation.getType()).append("' to '").append(newType).append("'.");
   model.createUpdateAIPEvent(representation.getAipId(), representation.getId(), null, null,
    PreservationEventType.UPDATE, EVENT_DESCRIPTION, state, outcomeText.toString(), details, job.getUsername(),
    true);
   report.addReport(reportItem);
   PluginHelper.updatePartialJobReport(this, model, reportItem, true, job);
  }
 }
}
origin: keeps/roda

public void setId(String id) {
 this.id = id;
 // As id is not serialized to JSON, set the AIP id in metadata and data
 if (descriptiveMetadata != null) {
  for (DescriptiveMetadata dm : descriptiveMetadata) {
   dm.setAipId(id);
  }
 }
 if (representations != null) {
  for (Representation representation : representations) {
   representation.setAipId(id);
   for (DescriptiveMetadata repDm : representation.getDescriptiveMetadata()) {
    repDm.setAipId(id);
    repDm.setRepresentationId(representation.getId());
   }
  }
 }
}
origin: keeps/roda

public void changeRepresentationType(String aipId, String representationId, String type, String updatedBy)
 throws RequestNotValidException, NotFoundException, GenericException, AuthorizationDeniedException {
 RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
 AIP aip = retrieveAIP(aipId);
 Iterator<Representation> it = aip.getRepresentations().iterator();
 while (it.hasNext()) {
  Representation representation = it.next();
  if (representation.getId().equals(representationId)) {
   representation.setType(type);
   representation.setUpdatedOn(new Date());
   representation.setUpdatedBy(updatedBy);
   notifyRepresentationUpdated(representation).failOnError();
   break;
  }
 }
 updateAIPMetadata(aip);
}
origin: keeps/roda

public void changeRepresentationStates(String aipId, String representationId, List<String> newStates,
 String updatedBy)
 throws RequestNotValidException, NotFoundException, GenericException, AuthorizationDeniedException {
 RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
 AIP aip = retrieveAIP(aipId);
 Iterator<Representation> it = aip.getRepresentations().iterator();
 Optional<Representation> representation = Optional.empty();
 while (it.hasNext()) {
  Representation next = it.next();
  if (next.getId().equals(representationId)) {
   representation = Optional.of(next);
   break;
  }
 }
 if (representation.isPresent()) {
  representation.get().setRepresentationStates(newStates);
  representation.get().setUpdatedOn(new Date());
  representation.get().setUpdatedBy(updatedBy);
  updateAIPMetadata(aip);
  notifyRepresentationUpdated(representation.get()).failOnError();
 }
}
origin: keeps/roda

private List<DescriptiveMetadata> getDescriptiveMetadata(AIP aip, String representationId) {
 List<DescriptiveMetadata> descriptiveMetadataList = Collections.emptyList();
 if (representationId == null) {
  // AIP descriptive metadata
  descriptiveMetadataList = aip.getDescriptiveMetadata();
 } else {
  // Representation descriptive metadata
  Optional<Representation> oRep = aip.getRepresentations().stream()
   .filter(rep -> rep.getId().equals(representationId)).findFirst();
  if (oRep.isPresent()) {
   descriptiveMetadataList = oRep.get().getDescriptiveMetadata();
  }
 }
 return descriptiveMetadataList;
}
origin: keeps/roda

public Representation createRepresentation(String aipId, String representationId, boolean original, String type,
 boolean notify, String createdBy) throws RequestNotValidException, GenericException, NotFoundException,
 AuthorizationDeniedException, AlreadyExistsException {
 RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
 Representation representation = new Representation(representationId, aipId, original, type);
 representation.setCreatedBy(createdBy);
 representation.setUpdatedBy(createdBy);
 StoragePath directoryPath = ModelUtils.getRepresentationStoragePath(aipId, representationId);
 storage.createDirectory(directoryPath);
 // update AIP metadata
 AIP aip = ResourceParseUtils.getAIPMetadata(getStorage(), aipId);
 aip.getRepresentations().add(representation);
 updateAIPMetadata(aip);
 if (notify) {
  notifyRepresentationCreated(representation).failOnError();
 }
 return representation;
}
origin: keeps/roda

public static List<List<String>> getDescriptiveMetadataInformation(List<String> fields, AIP aip, ModelService model,
 StorageService storage) {
 List<List<String>> descriptiveMetadataInformation = new ArrayList<>();
 for (DescriptiveMetadata dm : aip.getDescriptiveMetadata()) {
  descriptiveMetadataInformation.add(retrieveDescriptiveMetadataInfo(fields, aip, dm, storage));
 }
 if (aip.getRepresentations() != null) {
  for (Representation r : aip.getRepresentations()) {
   for (DescriptiveMetadata dm : r.getDescriptiveMetadata()) {
    descriptiveMetadataInformation.add(retrieveDescriptiveMetadataInfo(fields, aip, dm, storage));
   }
  }
 }
 return descriptiveMetadataInformation;
}
origin: keeps/roda

public Representation updateRepresentation(String aipId, String representationId, boolean original, String type,
 StorageService sourceStorage, StoragePath sourcePath, String updatedBy) throws RequestNotValidException,
 NotFoundException, GenericException, AuthorizationDeniedException, ValidationException {
 Representation representation;
 RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
 // XXX possible optimization only creating new files, updating
 // changed and removing deleted
 StoragePath representationPath = ModelUtils.getRepresentationStoragePath(aipId, representationId);
 storage.deleteResource(representationPath);
 try {
  storage.copy(sourceStorage, sourcePath, representationPath);
 } catch (AlreadyExistsException e) {
  throw new GenericException("Copying after delete gave an unexpected already exists exception", e);
 }
 // build return object
 representation = new Representation(representationId, aipId, original, type);
 representation.setUpdatedBy(updatedBy);
 notifyRepresentationUpdated(representation).failOnError();
 return representation;
}
origin: keeps/roda

@Override
public ReturnWithExceptions<Void, ModelObserver> representationUpdated(Representation representation) {
 ReturnWithExceptions<Void, ModelObserver> ret = representationDeleted(representation.getAipId(),
  representation.getId(), false);
 representationCreated(representation).addTo(ret);
 return ret;
}
origin: keeps/roda

@Override
public List<Object> toCsvValues() {
 return Arrays.asList(uuid, title, sizeInBytes, numberOfDataFiles, numberOfDataFolders, numberOfDocumentationFiles,
  numberOfSchemaFiles, ancestors, super.getCreatedOn(), super.getCreatedBy(), super.getUpdatedOn(),
  super.getUpdatedBy(), super.getRepresentationStates());
}
origin: keeps/roda

public static List<List<String>> getDataInformation(List<String> fields, AIP aip, ModelService model,
 StorageService storage) {
 List<List<String>> dataInformation = new ArrayList<>();
 for (Representation representation : aip.getRepresentations()) {
  boolean recursive = true;
  try (CloseableIterable<OptionalWithCause<File>> representationFiles = model.listFilesUnder(aip.getId(),
   representation.getId(), recursive)) {
   for (OptionalWithCause<File> subfile : representationFiles) {
    if (subfile.isPresent()) {
     dataInformation.add(retrieveFileInfo(fields, subfile.get(), aip, model, storage));
    } else {
     LOGGER.error("Cannot retrieve file information", subfile.getCause());
    }
   }
  } catch (NotFoundException | GenericException | RequestNotValidException | AuthorizationDeniedException
   | IOException e) {
   LOGGER.error("Error retrieving files of representation '{}' of AIP '{}': " + e.getMessage(),
    representation.getId(), aip.getId());
  }
 }
 return dataInformation;
}
origin: keeps/roda

representation.getId(), true)) {
LOGGER.debug("Processing representation {}", representation);
       boolean original = false;
       newRepresentations.add(newRepresentationID);
       String newRepresentationType = representation.getType();
        notify, job.getUsername());
       reportItem.setSourceAndOutcomeObjectId(reportItem.getSourceObjectId(),
        IdUtils.getRepresentationId(representation.getAipId(), newRepresentationID));
      outputFormat, file.getId(), representation.getId(), aip.getId());
origin: keeps/roda

public Representation createRepresentation(String aipId, String representationId, boolean original, String type,
 StorageService sourceStorage, StoragePath sourcePath, boolean justData, String createdBy)
 throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException,
 AlreadyExistsException {
 Representation representation;
 RodaCoreFactory.checkIfWriteIsAllowedAndIfFalseThrowException(nodeType);
 if (justData) {
  StoragePath dataPath = ModelUtils.getRepresentationDataStoragePath(aipId, representationId);
  StoragePath sourceDataPath = DefaultStoragePath.parse(sourcePath, RodaConstants.STORAGE_DIRECTORY_DATA);
  storage.copy(sourceStorage, sourceDataPath, dataPath);
 } else {
  StoragePath directoryPath = ModelUtils.getRepresentationStoragePath(aipId, representationId);
  // verify structure of source representation
  // 20170324 should we validate the representation???
  storage.copy(sourceStorage, sourcePath, directoryPath);
 }
 representation = new Representation(representationId, aipId, original, type);
 representation.setCreatedBy(createdBy);
 representation.setUpdatedBy(createdBy);
 // update AIP metadata
 AIP aip = ResourceParseUtils.getAIPMetadata(getStorage(), aipId);
 aip.getRepresentations().add(representation);
 updateAIPMetadata(aip);
 notifyRepresentationCreated(representation).failOnError();
 return representation;
}
origin: keeps/roda

public static <T extends IsRODAObject> List<LinkingIdentifier> runSiegfriedOnRepresentation(ModelService model,
 Representation representation) throws GenericException, RequestNotValidException, NotFoundException,
 AuthorizationDeniedException, PluginException {
 StoragePath representationDataPath = ModelUtils.getRepresentationDataStoragePath(representation.getAipId(),
  representation.getId());
 try (DirectResourceAccess directAccess = model.getStorage().getDirectAccess(representationDataPath)) {
  Path representationFsPath = directAccess.getPath();
  List<LinkingIdentifier> sources = runSiegfriedOnRepresentationOrFile(model, representation.getAipId(),
   representation.getId(), new ArrayList<>(), null, representationFsPath);
  return sources;
 } catch (IOException e) {
  throw new GenericException(e);
 }
}
org.roda.core.data.v2.ipRepresentation

Most used methods

  • getId
  • getAipId
  • getCreatedBy
  • getCreatedOn
  • getDescriptiveMetadata
  • getRepresentationStates
  • getUpdatedBy
  • getUpdatedOn
  • <init>
  • addDescriptiveMetadata
  • equals
  • getType
  • equals,
  • getType,
  • hashCode,
  • isOriginal,
  • setAipId,
  • setCreatedBy,
  • setCreatedOn,
  • setRepresentationStates,
  • setType,
  • setUpdatedBy

Popular in Java

  • Reactive rest calls using spring rest template
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • String (java.lang)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JFileChooser (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now