use of org.goobi.beans.Processproperty in project goobi-workflow by intranda.
the class StepBean method loadProcessProperties.
private void loadProcessProperties() {
containerAccess = new HashMap<>();
this.containers = new TreeMap<>();
this.processPropertyList = PropertyParser.getInstance().getPropertiesForStep(this.mySchritt);
for (ProcessProperty pt : this.processPropertyList) {
if (pt.getContainer() != 0 && pt.getCurrentStepAccessCondition() != AccessCondition.READ) {
containerAccess.put(pt.getContainer(), true);
}
if (pt.getProzesseigenschaft() == null) {
Processproperty pe = new Processproperty();
pe.setProzess(this.mySchritt.getProzess());
pt.setProzesseigenschaft(pe);
this.mySchritt.getProzess().getEigenschaften().add(pe);
pt.transfer();
}
if (!this.containers.keySet().contains(pt.getContainer())) {
PropertyListObject plo = new PropertyListObject(pt.getContainer());
plo.addToList(pt);
this.containers.put(pt.getContainer(), plo);
} else {
PropertyListObject plo = this.containers.get(pt.getContainer());
plo.addToList(pt);
this.containers.put(pt.getContainer(), plo);
}
}
}
use of org.goobi.beans.Processproperty in project goobi-workflow by intranda.
the class StepBean method saveProcessProperties.
public void saveProcessProperties() {
boolean valid = true;
for (IProperty p : this.processPropertyList) {
if (!p.isValid()) {
String value = Helper.getTranslation("propertyNotValid", p.getName());
Helper.setFehlerMeldung(value);
valid = false;
}
}
if (valid) {
for (ProcessProperty p : this.processPropertyList) {
if (p.getProzesseigenschaft() == null) {
Processproperty pe = new Processproperty();
pe.setProzess(this.mySchritt.getProzess());
p.setProzesseigenschaft(pe);
this.mySchritt.getProzess().getEigenschaften().add(pe);
}
p.transfer();
if (!this.mySchritt.getProzess().getEigenschaften().contains(p.getProzesseigenschaft())) {
this.mySchritt.getProzess().getEigenschaften().add(p.getProzesseigenschaft());
}
}
Process p = this.mySchritt.getProzess();
List<Processproperty> props = p.getEigenschaftenList();
for (Processproperty pe : props) {
if (pe.getTitel() == null) {
p.getEigenschaften().remove(pe);
}
}
// try {
PropertyManager.saveProcessProperty(processProperty.getProzesseigenschaft());
Helper.setMeldung("propertiesSaved");
// } catch (DAOException e) {
// mylog.error(e);
// Helper.setFehlerMeldung("propertiesNotSaved");
// }
}
}
use of org.goobi.beans.Processproperty in project goobi-workflow by intranda.
the class PropertyMysqlHelper method getProcessPropertiesForProcess.
public static List<Processproperty> getProcessPropertiesForProcess(int processId) throws SQLException {
String sql = "SELECT * FROM prozesseeigenschaften WHERE prozesseID = ? ORDER BY container, Titel";
Connection connection = null;
Object[] param = { processId };
try {
connection = MySQLHelper.getInstance().getConnection();
List<Processproperty> ret = new QueryRunner().query(connection, sql.toString(), resultSetToPropertyListHandler, param);
return ret;
} finally {
if (connection != null) {
MySQLHelper.closeConnection(connection);
}
}
}
use of org.goobi.beans.Processproperty in project goobi-workflow by intranda.
the class ProcessMysqlHelper method deleteProcess.
public static void deleteProcess(Process o) throws SQLException {
if (o.getId() != null) {
// delete metadata
MetadataManager.deleteMetadata(o.getId());
for (Processproperty object : o.getEigenschaften()) {
PropertyManager.deleteProcessProperty(object);
}
for (Template object : o.getVorlagen()) {
TemplateManager.deleteTemplate(object);
}
// delete masterpieces
for (Masterpiece object : o.getWerkstuecke()) {
MasterpieceManager.deleteMasterpiece(object);
}
for (Step object : o.getSchritte()) {
StepManager.deleteStep(object);
}
// delete process
String sql = "DELETE FROM prozesse WHERE ProzesseID = ?";
Object[] param = { o.getId() };
Connection connection = null;
try {
connection = MySQLHelper.getInstance().getConnection();
QueryRunner run = new QueryRunner();
run.update(connection, sql, param);
} finally {
if (connection != null) {
MySQLHelper.closeConnection(connection);
}
}
}
}
use of org.goobi.beans.Processproperty in project goobi-workflow by intranda.
the class ProzesskopieForm method TemplateAuswahlAuswerten.
/**
* Auswahl des Processes auswerten
*
* @throws DAOException
* @throws NamingException
* @throws SQLException ============================================================== ==
*/
public String TemplateAuswahlAuswerten() throws DAOException {
/* den ausgewählten Process laden */
if (auswahl == null || auswahl == 0) {
Helper.setFehlerMeldung("ErrorTemplateSelectionIsEmpty");
return "";
}
Process tempProcess = ProcessManager.getProcessById(this.auswahl);
if (tempProcess.getWerkstueckeSize() > 0) {
/* erstes Werkstück durchlaufen */
Masterpiece werk = tempProcess.getWerkstueckeList().get(0);
for (Masterpieceproperty eig : werk.getEigenschaften()) {
for (AdditionalField field : this.additionalFields) {
if (field.getTitel().equals(eig.getTitel())) {
field.setWert(eig.getWert());
}
if (eig.getTitel().equals("DocType")) {
docType = eig.getWert();
}
}
}
}
if (tempProcess.getVorlagenSize() > 0) {
/* erste Vorlage durchlaufen */
Template vor = tempProcess.getVorlagenList().get(0);
for (Templateproperty eig : vor.getEigenschaften()) {
for (AdditionalField field : this.additionalFields) {
if (field.getTitel().equals(eig.getTitel())) {
field.setWert(eig.getWert());
}
}
}
}
if (tempProcess.getEigenschaftenSize() > 0) {
for (Processproperty pe : tempProcess.getEigenschaften()) {
if (pe.getTitel().equals("digitalCollection")) {
digitalCollections.add(pe.getWert());
}
}
}
try {
this.myRdf = tempProcess.readMetadataAsTemplateFile();
} catch (Exception e) {
Helper.setFehlerMeldung("Error on reading template-metadata ", e);
}
/* falls ein erstes Kind vorhanden ist, sind die Collectionen dafür */
try {
DocStruct colStruct = this.myRdf.getDigitalDocument().getLogicalDocStruct();
removeCollections(colStruct);
colStruct = colStruct.getAllChildren().get(0);
removeCollections(colStruct);
} catch (PreferencesException e) {
Helper.setFehlerMeldung("Error on creating process", e);
log.error("Error on creating process", e);
} catch (RuntimeException e) {
/*
* das Firstchild unterhalb des Topstructs konnte nicht ermittelt werden
*/
}
return "";
}
Aggregations