Package de.xima.fc.export
Class AProjektUtil
- java.lang.Object
-
- de.xima.fc.export.AProjektUtil
-
- Direct Known Subclasses:
ProjektCopyUtil
,ProjektExportUtil
,ProjektImportUtil
,ProjektUpdateUtil
public class AProjektUtil extends Object
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AProjektUtil(Mandant man, IEntityContext ec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addErrorMessage(String i18nKey, FCMessage.ParamsLocalizer params)
protected void
addErrorMessage(String i18nKey, Serializable... param)
protected void
addInfoMessage(String i18nKey, FCMessage.ParamsLocalizer params)
protected void
addInfoMessage(String i18nKey, Serializable... param)
protected void
addWarnMessage(String i18nKey, FCMessage.ParamsLocalizer params)
protected void
addWarnMessage(String i18nKey, Serializable... param)
protected void
checkClientResourceExists(ERessourcenTyp resourceType, String resourceName)
Checks whether the given resource exists for the action and issues and error message in case it does not.static boolean
checkProjectAliasExist(IEntityContext ec, String projectAlias, Mandant client)
Checks whether or not the given project name already exist within the given clientstatic boolean
checkProjectNameExist(IEntityContext ec, String projectName, Mandant client)
Checks whether or not the given project name already exist within the given clientprotected WorkflowVersion
cloneWorkflowVersion(WorkflowVersion oldVersion)
Creates a copy of the given workflow version.protected FormVersion
createActiveFormVersion(FormVersion neueFormversion, Projekt neuesProjekt, String formDir)
Erzeugt eine aktive FormVersionprotected Map<Long,Aktion>
createAktion(Map<Long,Status> mapStatus, boolean disableAllActions)
Erstellt Aktionen anhand der StatusListeprotected void
createAktionen(List<Status> statusListe, List<ExportAktionData> exportAktionListe, List<ExportBedingungData> exportBedingungListe)
protected void
createBedingung(Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap)
Erstellt Bedingungen anahnd der AktionsListeprotected List<ExportBedingungData>
createBedingungenExportData(List<ExportBedingungData> exportBedingungListe, Projekt project)
protected void
createFile(String filePath, byte[] data)
protected void
createFormElements(List<FormElement> formElements, FormVersion formVersion)
Erzeugt ein FormElementprotected void
createFormVersionFile(FormVersion fv, String targetPath)
protected <T extends de.xima.cmn.dao.interfaces.IEntity<Long>>
Map<Long,T>createIDsMap(List<T> options)
Generiert aus einer Liste vonIEntity
-Objekten eine Map mit ID als Keyprotected javax.xml.bind.JAXBContext
createJAXBContext(Class<?>[] classesToBeBound, List<String> bindings)
protected <T extends INameProviding>
Map<String,T>createNamedMap(List<T> options)
Generiert aus einer Liste vonINameProviding
-Objekten eine Map mit Name als Keystatic FormVersion
createNewFormVersion(IEntityContext ec, Projekt project, Benutzer user)
static FormVersion
createNewFormVersion(IEntityContext ec, Long projectId, Benutzer user)
protected List<Status>
createPreStatus(HashMap<Long,Status> existierendeStatusListe, List<Status> altStatusListe)
protected ProjektRessource
createProjektRessource(Projekt neuesProjekt, File file)
protected void
createProjektRessourcenFiles(Projekt projekt, String targetPath)
protected void
createProjektRessources(Projekt neuesProjekt, File resFile)
protected HashMap<Long,Status>
createStatus(List<? extends Status> altStatusListe, Projekt projekt)
Methode zum Erzeugen eines Statusprotected <T> T
deproxyEntity(T obj)
String
findUniqueAlias(String alias)
Attempt to find a unique alias (for the current client).protected List<Aktion>
getAktionsListe(Status status)
Methode zum Erzeugen der Aktion-Datenprotected List<BenutzerGruppe>
getBenutzergruppen(List<BenutzerGruppe> bgl)
Methode zum Auslesen der Benutzergruppenprotected List<BenutzerGruppe>
getBenutzerGruppenListe(List<BenutzerGruppe> benutzerGruppen)
liest Benutzergruppen aus der DBList<FCMessage>
getErrorMsgList()
protected List<FormElement>
getFormElements(FormVersion formVersion)
Methode zum Ermitteln der FormElementsprotected List<String>
getFormVersionBindings()
protected com.google.gson.GsonBuilder
getGsonBuilderWithDefaults()
The defaults that are currently set are as follows: A custom type adapter for Date objects as the built-in one is not cross Java version compatible.List<FCMessage>
getInfoMsgList()
protected Mandant
getMandant()
protected List<MandantFrontendServer>
getMandantFrontendServer(List<MandantFrontendServer> bgl)
Methode zum Auslesen der MandantFrontendServerprotected Projekt
getNewProjekt(Projekt newProject, Projekt sourceProjekt, String curBenutzer)
Erzeugt ein neues Projektprotected Collection<ProjektRessource>
getProjektRessources(FormVersion formVersion)
protected List<Status>
getStatusListe(Projekt projekt)
Methode zum Erzeugen der Status-Datenprotected List<String>
getVorgangsBindings()
protected Aktion
handleAction(long oldActionId, Aktion newAction, Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap, ExportBedingungData exportBedingungData)
protected Bedingung
handleBedingungForImport(Bedingung neueBedingung, Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap, ExportBedingungData exportBedingungData)
Should only be used for importing older project exportsprotected void
importProjektRessources(Projekt neuesProjekt, String resDirname, String resFilename)
protected void
updatePreviewImage(Projekt newProject, Projekt sourceProject)
protected void
writeJSONtoFile(File tempDir, String filename, String content)
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
ec
protected final IEntityContext ec
-
client
protected final Mandant client
-
FC_EXPORT_PROJEKT
protected static final String FC_EXPORT_PROJEKT
- See Also:
- Constant Field Values
-
FC_EXPORT_PROJEKTHELP
protected static final String FC_EXPORT_PROJEKTHELP
- See Also:
- Constant Field Values
-
FC_EXPORT_AKTIVE_VERSION
protected static final String FC_EXPORT_AKTIVE_VERSION
- See Also:
- Constant Field Values
-
FC_EXPORT_DOI
protected static final String FC_EXPORT_DOI
- See Also:
- Constant Field Values
-
FC_EXPORT_DOI_DATA
protected static final String FC_EXPORT_DOI_DATA
- See Also:
- Constant Field Values
-
FC_EXPORT_FORM_ELEMENTS
protected static final String FC_EXPORT_FORM_ELEMENTS
- See Also:
- Constant Field Values
-
FC_EXPORT_STATUS
protected static final String FC_EXPORT_STATUS
- See Also:
- Constant Field Values
-
FC_EXPORT_STATUSHELP
protected static final String FC_EXPORT_STATUSHELP
- See Also:
- Constant Field Values
-
FC_EXPORT_AKTIONEN
protected static final String FC_EXPORT_AKTIONEN
- See Also:
- Constant Field Values
-
FC_EXPORT_BEDINGUNG
protected static final String FC_EXPORT_BEDINGUNG
- See Also:
- Constant Field Values
-
FC_EXPORT_FORMVERSION
protected static final String FC_EXPORT_FORMVERSION
- See Also:
- Constant Field Values
-
FC_EXPORT_FORMVERSION_DATA
protected static final String FC_EXPORT_FORMVERSION_DATA
- See Also:
- Constant Field Values
-
FC_EXPORT_FORM_RESSOURCES
protected static final String FC_EXPORT_FORM_RESSOURCES
- See Also:
- Constant Field Values
-
FC_EXPORT_RESOURCE
protected static final String FC_EXPORT_RESOURCE
- See Also:
- Constant Field Values
-
FC_EXPORT_VORGAENGE
protected static final String FC_EXPORT_VORGAENGE
- See Also:
- Constant Field Values
-
FC_EXPORT_VORGAENGE_DATA
protected static final String FC_EXPORT_VORGAENGE_DATA
- See Also:
- Constant Field Values
-
m
@Deprecated protected final Mandant m
Deprecated.
-
FC_EXPORT_METADATA
protected static final String FC_EXPORT_METADATA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AProjektUtil
public AProjektUtil(Mandant man, IEntityContext ec)
-
-
Method Detail
-
addErrorMessage
protected void addErrorMessage(String i18nKey, Serializable... param)
-
addErrorMessage
protected void addErrorMessage(String i18nKey, FCMessage.ParamsLocalizer params)
-
addWarnMessage
protected void addWarnMessage(String i18nKey, Serializable... param)
-
addWarnMessage
protected void addWarnMessage(String i18nKey, FCMessage.ParamsLocalizer params)
-
createNewFormVersion
public static final FormVersion createNewFormVersion(IEntityContext ec, Long projectId, Benutzer user)
-
createNewFormVersion
public static final FormVersion createNewFormVersion(IEntityContext ec, Projekt project, Benutzer user)
-
createFile
protected void createFile(String filePath, byte[] data) throws IOException
- Throws:
IOException
-
addInfoMessage
protected void addInfoMessage(String i18nKey, Serializable... param)
-
addInfoMessage
protected void addInfoMessage(String i18nKey, FCMessage.ParamsLocalizer params)
-
getMandant
protected Mandant getMandant()
-
writeJSONtoFile
protected void writeJSONtoFile(File tempDir, String filename, String content) throws IOException
- Throws:
IOException
-
getFormElements
protected List<FormElement> getFormElements(FormVersion formVersion)
Methode zum Ermitteln der FormElements- Parameters:
formVersion
-- Returns:
- List
-
findUniqueAlias
public String findUniqueAlias(String alias) throws LimitExceededException
Attempt to find a unique alias (for the current client). If no project with the given alias exists, return that alias. Otherwise, attempt to suffix the given alias with an index.- Parameters:
alias
- Desired base alias to be used.- Returns:
- A (non-empty) alias that is not used yet by any project of the current client. An empty string iff no unique alias could be found.
- Throws:
LimitExceededException
- if the alias generation exceeded the length limit
-
checkProjectNameExist
public static final boolean checkProjectNameExist(IEntityContext ec, String projectName, Mandant client)
Checks whether or not the given project name already exist within the given client- Parameters:
ec
-IEntityContext
in which this action should be performedprojectName
-String
project name to check forclient
-Mandant
to check for- Returns:
true
if name already exists
-
checkProjectAliasExist
public static final boolean checkProjectAliasExist(IEntityContext ec, String projectAlias, Mandant client)
Checks whether or not the given project name already exist within the given client- Parameters:
ec
-IEntityContext
in which this action should be performedprojectAlias
-String
project alias to check forclient
-Mandant
to check for- Returns:
true
if alias already exists
-
checkClientResourceExists
protected void checkClientResourceExists(ERessourcenTyp resourceType, String resourceName)
Checks whether the given resource exists for the action and issues and error message in case it does not.- Parameters:
resourceType
- Type of resource. No check is performed unless this isERessourcenTyp.MANDANT
.resourceName
- Name of the resource to check.
-
getStatusListe
protected List<Status> getStatusListe(Projekt projekt)
Methode zum Erzeugen der Status-Daten- Parameters:
projekt
-- Returns:
- List
-
getAktionsListe
protected List<Aktion> getAktionsListe(Status status)
Methode zum Erzeugen der Aktion-Daten- Parameters:
status
-- Returns:
- List
-
handleAction
protected Aktion handleAction(long oldActionId, Aktion newAction, Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap, ExportBedingungData exportBedingungData) throws Exception
- Throws:
Exception
-
handleBedingungForImport
protected Bedingung handleBedingungForImport(Bedingung neueBedingung, Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap, ExportBedingungData exportBedingungData) throws Exception
Should only be used for importing older project exports- Throws:
Exception
-
createBedingung
protected void createBedingung(Map<Long,Aktion> aktionMap, Map<Long,Status> statusMap) throws Exception
Erstellt Bedingungen anahnd der AktionsListe- Parameters:
aktionMap
-statusMap
-- Throws:
Exception
-
createAktion
protected Map<Long,Aktion> createAktion(Map<Long,Status> mapStatus, boolean disableAllActions)
Erstellt Aktionen anhand der StatusListe- Parameters:
mapStatus
-disableAllActions
- Flag das angibt, ob neue Aktionen deaktiviert werden sollen- Returns:
- Map<Integer, Aktion>
-
getNewProjekt
protected Projekt getNewProjekt(Projekt newProject, Projekt sourceProjekt, String curBenutzer)
Erzeugt ein neues Projekt- Parameters:
newProject
-curBenutzer
-- Returns:
-
cloneWorkflowVersion
protected WorkflowVersion cloneWorkflowVersion(WorkflowVersion oldVersion)
Creates a copy of the given workflow version.- Parameters:
oldVersion
- An entity to clone.- Returns:
- The cloned entity.
-
createActiveFormVersion
protected FormVersion createActiveFormVersion(FormVersion neueFormversion, Projekt neuesProjekt, String formDir) throws IOException, com.alibaba.fastjson.JSONException
Erzeugt eine aktive FormVersion- Parameters:
neueFormversion
-neuesProjekt
-- Returns:
- FormVersion oder null
- Throws:
IOException
com.alibaba.fastjson.JSONException
-
createFormElements
protected void createFormElements(List<FormElement> formElements, FormVersion formVersion)
Erzeugt ein FormElement- Parameters:
formElements
- Elements to create.formVersion
- Form version where to create the elements.
-
getBenutzergruppen
protected List<BenutzerGruppe> getBenutzergruppen(List<BenutzerGruppe> bgl)
Methode zum Auslesen der Benutzergruppen- Parameters:
bgl
-- Returns:
- List
-
getMandantFrontendServer
protected List<MandantFrontendServer> getMandantFrontendServer(List<MandantFrontendServer> bgl)
Methode zum Auslesen der MandantFrontendServer- Parameters:
bgl
-- Returns:
- List
-
createStatus
protected HashMap<Long,Status> createStatus(List<? extends Status> altStatusListe, Projekt projekt)
Methode zum Erzeugen eines Status- Parameters:
altStatusListe
-projekt
-- Returns:
-
getBenutzerGruppenListe
protected List<BenutzerGruppe> getBenutzerGruppenListe(List<BenutzerGruppe> benutzerGruppen)
liest Benutzergruppen aus der DB- Parameters:
benutzerGruppen
-- Returns:
- List
-
createPreStatus
protected List<Status> createPreStatus(HashMap<Long,Status> existierendeStatusListe, List<Status> altStatusListe)
- Parameters:
existierendeStatusListe
-altStatusListe
-- Returns:
- List
-
createBedingungenExportData
protected List<ExportBedingungData> createBedingungenExportData(List<ExportBedingungData> exportBedingungListe, Projekt project)
-
createProjektRessourcenFiles
protected void createProjektRessourcenFiles(Projekt projekt, String targetPath) throws IOException
- Throws:
IOException
-
getProjektRessources
protected Collection<ProjektRessource> getProjektRessources(FormVersion formVersion)
-
createFormVersionFile
protected void createFormVersionFile(FormVersion fv, String targetPath) throws IOException
- Throws:
IOException
-
createAktionen
protected void createAktionen(List<Status> statusListe, List<ExportAktionData> exportAktionListe, List<ExportBedingungData> exportBedingungListe)
-
importProjektRessources
protected void importProjektRessources(Projekt neuesProjekt, String resDirname, String resFilename) throws IOException
- Throws:
IOException
-
createProjektRessources
protected void createProjektRessources(Projekt neuesProjekt, File resFile) throws IOException
- Throws:
IOException
-
createProjektRessource
protected ProjektRessource createProjektRessource(Projekt neuesProjekt, File file) throws IOException
- Throws:
IOException
-
deproxyEntity
protected <T> T deproxyEntity(T obj)
-
getGsonBuilderWithDefaults
protected com.google.gson.GsonBuilder getGsonBuilderWithDefaults()
The defaults that are currently set are as follows:- A custom type adapter for Date objects as the built-in one is not cross Java version compatible.
- Returns:
- A newly created
GsonBuilder
with some defaults already set.
-
createJAXBContext
protected javax.xml.bind.JAXBContext createJAXBContext(Class<?>[] classesToBeBound, List<String> bindings) throws javax.xml.bind.JAXBException
- Throws:
javax.xml.bind.JAXBException
-
createNamedMap
protected <T extends INameProviding> Map<String,T> createNamedMap(List<T> options)
Generiert aus einer Liste vonINameProviding
-Objekten eine Map mit Name als Key- Parameters:
options
-- Returns:
-
-