diff --git a/src/main/java/de/deadlocker8/budgetmaster/accounts/Account.java b/src/main/java/de/deadlocker8/budgetmaster/accounts/Account.java index fd3f7c0bbd144f3881ef04be1d98ccbc41af3037..551578a03ffd4a602da0db19cd452f2f79f5278a 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/accounts/Account.java +++ b/src/main/java/de/deadlocker8/budgetmaster/accounts/Account.java @@ -3,7 +3,6 @@ package de.deadlocker8.budgetmaster.accounts; import com.google.gson.annotations.Expose; import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.Iconizable; -import de.deadlocker8.budgetmaster.images.Image; import de.deadlocker8.budgetmaster.transactions.Transaction; import de.deadlocker8.budgetmaster.utils.ProvidesID; @@ -33,16 +32,9 @@ public class Account implements ProvidesID, Iconizable private Boolean isSelected = false; private Boolean isDefault = false; - @Deprecated(since = "v2.6.0", forRemoval = true) - private Boolean isReadOnly = false; - @Expose private AccountState accountState; - @ManyToOne - @Deprecated(since = "v2.7.0", forRemoval = true) - private Image icon; - @OneToOne(cascade = CascadeType.REMOVE) @Expose private Icon iconReference; @@ -119,12 +111,6 @@ public class Account implements ProvidesID, Iconizable isDefault = aDefault; } - @Deprecated(since = "v2.6.0", forRemoval = true) - public Boolean isReadOnly() - { - return isReadOnly; - } - public AccountState getAccountState() { return accountState; @@ -145,18 +131,6 @@ public class Account implements ProvidesID, Iconizable this.type = type; } - @Deprecated(since = "v2.7.0", forRemoval = true) - public Image getIcon() - { - return icon; - } - - @Deprecated(since = "v2.7.0", forRemoval = true) - public void setIcon(Image icon) - { - this.icon = icon; - } - public Icon getIconReference() { return iconReference; @@ -193,7 +167,6 @@ public class Account implements ProvidesID, Iconizable Objects.equals(isSelected, account.isSelected) && Objects.equals(isDefault, account.isDefault) && accountState == account.accountState && - Objects.equals(icon, account.icon) && Objects.equals(iconReference, account.iconReference) && type == account.type; } @@ -201,6 +174,6 @@ public class Account implements ProvidesID, Iconizable @Override public int hashCode() { - return Objects.hash(ID, name, isSelected, isDefault, accountState, icon, iconReference, type); + return Objects.hash(ID, name, isSelected, isDefault, accountState, iconReference, type); } } \ No newline at end of file diff --git a/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountService.java b/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountService.java index 1d756f109182bbcd2b2abc40140ed16c3b5f7072..44c661082abab569542b2aeafcd96364eb96d208 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountService.java +++ b/src/main/java/de/deadlocker8/budgetmaster/accounts/AccountService.java @@ -2,14 +2,12 @@ package de.deadlocker8.budgetmaster.accounts; import de.deadlocker8.budgetmaster.authentication.User; import de.deadlocker8.budgetmaster.authentication.UserRepository; -import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.IconService; -import de.deadlocker8.budgetmaster.images.Image; import de.deadlocker8.budgetmaster.images.ImageService; import de.deadlocker8.budgetmaster.services.AccessAllEntities; +import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.services.Resettable; import de.deadlocker8.budgetmaster.transactions.TransactionService; -import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.utils.Strings; import de.thecodelabs.utils.util.Localization; import org.padler.natorder.NaturalOrderComparator; @@ -153,20 +151,6 @@ public class AccountService implements Resettable, AccessAllEntities<Account>, A for(Account account : accountRepository.findAll()) { handleNullValuesForAccountState(account); - - if(account.getIcon() != null && account.getIconReference() == null) - { - Integer imageID = account.getIcon().getID(); - Image image = imageService.getRepository().findById(imageID).orElseThrow(); - - Icon iconReference = new Icon(image); - iconService.getRepository().save(iconReference); - - account.setIconReference(iconReference); - account.setIcon(null); - LOGGER.debug(MessageFormat.format("Updated account {0}: Converted attribute \"icon\" to \"iconReference\" {1}", account.getName(), image.getFileName())); - } - accountRepository.save(account); } } @@ -175,14 +159,7 @@ public class AccountService implements Resettable, AccessAllEntities<Account>, A { if(account.getAccountState() == null) { - if(account.isReadOnly() == null || !account.isReadOnly()) - { - account.setAccountState(AccountState.FULL_ACCESS); - } - else - { - account.setAccountState(AccountState.READ_ONLY); - } + account.setAccountState(AccountState.FULL_ACCESS); LOGGER.debug(MessageFormat.format("Updated account {0}: Set missing attribute \"accountState\" to {1}", account.getName(), account.getAccountState())); } } diff --git a/src/main/java/de/deadlocker8/budgetmaster/categories/Category.java b/src/main/java/de/deadlocker8/budgetmaster/categories/Category.java index 1476414776e57e9aa79850391d808ea8138690bb..daa113d857f444d282d5881768fbf57b1e67d318 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/categories/Category.java +++ b/src/main/java/de/deadlocker8/budgetmaster/categories/Category.java @@ -33,10 +33,6 @@ public class Category implements ProvidesID, Iconizable @Expose private CategoryType type; - @Expose - @Deprecated(since = "v2.7.0", forRemoval = true) - private String icon; - @OneToOne(cascade = CascadeType.REMOVE) @Expose private Icon iconReference; @@ -101,18 +97,6 @@ public class Category implements ProvidesID, Iconizable this.type = type; } - @Deprecated(since = "v2.7.0", forRemoval = true) - public String getIcon() - { - return icon; - } - - @Deprecated(since = "v2.7.0", forRemoval = true) - public void setIcon(String icon) - { - this.icon = icon; - } - public Icon getIconReference() { return iconReference; @@ -160,13 +144,12 @@ public class Category implements ProvidesID, Iconizable Objects.equals(name, category.name) && Objects.equals(color, category.color) && type == category.type && - Objects.equals(icon, category.icon) && Objects.equals(iconReference, category.iconReference); } @Override public int hashCode() { - return Objects.hash(ID, name, color, type, icon, iconReference); + return Objects.hash(ID, name, color, type, iconReference); } } \ No newline at end of file diff --git a/src/main/java/de/deadlocker8/budgetmaster/categories/CategoryService.java b/src/main/java/de/deadlocker8/budgetmaster/categories/CategoryService.java index 707b2a3392e0321871065b8b57fa288005064d31..a3f50e5b0846c0b340a4643c2718831c9be3c151 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/categories/CategoryService.java +++ b/src/main/java/de/deadlocker8/budgetmaster/categories/CategoryService.java @@ -1,11 +1,10 @@ package de.deadlocker8.budgetmaster.categories; -import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.IconService; import de.deadlocker8.budgetmaster.services.AccessAllEntities; +import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.services.Resettable; import de.deadlocker8.budgetmaster.transactions.Transaction; -import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.utils.Strings; import de.thecodelabs.utils.util.Localization; import org.padler.natorder.NaturalOrderComparator; @@ -14,7 +13,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.text.MessageFormat; import java.util.List; import java.util.NoSuchElementException; import java.util.Optional; @@ -104,27 +102,6 @@ public class CategoryService implements Resettable, AccessAllEntities<Category>, categoryRepository.save(new Category(Localization.getString(Strings.CATEGORY_REST), "#FFFF00", CategoryType.REST)); LOGGER.debug("Created default category REST"); } - - updateMissingAttributes(); - } - - private void updateMissingAttributes() - { - for(Category category : categoryRepository.findAll()) - { - if(category.getIcon() != null && !category.getIcon().isEmpty() &&category.getIconReference() == null) - { - final String iconName = category.getIcon(); - Icon iconReference = new Icon(iconName); - iconService.getRepository().save(iconReference); - - category.setIconReference(iconReference); - category.setIcon(null); - - categoryRepository.save(category); - LOGGER.debug(MessageFormat.format("Updated category {0}: Converted attribute \"icon\" to \"iconReference\" {1}", category.getName(), iconName)); - } - } } @Override diff --git a/src/main/java/de/deadlocker8/budgetmaster/templates/Template.java b/src/main/java/de/deadlocker8/budgetmaster/templates/Template.java index 2bf0922f5566be91985702a1281abe30f42d6786..680cc3b48cdc97443f08942d8b462a1fecadc9dc 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/templates/Template.java +++ b/src/main/java/de/deadlocker8/budgetmaster/templates/Template.java @@ -5,7 +5,6 @@ import de.deadlocker8.budgetmaster.accounts.Account; import de.deadlocker8.budgetmaster.categories.Category; import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.Iconizable; -import de.deadlocker8.budgetmaster.images.Image; import de.deadlocker8.budgetmaster.tags.Tag; import de.deadlocker8.budgetmaster.transactions.Transaction; import de.deadlocker8.budgetmaster.transactions.TransactionBase; @@ -45,10 +44,6 @@ public class Template implements TransactionBase, Iconizable @Expose private String description; - @ManyToOne - @Deprecated(since = "v2.7.0", forRemoval = true) - private Image icon; - @OneToOne(cascade = CascadeType.REMOVE) @Expose private Icon iconReference; @@ -81,7 +76,6 @@ public class Template implements TransactionBase, Iconizable this.category = template.getCategory(); this.name = template.getName(); this.description = template.getDescription(); - this.icon = template.getIcon(); this.iconReference = template.getIconReference(); this.tags = new ArrayList<>(template.getTags()); this.transferAccount = template.getTransferAccount(); @@ -198,18 +192,6 @@ public class Template implements TransactionBase, Iconizable this.description = description; } - @Deprecated(since = "v2.7.0", forRemoval = true) - public Image getIcon() - { - return icon; - } - - @Deprecated(since = "v2.7.0", forRemoval = true) - public void setIcon(Image icon) - { - this.icon = icon; - } - public Icon getIconReference() { return iconReference; @@ -295,7 +277,6 @@ public class Template implements TransactionBase, Iconizable Objects.equals(category, template.category) && Objects.equals(name, template.name) && Objects.equals(description, template.description) && - Objects.equals(icon, template.icon) && Objects.equals(iconReference, template.iconReference) && Objects.equals(tags, template.tags) && Objects.equals(transferAccount, template.transferAccount); @@ -304,6 +285,6 @@ public class Template implements TransactionBase, Iconizable @Override public int hashCode() { - return Objects.hash(ID, templateName, amount, isExpenditure, account, category, name, description, icon, iconReference, tags, transferAccount); + return Objects.hash(ID, templateName, amount, isExpenditure, account, category, name, description, iconReference, tags, transferAccount); } } diff --git a/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateService.java b/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateService.java index 31ac8130e098ccf7020d71ae9ed9a32c68ed5837..6b5d8cc06af2a7bf64dcca366a5de68cba932834 100644 --- a/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateService.java +++ b/src/main/java/de/deadlocker8/budgetmaster/templates/TemplateService.java @@ -7,16 +7,14 @@ import de.deadlocker8.budgetmaster.accounts.AccountService; import de.deadlocker8.budgetmaster.accounts.AccountState; import de.deadlocker8.budgetmaster.categories.CategoryService; import de.deadlocker8.budgetmaster.categories.CategoryType; -import de.deadlocker8.budgetmaster.icon.Icon; import de.deadlocker8.budgetmaster.icon.IconService; -import de.deadlocker8.budgetmaster.images.Image; import de.deadlocker8.budgetmaster.images.ImageService; import de.deadlocker8.budgetmaster.services.AccessAllEntities; +import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.services.Resettable; import de.deadlocker8.budgetmaster.settings.SettingsService; import de.deadlocker8.budgetmaster.transactions.Transaction; import de.deadlocker8.budgetmaster.transactions.TransactionBase; -import de.deadlocker8.budgetmaster.services.AccessEntityByID; import de.deadlocker8.budgetmaster.utils.FontAwesomeIcons; import org.padler.natorder.NaturalOrderComparator; import org.slf4j.Logger; @@ -25,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.ui.Model; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -72,28 +69,6 @@ public class TemplateService implements Resettable, AccessAllEntities<Template>, @Override public void createDefaults() { - updateMissingAttributes(); - } - - private void updateMissingAttributes() - { - for(Template template : templateRepository.findAll()) - { - if(template.getIcon() != null && template.getIconReference() == null) - { - Integer imageID = template.getIcon().getID(); - Image image = imageService.getRepository().findById(imageID).orElseThrow(); - - Icon iconReference = new Icon(image); - iconService.getRepository().save(iconReference); - - template.setIconReference(iconReference); - template.setIcon(null); - - templateRepository.save(template); - LOGGER.debug(MessageFormat.format("Updated template {0}: Converted attribute \"icon\" to \"iconReference\" {1}", template.getName(), image.getFileName())); - } - } } public void createFromTransaction(String templateName, Transaction transaction, boolean includeCategory, boolean includeAccount)