Package eu.planets_project.tb.api.properties

Examples of eu.planets_project.tb.api.properties.ManuallyMeasuredProperty


        // Look up the definition:
        ManuallyMeasuredPropertyHandlerImpl mm = ManuallyMeasuredPropertyHandlerImpl.getInstance();
        UserBean user = (UserBean)JSFUtil.getManagedObject("UserBean");
        ManualMeasurementBackingBean mmbb = (ManualMeasurementBackingBean)JSFUtil.getManagedObject("ManualMeasurementBackingBean");
        List<ManuallyMeasuredProperty> mps = mm.loadAllManualProperties(user.getUserid());
        ManuallyMeasuredProperty mp = null;
        for( ManuallyMeasuredProperty amp : mps ) {
            if( amp.getURI().equals(mmbb.getNewManProp()) ) mp = amp;
        }
        if( mp == null ) {
            log.error("No property ["+mmbb.getNewManProp()+"] found!");
            return;
        }
        // Lookup the event:
        MeasurementEventImpl mev = this.getManualMeasurementEvent();
        // Make the property
        Property p = new Property.Builder( URI.create(mp.getURI()) ).description(mp.getDescription()).name(mp.getName()).build();
        DigitalObjectCompare.createMeasurement(mev, p, this.sessionId, this.newManVal );
        ExperimentInspector.persistExperiment();
    }
View Full Code Here


        }
        if( this.getAddManPropDesc() == null || this.getAddManPropDesc().trim().equals("") ) {
            log.error("Could not create new manual property: No description.");
            return;
        }
        ManuallyMeasuredProperty mp = ManuallyMeasuredPropertyHandlerImpl.createUserProperty(
                user.getUserid(), this.getAddManPropName(), this.getAddManPropDesc() );
        // And persist it:
        ManuallyMeasuredPropertyHandlerImpl mm = ManuallyMeasuredPropertyHandlerImpl.getInstance();
        mm.addManualUserProperty(user.getUserid(), mp );
        log.info("Created user property: "+mp+" for user: "+user.getUserid());
        this.newManProp = mp.getURI();
        // And clear the fields.
        this.setAddManPropName("");
        this.setAddManPropDesc("");
    }
View Full Code Here

        // Look up the definition:
        ManuallyMeasuredPropertyHandlerImpl mm = ManuallyMeasuredPropertyHandlerImpl.getInstance();
        UserBean user = (UserBean)JSFUtil.getManagedObject("UserBean");
        ManualMeasurementBackingBean mmbb = (ManualMeasurementBackingBean)JSFUtil.getManagedObject("ManualMeasurementBackingBean");
        List<ManuallyMeasuredProperty> mps = mm.loadAllManualProperties(user.getUserid());
        ManuallyMeasuredProperty mp = null;
        for( ManuallyMeasuredProperty amp : mps ) {
            if( amp.getURI().equals(mmbb.getNewManProp()) ) mp = amp;
        }
        if( mp == null ) {
            log.error("No property ["+mmbb.getNewManProp()+"] found!");
            return;
        }
        // Lookup the event:
        MeasurementEventImpl mev = this.getManualMeasurementEvent();
        // Make the property
        Property p = new Property.Builder( URI.create(mp.getURI()) ).description(mp.getDescription()).name(mp.getName()).build();
        DigitalObjectCompare.createMeasurement(mev, p, this.dobUri1, this.newManVal1 );
        DigitalObjectCompare.createMeasurement(mev, p, this.dobUri2, this.newManVal2 );
        ExperimentInspector.persistExperiment();
    }
View Full Code Here

   * @return
   */
  public static ManuallyMeasuredProperty createUserProperty(String userName, String pName, String pDescription){
      // FIXME This should escape problematic characters, like spaces.
    String uri = "planets://testbed/properties/"+userName+"/"+pName;
    ManuallyMeasuredProperty ret = new ManuallyMeasuredPropertyImpl(pName,pDescription,uri,true);
    return ret;
  }
View Full Code Here

   * @param userName
   * @param pName
   * @param pDescription
   */
  public void addManualUserProperty(String userName, String pName, String pDescription){
    ManuallyMeasuredProperty mp = createUserProperty(userName, pName, pDescription);
    this.addManualUserProperty(userName, mp);
  }
View Full Code Here

        //check if name or uri, when uri extract the proeprty's name from it
        if((name!=null)&&(userName!=null)){
          if(name.lastIndexOf("/")!=-1){
            name = name.substring(name.lastIndexOf("/")+1);
          }
          ManuallyMeasuredProperty p = ManuallyMeasuredPropertyHandlerImpl.createUserProperty(userName, name, null);
          this.removeManualUserProperty(userName, p);
        }
  }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.properties.ManuallyMeasuredProperty

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.