-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added two new sections for declarations
- Loading branch information
Showing
29 changed files
with
672 additions
and
11 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
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
33 changes: 33 additions & 0 deletions
33
...main/java/it/cnr/si/cool/jconon/service/application/PosizionamentoRicercatoreService.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,33 @@ | ||
package it.cnr.si.cool.jconon.service.application; | ||
|
||
import it.cnr.cool.web.scripts.exception.ClientMessageException; | ||
import org.apache.chemistry.opencmis.client.api.Folder; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
import java.util.stream.IntStream; | ||
|
||
@Service | ||
public class PosizionamentoRicercatoreService implements ApplicationValidateSend{ | ||
@Override | ||
public void validate(Folder call, Folder application) { | ||
if (application.getSecondaryTypes() | ||
.stream() | ||
.filter(secondaryType -> secondaryType.getId().equalsIgnoreCase("P:jconon_application:aspect_posizionamento_ricercatore")) | ||
.findAny().isPresent()) { | ||
final Integer sum = IntStream.range(1, 4) | ||
.map(i -> applicationValue(application, "jconon_application:posizionamento_ricercatore_" + i)) | ||
.reduce(0, (a, b) -> a + b); | ||
if (sum != 100) { | ||
throw new ClientMessageException("Il totale delle percentuali attribuite [" + sum + "%] deve essere necessariamente il 100%!"); | ||
} | ||
} | ||
} | ||
|
||
private Integer applicationValue(Folder application, String property) { | ||
return Optional.ofNullable(application.<String>getPropertyValue(property)) | ||
.map(s -> s.substring(0, s.length() -1)) | ||
.map(s -> Integer.valueOf(s)) | ||
.orElse(0); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...c/main/java/it/cnr/si/cool/jconon/service/application/PosizionamentoTecnologoService.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,33 @@ | ||
package it.cnr.si.cool.jconon.service.application; | ||
|
||
import it.cnr.cool.web.scripts.exception.ClientMessageException; | ||
import org.apache.chemistry.opencmis.client.api.Folder; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
import java.util.stream.IntStream; | ||
|
||
@Service | ||
public class PosizionamentoTecnologoService implements ApplicationValidateSend{ | ||
@Override | ||
public void validate(Folder call, Folder application) { | ||
if (application.getSecondaryTypes() | ||
.stream() | ||
.filter(secondaryType -> secondaryType.getId().equalsIgnoreCase("P:jconon_application:aspect_posizionamento_tecnologo")) | ||
.findAny().isPresent()) { | ||
final Integer sum = IntStream.range(1, 11) | ||
.map(i -> applicationValue(application, "jconon_application:posizionamento_tecnologo_" + i)) | ||
.reduce(0, (a, b) -> a + b); | ||
if (sum != 100) { | ||
throw new ClientMessageException("Il totale delle percentuali attribuite [" + sum + "%] deve essere necessariamente il 100%!"); | ||
} | ||
} | ||
} | ||
|
||
private Integer applicationValue(Folder application, String property) { | ||
return Optional.ofNullable(application.<String>getPropertyValue(property)) | ||
.map(s -> s.substring(0, s.length() -1)) | ||
.map(s -> Integer.valueOf(s)) | ||
.orElse(0); | ||
} | ||
} |
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
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.