Skip to content
Snippets Groups Projects
Commit e7f20327 authored by cramakri's avatar cramakri
Browse files

LMS-1569 Code for interacting with the feature defs and feature values tables.

SVN: 16465
parent 714d8207
No related branches found
No related tags found
No related merge requests found
/*
* Copyright 2010 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.dss.etl.dataaccess;
import java.util.List;
import net.lemnik.eodsql.Select;
import net.lemnik.eodsql.TransactionQuery;
import ch.systemsx.cisd.bds.hcs.Location;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.ByteArrayMapper;
/**
* DAO for interacting with feature vector tables.
*
* @author Chandrasekhar Ramakrishnan
*/
public interface IFeatureVectorDAO extends TransactionQuery
{
public static final int FETCH_SIZE = 1000;
@Select("SELECT * from FEATURE_DEFS where PERM_ID = ?{1}")
public ImgImageDTO tryGetFeatureDef(long channelId, long datasetId, Location tileLocation,
Location wellLocation);
// Simple Getters
@Select("SELECT * from FEATURE_DEFS where DS_ID = ?{1}")
public List<ImgFeatureDefDTO> listFeatureDefsByDataSetId(long dataSetId);
@Select("SELECT * from FEATURE_VALUES where FD_ID = ?{1.id}")
public List<ImgFeatureValuesDTO> getFeatureValues(ImgFeatureDefDTO featureDev);
// Inserts
@Select("INSERT into FEATURE_DEFS (NAME, DESCRIPTION, DS_ID) values "
+ "(?{1.name}, ?{1.description}, ?{1.dataSetId}) RETURNING ID")
public long addFeatureDef(ImgFeatureDefDTO featureVectorDef);
@Select(value = "INSERT into FEATURE_VALUES (BYTEA, Z_in_M, T_in_SEC, FD_ID, DS_ID) values "
+ "(?{1.values}, ?{1.z}, ?{1.t}, ?{1.featureDefId}, ?{1.dataSetId}) RETURNING ID", parameterBindings =
{ ByteArrayMapper.class })
public long addFeatureValues(ImgFeatureValuesDTO featureVectorDef);
}
/*
* Copyright 2010 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.dss.etl.dataaccess;
import net.lemnik.eodsql.AutoGeneratedKeys;
import net.lemnik.eodsql.ResultColumn;
import ch.systemsx.cisd.common.utilities.AbstractHashable;
/**
* Corresponds to a row in the FEATURE_DEFS table.
*
* @author Chandrasekhar Ramakrishnan
*/
public class ImgFeatureDefDTO extends AbstractHashable
{
@AutoGeneratedKeys
private long id;
@ResultColumn("NAME")
private String name;
@ResultColumn("DESCRIPTION")
private String description;
@ResultColumn("DS_ID")
private long dataSetId;
@SuppressWarnings("unused")
private ImgFeatureDefDTO()
{
// All Data-Object classes must have a default constructor.
}
public ImgFeatureDefDTO(String name, String description, long dataSetId)
{
this.name = name;
this.description = description;
this.dataSetId = dataSetId;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public long getDataSetId()
{
return dataSetId;
}
public void setDataSetId(long dataSetId)
{
this.dataSetId = dataSetId;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
}
/*
* Copyright 2010 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.dss.etl.dataaccess;
import net.lemnik.eodsql.AutoGeneratedKeys;
import net.lemnik.eodsql.ResultColumn;
import ch.systemsx.cisd.common.utilities.AbstractHashable;
/**
* Corresponds to a row in the FEATURE_VALUES table.
*
* @author Chandrasekhar Ramakrishnan
*/
public class ImgFeatureValuesDTO extends AbstractHashable
{
@AutoGeneratedKeys
private long id;
@ResultColumn("Z_IN_M")
private Double z;
@ResultColumn("T_IN_SEC")
private Double t;
@ResultColumn("VALUES")
private byte[] values;
@ResultColumn("FD_ID")
private long featureDefId;
@ResultColumn("DS_ID")
private long dataSetId;
@SuppressWarnings("unused")
private ImgFeatureValuesDTO()
{
// All Data-Object classes must have a default constructor.
}
public ImgFeatureValuesDTO(Double zInM, Double tInSec, byte[] values, long featureDefId,
long dataSetId)
{
this.z = zInM;
this.t = tInSec;
this.values = values;
this.featureDefId = featureDefId;
this.dataSetId = dataSetId;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
/**
* Z in meters
*/
public Double getZ()
{
return z;
}
public void setZ(Double zInM)
{
this.z = zInM;
}
public byte[] getValues()
{
return values;
}
public void setValues(byte[] values)
{
this.values = values;
}
public long getFeatureDefId()
{
return featureDefId;
}
public void setFeatureDefId(Integer featureDefId)
{
this.featureDefId = featureDefId;
}
public long getDataSetId()
{
return dataSetId;
}
public void setDataSetId(long dataSetId)
{
this.dataSetId = dataSetId;
}
/**
* Time in seconds
*/
public Double getT()
{
return t;
}
public void setT(Double tInSec)
{
this.t = tInSec;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment