-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
388 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.89 MB
src/main/frontend/generated/jar-resources/images/custom-images/write_flash.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
src/main/java/com/esp/espflow/entity/WizardFlashEspEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.esp.espflow.entity; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Entity | ||
@Table(name = "wizard_flashesp") | ||
public class WizardFlashEspEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private boolean enableWizard; | ||
private String name; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/esp/espflow/entity/dto/WizardFlashEspDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.esp.espflow.entity.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Value; | ||
|
||
/** | ||
* @author rub'n | ||
*/ | ||
@Builder | ||
@Value | ||
@Getter | ||
public class WizardFlashEspDto { | ||
boolean enableWizard; | ||
String name; | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/esp/espflow/entity/event/DialogHideEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.esp.espflow.entity.event; | ||
|
||
public enum DialogHideEvent { | ||
HIDE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/com/esp/espflow/mappers/WizardFlashEspMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.esp.espflow.mappers; | ||
|
||
import com.esp.espflow.entity.WizardFlashEspEntity; | ||
import com.esp.espflow.entity.dto.WizardFlashEspDto; | ||
import org.mapstruct.InheritInverseConfiguration; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface WizardFlashEspMapper { | ||
|
||
WizardFlashEspMapper INSTANCE = Mappers.getMapper(WizardFlashEspMapper.class); | ||
|
||
WizardFlashEspEntity dtoToEntity(final WizardFlashEspDto wizardFlashEspDto); | ||
|
||
@InheritInverseConfiguration | ||
WizardFlashEspDto entityToDto(final WizardFlashEspEntity wizardFlashEspDto); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/esp/espflow/security/UserDetailsServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...m/esp/espflow/service/UserRepository.java → ...w/service/respository/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/esp/espflow/service/respository/WizardFlashEspRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.esp.espflow.service.respository; | ||
|
||
import com.esp.espflow.entity.WizardFlashEspEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Optional; | ||
|
||
@Repository | ||
public interface WizardFlashEspRepository extends JpaRepository<WizardFlashEspEntity, Long> { | ||
|
||
Optional<WizardFlashEspEntity> findByName(String name); | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/esp/espflow/service/respository/impl/WizardFlashEspService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.esp.espflow.service.respository.impl; | ||
|
||
import com.esp.espflow.entity.WizardFlashEspEntity; | ||
import com.esp.espflow.entity.dto.WizardFlashEspDto; | ||
import com.esp.espflow.mappers.WizardFlashEspMapper; | ||
import com.esp.espflow.service.respository.WizardFlashEspRepository; | ||
import jakarta.transaction.Transactional; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author rub'n | ||
*/ | ||
@Log4j2 | ||
@Service | ||
@RequiredArgsConstructor | ||
public class WizardFlashEspService { | ||
|
||
private final WizardFlashEspRepository wizardFlashEspRepository; | ||
|
||
/** | ||
* @param wizardFlashEspDto | ||
*/ | ||
public void save(WizardFlashEspDto wizardFlashEspDto) { | ||
var entity = WizardFlashEspMapper.INSTANCE.dtoToEntity(wizardFlashEspDto); | ||
this.wizardFlashEspRepository.findByName(entity.getName()) | ||
.ifPresentOrElse(hideButton -> { | ||
hideButton.setEnableWizard(entity.isEnableWizard()); | ||
wizardFlashEspRepository.save(hideButton); | ||
log.info("Entity updated {}", hideButton); | ||
}, () -> { | ||
wizardFlashEspRepository.save(entity); | ||
log.info("Entity saved {}", entity); | ||
}); | ||
} | ||
|
||
/** | ||
* | ||
* @param name of this Wizard | ||
* | ||
* @return A {@link Optional<WizardFlashEspEntity>} | ||
*/ | ||
@Transactional | ||
public Optional<WizardFlashEspDto> findWizardFlashEsp(String name) { | ||
return this.wizardFlashEspRepository.findByName(name) | ||
.map(WizardFlashEspMapper.INSTANCE::entityToDto); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.