Package de.unigoettingen.goobi.module.api.types

Examples of de.unigoettingen.goobi.module.api.types.GoobiProcessProperty


    * @throws GoobiException: 1, 2, 6, 7, 254, 1500, 1501, 1502
    * ================================================================*/
   public int add(String sessionId, String type, int count, HashMap pp) throws GoobiException {
      super.add(sessionId, type, count, pp);
      Prozess p = ModuleServerForm.getProcessFromShortSession(sessionId);
      GoobiProcessProperty gpp = new GoobiProcessProperty(pp);
      if (gpp.getName().startsWith("#"))
         throw new GoobiException(5, "Parameter not allowed");

      /* --------------------------------
       * Prozesseigenschaft
      * --------------------------------*/
      if (type.equals("") || type.equals(isProcess)) {
         if (p.getEigenschaften() == null)
            p.setEigenschaften(new HashSet<Prozesseigenschaft>());
         Prozesseigenschaft pe = new Prozesseigenschaft();
         pe.setProzess(p);
         pe.setTitel(gpp.getName());
         pe.setWert(gpp.getValue());
         p.getEigenschaften().add(pe);
      }

      /* --------------------------------
       * Werkstückeigenschaft
      * --------------------------------*/
      if (type.equals(isWorkpiece)) {
         /* wenn auf Werkstück zugegriffen werden soll, was nicht existiert, raus */
         if (p.getWerkstueckeSize() - 1 < count)
            throw new GoobiException(1500, "Workpiece does not exist");
         Werkstueck w = p.getWerkstueckeList().get(count);
         if (w.getEigenschaften() == null)
            w.setEigenschaften(new HashSet<Werkstueckeigenschaft>());
         Werkstueckeigenschaft we = new Werkstueckeigenschaft();
         we.setWerkstueck(w);
         we.setTitel(gpp.getName());
         we.setWert(gpp.getValue());
         w.getEigenschaften().add(we);
      }

      /* --------------------------------
       * Scanvorlageneigenschaft
      * --------------------------------*/
      if (type.equals(isTemplate)) {
         /* wenn auf Scanvorlage zugegriffen werden soll, die nicht existiert, raus */
         if (p.getVorlagenSize() - 1 < count)
            throw new GoobiException(1500, "Template does not exist");
         Vorlage v = p.getVorlagenList().get(count);
         if (v.getEigenschaften() == null)
            v.setEigenschaften(new HashSet<Vorlageeigenschaft>());
         Vorlageeigenschaft ve = new Vorlageeigenschaft();
         ve.setVorlage(v);
         ve.setTitel(gpp.getName());
         ve.setWert(gpp.getValue());
         v.getEigenschaften().add(ve);
      }

      try {
         new ProzessDAO().save(p);
View Full Code Here


      if (type.equals("") || type.equals(isProcess)) {
        //TODO: Use for loops
         for (Iterator<Prozesseigenschaft> it = p.getEigenschaftenList().iterator(); it.hasNext();) {
            Prozesseigenschaft pe = it.next();
            if (!pe.getTitel().startsWith("#"))
               gpps.add(new GoobiProcessProperty(pe.getTitel(), String.valueOf(pe.getId().intValue()), pe
                     .getWert()));
         }
      }

      /* --------------------------------
       * Werkstückeigenschaften
      * --------------------------------*/
      if (type.equals(isWorkpiece)) {
         /* wenn auf Werkstück zugegriffen werden soll, was nicht existiert, raus */
         if (p.getWerkstueckeSize() - 1 < count)
            throw new GoobiException(1500, "Workpiece does not exist");
         Werkstueck w = p.getWerkstueckeList().get(count);
         //TODO: Use for loops
         for (Iterator<Werkstueckeigenschaft> it = w.getEigenschaftenList().iterator(); it.hasNext();) {
            Werkstueckeigenschaft we = it.next();
            if (!we.getTitel().startsWith("#"))
               gpps.add(new GoobiProcessProperty(we.getTitel(), String.valueOf(we.getId().intValue()), we
                     .getWert()));
         }
      }

      /* --------------------------------
       * Scanvorlageneigenschaften
      * --------------------------------*/
      if (type.equals(isTemplate)) {
         /* wenn auf Scanvorlage zugegriffen werden soll, die nicht existiert, raus */
         if (p.getVorlagenSize() - 1 < count)
            throw new GoobiException(1500, "Template does not exist");
         Vorlage v = p.getVorlagenList().get(count);
         //TODO: Use for loops
         for (Iterator<Vorlageeigenschaft> it = v.getEigenschaftenList().iterator(); it.hasNext();) {
            Vorlageeigenschaft ve = it.next();
            if (!ve.getTitel().startsWith("#"))
               gpps.add(new GoobiProcessProperty(ve.getTitel(), String.valueOf(ve.getId().intValue()), ve
                     .getWert()));
         }
      }
      return gpps;
   }
View Full Code Here

    * @throws GoobiException: 1, 2, 6, 7, 254, 1501, 1502
    * ================================================================*/
   public int set(String sessionId, String type, int count, HashMap pp) throws GoobiException {
      super.set(sessionId, type, count, pp);
      Prozess p = ModuleServerForm.getProcessFromShortSession(sessionId);
      GoobiProcessProperty gpp = new GoobiProcessProperty(pp);
      if (gpp.getName().startsWith("#"))
         throw new GoobiException(5, "Parameter not allowed");
      /* --------------------------------
       * Prozesseigenschaft
      * --------------------------------*/
      String myquery = "from Prozesseigenschaft where prozess=" + p.getId().intValue();
      /* --------------------------------
       * Werkstückeigenschaft
      * --------------------------------*/
      if (type.equals(isWorkpiece)) {
         if (p.getWerkstueckeSize() - 1 < count)
            throw new GoobiException(1500, "Workpiece does not exist");
         Werkstueck w = p.getWerkstueckeList().get(count);
         myquery = "from Werkstueckeigenschaft where werkstueck=" + w.getId().intValue();

      }

      /* --------------------------------
       * Scanvorlageneigenschaft
      * --------------------------------*/
      if (type.equals(isTemplate)) {
         if (p.getVorlagenSize() - 1 < count)
            throw new GoobiException(1500, "Template does not exist");
         Vorlage v = p.getVorlagenList().get(count);
         myquery = "from Vorlageeigenschaft where vorlage=" + v.getId().intValue();
      }
      myquery += " and titel='" + gpp.getName() + "' and id=" + gpp.getId();

      try {
       //TODO: Use generics
         List hits = new ProzessDAO().search(myquery);
         if (hits.size() > 0) {
            if (type.equals("") || type.equals(isProcess)) {
               Prozesseigenschaft pe = (Prozesseigenschaft) hits.get(0);
               pe.setWert(gpp.getValue());
            }
            if (type.equals(isWorkpiece)) {
               Werkstueckeigenschaft we = (Werkstueckeigenschaft) hits.get(0);
               we.setWert(gpp.getValue());
            }
            if (type.equals(isTemplate)) {
               Vorlageeigenschaft ve = (Vorlageeigenschaft) hits.get(0);
               ve.setWert(gpp.getValue());
            }
            new ProzessDAO().save(p);
         } else {
            throw new GoobiException(1500, "Property " + gpp.getName() + " with id " + gpp.getId()
                  + " does not exist");
         }
      } catch (DAOException e) {
         throw new GoobiException(1400, "******** wrapped DAOException ********: " + e.getMessage() + "\n" + Helper.getStacktraceAsString(e));
      }
View Full Code Here

TOP

Related Classes of de.unigoettingen.goobi.module.api.types.GoobiProcessProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.