Ejemplo n.º 1
0
 /**
  * This method just attaches the {@link LinkModel} to the {@link OrganizationModel}. It will only
  * do so if this link is not already present.
  */
 public OrganizationModel attachLink(OrganizationModel organizationModel, LinkModel linkModel) {
   // check for duplicates
   for (LinkModel existing : organizationModel.getLinks()) {
     if (existing.equals(linkModel)) {
       return organizationModel;
     }
   }
   organizationModel.addLink(linkModel);
   return organizationModel;
 }
Ejemplo n.º 2
0
 /**
  * This method just attaches the {@link OrganizationModel} to the {@link FileModel}. It will only
  * do so if this link is not already present.
  */
 public OrganizationModel attachOrganization(
     OrganizationModel organizationModel, ArchiveModel archiveModel) {
   // check for duplicates
   for (FileModel existingFileModel : organizationModel.getArchiveModels()) {
     if (existingFileModel.equals(archiveModel)) {
       return organizationModel;
     }
   }
   organizationModel.addArchiveModel(archiveModel);
   return organizationModel;
 }
Ejemplo n.º 3
0
  /**
   * Attach a {@link OrganizationModel} with the given organization to the provided {@link
   * ArchiveModel}. If an existing Model exists with the provided organization, that one will be
   * used instead.
   */
  public OrganizationModel attachOrganization(ArchiveModel archiveModel, String organizationName) {
    OrganizationModel model =
        getUnique(getTypedQuery().has(OrganizationModel.NAME, organizationName));
    if (model == null) {
      model = create();
      model.setName(organizationName);
      model.addArchiveModel(archiveModel);
    } else {
      return attachOrganization(model, archiveModel);
    }

    return model;
  }