Class PetriNetService
- java.lang.Object
-
- com.netgrif.application.engine.petrinet.service.PetriNetService
-
- All Implemented Interfaces:
IPetriNetService
@Service public class PetriNetService extends java.lang.Object implements IPetriNetService
-
-
Constructor Summary
Constructors Constructor Description PetriNetService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PetriNet
clone(org.bson.types.ObjectId petriNetId)
void
deletePetriNet(java.lang.String processId, LoggedUser loggedUser)
protected void
evaluateRules(PetriNet net, EventPhase phase)
void
evictAllCaches()
void
evictCache(PetriNet net)
java.util.List<PetriNet>
findAllById(java.util.List<java.lang.String> ids)
java.util.List<PetriNet>
findAllByUriNodeId(java.lang.String uriNodeId)
java.util.Optional<PetriNet>
findByImportId(java.lang.String id)
java.util.List<PetriNet>
get(java.util.Collection<org.bson.types.ObjectId> petriNetIds)
java.util.List<PetriNet>
get(java.util.List<java.lang.String> petriNetIds)
PetriNet
get(org.bson.types.ObjectId petriNetId)
Get read only Petri net.java.util.List<PetriNet>
getAll()
java.util.List<PetriNet>
getByIdentifier(java.lang.String identifier)
java.util.List<DataFieldReference>
getDataFieldReferences(java.util.List<TransitionReference> transitions, java.util.Locale locale)
java.util.List<java.lang.String>
getExistingPetriNetIdentifiersFromIdentifiersList(java.util.List<java.lang.String> identifiers)
Determines which of the provided Strings are identifiers ofPetriNet
s uploaded in the system.org.springframework.core.io.FileSystemResource
getFile(java.lang.String netId, java.lang.String title)
protected Importer
getImporter()
PetriNetImportReference
getNetFromCase(java.lang.String caseId)
PetriNet
getNewestVersionByIdentifier(java.lang.String identifier)
PetriNet
getPetriNet(java.lang.String id)
PetriNet
getPetriNet(java.lang.String identifier, Version version)
PetriNetReference
getReference(java.lang.String identifier, Version version, LoggedUser user, java.util.Locale locale)
java.util.List<PetriNetReference>
getReferences(LoggedUser user, java.util.Locale locale)
java.util.List<PetriNetReference>
getReferencesByIdentifier(java.lang.String identifier, LoggedUser user, java.util.Locale locale)
java.util.List<PetriNetReference>
getReferencesByUsersProcessRoles(LoggedUser user, java.util.Locale locale)
java.util.List<PetriNetReference>
getReferencesByVersion(Version version, LoggedUser user, java.util.Locale locale)
java.util.List<TransitionReference>
getTransitionReferences(java.util.List<java.lang.String> netIds, LoggedUser user, java.util.Locale locale)
ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author)
ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.lang.String uriNodeId)
ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.lang.String uriNodeId, java.util.Map<java.lang.String,java.lang.String> params)
ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.util.Map<java.lang.String,java.lang.String> params)
ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, java.lang.String releaseType, LoggedUser author)
Deprecated.ImportPetriNetEventOutcome
importPetriNet(java.io.InputStream xmlFile, java.lang.String releaseType, LoggedUser author, java.lang.String uriNodeId)
Deprecated.protected <T> T
requireNonNull(T obj, java.lang.Object... item)
void
runActions(java.util.List<Action> actions, PetriNet petriNet)
java.util.Optional<PetriNet>
save(PetriNet petriNet)
org.springframework.data.domain.Page<PetriNetReference>
search(PetriNetSearch criteriaClass, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale)
void
setElasticPetriNetService(IElasticPetriNetService elasticPetriNetService)
-
-
-
Method Detail
-
setElasticPetriNetService
@Autowired public void setElasticPetriNetService(IElasticPetriNetService elasticPetriNetService)
-
getImporter
protected Importer getImporter()
-
evictAllCaches
public void evictAllCaches()
- Specified by:
evictAllCaches
in interfaceIPetriNetService
-
evictCache
public void evictCache(PetriNet net)
- Specified by:
evictCache
in interfaceIPetriNetService
-
get
@Cacheable("petriNetCache") public PetriNet get(org.bson.types.ObjectId petriNetId)
Get read only Petri net.- Specified by:
get
in interfaceIPetriNetService
-
get
public java.util.List<PetriNet> get(java.util.Collection<org.bson.types.ObjectId> petriNetIds)
- Specified by:
get
in interfaceIPetriNetService
-
get
public java.util.List<PetriNet> get(java.util.List<java.lang.String> petriNetIds)
- Specified by:
get
in interfaceIPetriNetService
-
clone
public PetriNet clone(org.bson.types.ObjectId petriNetId)
- Specified by:
clone
in interfaceIPetriNetService
-
importPetriNet
@Deprecated public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, java.lang.String releaseType, LoggedUser author) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
Deprecated.- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
importPetriNet
@Deprecated public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, java.lang.String releaseType, LoggedUser author, java.lang.String uriNodeId) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
Deprecated.- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
importPetriNet
public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
importPetriNet
public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.util.Map<java.lang.String,java.lang.String> params) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
importPetriNet
public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.lang.String uriNodeId) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
importPetriNet
public ImportPetriNetEventOutcome importPetriNet(java.io.InputStream xmlFile, VersionType releaseType, LoggedUser author, java.lang.String uriNodeId, java.util.Map<java.lang.String,java.lang.String> params) throws java.io.IOException, MissingPetriNetMetaDataException, MissingIconKeyException
- Specified by:
importPetriNet
in interfaceIPetriNetService
- Throws:
java.io.IOException
MissingPetriNetMetaDataException
MissingIconKeyException
-
evaluateRules
protected void evaluateRules(PetriNet net, EventPhase phase)
-
save
public java.util.Optional<PetriNet> save(PetriNet petriNet)
- Specified by:
save
in interfaceIPetriNetService
-
getPetriNet
@Cacheable("petriNetById") public PetriNet getPetriNet(java.lang.String id)
- Specified by:
getPetriNet
in interfaceIPetriNetService
-
getPetriNet
@Cacheable(value="petriNetByIdentifier", key="#identifier+#version.toString()", unless="#result == null") public PetriNet getPetriNet(java.lang.String identifier, Version version)
- Specified by:
getPetriNet
in interfaceIPetriNetService
-
getByIdentifier
public java.util.List<PetriNet> getByIdentifier(java.lang.String identifier)
- Specified by:
getByIdentifier
in interfaceIPetriNetService
-
findAllByUriNodeId
public java.util.List<PetriNet> findAllByUriNodeId(java.lang.String uriNodeId)
- Specified by:
findAllByUriNodeId
in interfaceIPetriNetService
-
findAllById
public java.util.List<PetriNet> findAllById(java.util.List<java.lang.String> ids)
- Specified by:
findAllById
in interfaceIPetriNetService
-
getNewestVersionByIdentifier
@Cacheable(value="petriNetNewest", unless="#result == null") public PetriNet getNewestVersionByIdentifier(java.lang.String identifier)
- Specified by:
getNewestVersionByIdentifier
in interfaceIPetriNetService
-
getExistingPetriNetIdentifiersFromIdentifiersList
public java.util.List<java.lang.String> getExistingPetriNetIdentifiersFromIdentifiersList(java.util.List<java.lang.String> identifiers)
Determines which of the provided Strings are identifiers ofPetriNet
s uploaded in the system.- Specified by:
getExistingPetriNetIdentifiersFromIdentifiersList
in interfaceIPetriNetService
- Parameters:
identifiers
- a list of Strings that represent potential PetriNet identifiers- Returns:
- a list containing a subset of the input strings that correspond to identifiers of PetriNets that are present in the system
-
getNetFromCase
public PetriNetImportReference getNetFromCase(java.lang.String caseId)
- Specified by:
getNetFromCase
in interfaceIPetriNetService
-
getAll
public java.util.List<PetriNet> getAll()
- Specified by:
getAll
in interfaceIPetriNetService
-
getFile
public org.springframework.core.io.FileSystemResource getFile(java.lang.String netId, java.lang.String title)
- Specified by:
getFile
in interfaceIPetriNetService
-
getReferences
public java.util.List<PetriNetReference> getReferences(LoggedUser user, java.util.Locale locale)
- Specified by:
getReferences
in interfaceIPetriNetService
-
getReferencesByIdentifier
public java.util.List<PetriNetReference> getReferencesByIdentifier(java.lang.String identifier, LoggedUser user, java.util.Locale locale)
- Specified by:
getReferencesByIdentifier
in interfaceIPetriNetService
-
getReferencesByVersion
public java.util.List<PetriNetReference> getReferencesByVersion(Version version, LoggedUser user, java.util.Locale locale)
- Specified by:
getReferencesByVersion
in interfaceIPetriNetService
-
getReferencesByUsersProcessRoles
public java.util.List<PetriNetReference> getReferencesByUsersProcessRoles(LoggedUser user, java.util.Locale locale)
- Specified by:
getReferencesByUsersProcessRoles
in interfaceIPetriNetService
-
getReference
public PetriNetReference getReference(java.lang.String identifier, Version version, LoggedUser user, java.util.Locale locale)
- Specified by:
getReference
in interfaceIPetriNetService
-
getTransitionReferences
public java.util.List<TransitionReference> getTransitionReferences(java.util.List<java.lang.String> netIds, LoggedUser user, java.util.Locale locale)
- Specified by:
getTransitionReferences
in interfaceIPetriNetService
-
getDataFieldReferences
public java.util.List<DataFieldReference> getDataFieldReferences(java.util.List<TransitionReference> transitions, java.util.Locale locale)
- Specified by:
getDataFieldReferences
in interfaceIPetriNetService
-
findByImportId
public java.util.Optional<PetriNet> findByImportId(java.lang.String id)
- Specified by:
findByImportId
in interfaceIPetriNetService
-
search
public org.springframework.data.domain.Page<PetriNetReference> search(PetriNetSearch criteriaClass, LoggedUser user, org.springframework.data.domain.Pageable pageable, java.util.Locale locale)
- Specified by:
search
in interfaceIPetriNetService
-
deletePetriNet
@Transactional public void deletePetriNet(java.lang.String processId, LoggedUser loggedUser)
- Specified by:
deletePetriNet
in interfaceIPetriNetService
-
runActions
public void runActions(java.util.List<Action> actions, PetriNet petriNet)
- Specified by:
runActions
in interfaceIPetriNetService
-
requireNonNull
protected <T> T requireNonNull(T obj, java.lang.Object... item)
-
-