Skip to content

Commit

Permalink
Merge pull request #823 from google/ms-400
Browse files Browse the repository at this point in the history
Transmogrification config fix
  • Loading branch information
pablomd314 authored Jan 16, 2020
2 parents b5edade + 476c2bc commit c685930
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@

// This class defines transmogrification paramaters for Microsoft imports
public class MicrosoftTransmogrificationConfig extends TransmogrificationConfig {
/**
OneDrive has forbidden characters for file names:
https://support.office.com/en-us/article/invalid-file-names-and-file-types-in-onedrive-onedrive-for-business-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa#invalidcharacters
*/
private final String PHOTO_TITLE_FORBIDDEN_CHARACTERS = "~\"#%&*:<>?/\\{|}.";
private final String ALBUM_NAME_FORBIDDEN_CHARACTERS = "~\"#%&*:<>?/\\{|}.";
/**
OneDrive has forbidden characters for file names:
https://support.office.com/en-us/article/invalid-file-names-and-file-types-in-onedrive-onedrive-for-business-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa#invalidcharacters
*/
private final String PHOTO_TITLE_FORBIDDEN_CHARACTERS = "~\"#%&*:<>?/\\{|}.";
private final String ALBUM_NAME_FORBIDDEN_CHARACTERS = "~\"#%&*:<>?/\\{|}.";

/**
We need to override the methods
*/
@Override
public String getPhotoTitleForbiddenCharacters() {
return PHOTO_TITLE_FORBIDDEN_CHARACTERS;
}

@Override
public String getAlbumNameForbiddenCharacters() {
return ALBUM_NAME_FORBIDDEN_CHARACTERS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@

// This class defines transmogrification paramaters for SmugMug imports
public class SmugMugTransmogrificationConfig extends TransmogrificationConfig {
// Smugmug doesn't allow photos to exist outside of a folder
private final boolean ALBUM_ALLOW_ROOT_PHOTOS = false;
// Album size specified here:
// https://github.com/google/data-transfer-project/pull/805/files
private final int ALBUM_MAX_SIZE = 5000;
// Smugmug doesn't allow photos to exist outside of a folder
private final boolean ALBUM_ALLOW_ROOT_PHOTOS = false;
// Album size specified here:
// https://github.com/google/data-transfer-project/pull/805/files
private final int ALBUM_MAX_SIZE = 5000;

/**
We need to override the methods
*/
@Override
public boolean getAlbumAllowRootPhotos() {
return ALBUM_ALLOW_ROOT_PHOTOS;
}

@Override
public int getAlbumMaxSize() {
return ALBUM_MAX_SIZE;
}
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
package org.datatransferproject.types.common.models;

/**
This class is meant to be extended with custom logic for each service.
These defaults represent no-chnage transmogrifications.
*/
public class TransmogrificationConfig {
private final String PHOTO_TITLE_FORBIDDEN_CHARACTERS = "";
private final char PHOTO_TITLE_REPLACEMENT_CHARACTER = '_';
private final int PHOTO_TITLE_MAX_LENGTH = -1;

private final String ALBUM_NAME_FORBIDDEN_CHARACTERS = "";
private final char ALBUM_NAME_REPLACEMENT_CHARACTER = '_';
private final int ALBUM_NAME_MAX_LENGTH = -1;
private final boolean ALBUM_ALLOW_ROOT_PHOTOS = true;
private final int ALBUM_MAX_SIZE = -1;

public String getPhotoTitleForbiddenCharacters() {
return PHOTO_TITLE_FORBIDDEN_CHARACTERS;
}

public char getPhotoTitleReplacementCharater() {
return PHOTO_TITLE_REPLACEMENT_CHARACTER;
}

public int getPhotoTitleMaxLength() {
return PHOTO_TITLE_MAX_LENGTH;
}

public String getAlbumNameForbiddenCharacters() {
return ALBUM_NAME_FORBIDDEN_CHARACTERS;
}

public char getAlbumNameReplacementCharacter() {
return ALBUM_NAME_REPLACEMENT_CHARACTER;
}

public int getAlbumNameMaxLength() {
return ALBUM_NAME_MAX_LENGTH;
}

public boolean getAlbumAllowRootPhotos() {
return ALBUM_ALLOW_ROOT_PHOTOS;
}

public int getAlbumMaxSize() {
return ALBUM_MAX_SIZE;
}

}
private final String PHOTO_TITLE_FORBIDDEN_CHARACTERS = "";
private final char PHOTO_TITLE_REPLACEMENT_CHARACTER = '_';
private final int PHOTO_TITLE_MAX_LENGTH = -1;

private final String ALBUM_NAME_FORBIDDEN_CHARACTERS = "";
private final char ALBUM_NAME_REPLACEMENT_CHARACTER = '_';
private final int ALBUM_NAME_MAX_LENGTH = -1;
private final boolean ALBUM_ALLOW_ROOT_PHOTOS = true;
private final int ALBUM_MAX_SIZE = -1;

public String getPhotoTitleForbiddenCharacters() {
return PHOTO_TITLE_FORBIDDEN_CHARACTERS;
}

public char getPhotoTitleReplacementCharater() {
return PHOTO_TITLE_REPLACEMENT_CHARACTER;
}

public int getPhotoTitleMaxLength() {
return PHOTO_TITLE_MAX_LENGTH;
}

public String getAlbumNameForbiddenCharacters() {
return ALBUM_NAME_FORBIDDEN_CHARACTERS;
}

public char getAlbumNameReplacementCharacter() {
return ALBUM_NAME_REPLACEMENT_CHARACTER;
}

public int getAlbumNameMaxLength() {
return ALBUM_NAME_MAX_LENGTH;
}

public boolean getAlbumAllowRootPhotos() {
return ALBUM_ALLOW_ROOT_PHOTOS;
}

public int getAlbumMaxSize() {
return ALBUM_MAX_SIZE;
}
}

0 comments on commit c685930

Please sign in to comment.