Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some refactoring

prepared services to query DB with smart methods using generic params... YEAH :D
  • Loading branch information...
commit bb98ea3df2dc640e7d5ee0a5a9e55a00fc694865 1 parent b51e9fc
tomek authored
View
10 pom.xml
@@ -198,7 +198,15 @@
</execution>
</executions>
</plugin>
-
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.0-beta-1</version>
+ <configuration>
+ <port>8080</port>
+ <useTestClasspath>false</useTestClasspath>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
View
42 src/main/frontend/source/class/helenos/components/menu/ColumnFamilyContextMenu.js
@@ -11,8 +11,9 @@ Authors:
#asset(qx/icon/${qx.icontheme}/16/actions/edit-delete.png)
#asset(qx/icon/${qx.icontheme}/16/actions/edit-clear.png)
#asset(qx/icon/${qx.icontheme}/16/apps/office-spreadsheet.png)
+#asset(qx/icon/${qx.icontheme}/16/apps/utilities-keyring.png)
*/
-qx.Class.define("helenos.components.menu.ColumnFamilyContextMenu",
+qx.Class.define('helenos.components.menu.ColumnFamilyContextMenu',
{
extend : qx.ui.menu.Menu,
@@ -20,30 +21,27 @@ qx.Class.define("helenos.components.menu.ColumnFamilyContextMenu",
{
this.base(arguments);
- var propsButton = new qx.ui.menu.Button("Properties", "icon/16/status/dialog-information.png");
+ var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
propsButton.setUserData('KSNAME', ksName);
propsButton.setUserData('CFNAME', cfName);
- propsButton.addListener("execute", this.__showProperties);
+ propsButton.addListener('execute', this.__showProperties);
this.add(propsButton);
- var browserButton = new qx.ui.menu.Button("Browse", "icon/16/apps/office-spreadsheet.png");
- browserButton.setUserData('KSNAME', ksName);
- browserButton.setUserData('CFNAME', cfName);
- browserButton.addListener("execute", this.__showBrowserPane);
- this.add(browserButton);
+ var browserMenu = new qx.ui.menu.Button('Browse', null, null, this.__getBrowseSubMenu(ksName, cfName));
+ this.add(browserMenu);
this.add(new qx.ui.menu.Separator());
- var dropButton = new qx.ui.menu.Button("Drop", "icon/16/actions/edit-delete.png");
+ var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
dropButton.setUserData('KSNAME', ksName);
dropButton.setUserData('CFNAME', cfName);
- dropButton.addListener("execute", this.__dropColumnFamily);
+ dropButton.addListener('execute', this.__dropColumnFamily);
this.add(dropButton);
- var truncateButton = new qx.ui.menu.Button("Truncate", "icon/16/actions/edit-clear.png");
+ var truncateButton = new qx.ui.menu.Button('Truncate', 'icon/16/actions/edit-clear.png');
truncateButton.setUserData('KSNAME', ksName);
truncateButton.setUserData('CFNAME', cfName);
- truncateButton.addListener("execute", this.__truncateColumnFamily);
+ truncateButton.addListener('execute', this.__truncateColumnFamily);
this.add(truncateButton);
},
@@ -55,13 +53,31 @@ qx.Class.define("helenos.components.menu.ColumnFamilyContextMenu",
helenos.util.GuiObserver.showColumnFamilyInfoTab(ksName, cfName);
},
+ __getBrowseSubMenu : function(ksName, cfName) {
+ var menu = new qx.ui.menu.Menu();
+
+ var byKeyButton = new qx.ui.menu.Button('By key', 'icon/16/apps/utilities-keyring.png');
+ byKeyButton.setUserData('KSNAME', ksName);
+ byKeyButton.setUserData('CFNAME', cfName);
+ //byKeyButton.addListener('execute', this.__showBrowserPane);
+
+ var sliceButton = new qx.ui.menu.Button('Slice predicate', 'icon/16/apps/office-spreadsheet.png');
+ sliceButton.setUserData('KSNAME', ksName);
+ sliceButton.setUserData('CFNAME', cfName);
+ //sliceButton.addListener('execute', this.__showBrowserPane);
+
+ menu.add(byKeyButton);
+ menu.add(sliceButton);
+ return menu;
+ },
+
__truncateColumnFamily : function(e) {
var ksName = e.getTarget().getUserData('KSNAME');
var cfName = e.getTarget().getUserData('CFNAME');
dialog.Dialog.confirm(this.tr('loss.data.alert'), function(ret) {
if (ret == true) {
helenos.util.RpcActionsProvider.truncateColumnFamily(ksName, cfName);
- //helenos.util.GuiObserver.refreshSchemaTree();
+ //helenos.util.GuiObserver.refreshSchemaTree();
}
}, this);
},
View
76 src/main/frontend/source/class/helenos/components/menu/KeyspaceContextMenu.js
@@ -11,7 +11,7 @@ Authors:
#asset(qx/icon/${qx.icontheme}/16/actions/list-add.png)
#asset(qx/icon/${qx.icontheme}/16/actions/edit-delete.png)
*/
-qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
+qx.Class.define('helenos.components.menu.KeyspaceContextMenu',
{
extend : qx.ui.menu.Menu,
@@ -19,21 +19,21 @@ qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
{
this.base(arguments);
- var propsButton = new qx.ui.menu.Button("Properties", "icon/16/status/dialog-information.png");
+ var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
propsButton.setUserData('KSNAME', ksName);
- propsButton.addListener("execute", this.__showProperties);
+ propsButton.addListener('execute', this.__showProperties);
this.add(propsButton);
this.add(new qx.ui.menu.Separator());
- var addCFButton = new qx.ui.menu.Button("Add column family", "icon/16/actions/list-add.png");
+ var addCFButton = new qx.ui.menu.Button('Add column family', 'icon/16/actions/list-add.png');
addCFButton.setUserData('KSNAME', ksName);
- addCFButton.addListener("execute", this.__addColumnFamily);
+ addCFButton.addListener('execute', this.__addColumnFamily);
this.add(addCFButton);
- var dropButton = new qx.ui.menu.Button("Drop", "icon/16/actions/edit-delete.png");
+ var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
dropButton.setUserData('KSNAME', ksName);
- dropButton.addListener("execute", this.__dropKeyspace);
+ dropButton.addListener('execute', this.__dropKeyspace);
this.add(dropButton);
},
@@ -57,71 +57,71 @@ qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
var ksName = e.getTarget().getUserData('KSNAME');
var formData = {
'name' : {
- 'type' : "TextField",
- 'label' : "Name",
- 'value' : "",
- "validation" : {
- "required" : true
+ 'type' : 'TextField',
+ 'label' : 'Name',
+ 'value' : '',
+ 'validation' : {
+ 'required' : true
}
},
'columnType' : {
- 'type' : "SelectBox",
- 'label' : "Column",
+ 'type' : 'SelectBox',
+ 'label' : 'Column',
'value' : 1,
'options' : helenos.util.CassandraTypes.columnTypes,
- "validation" : {
- "required" : true
+ 'validation' : {
+ 'required' : true
}
},
'comparatorType' : {
- 'type' : "SelectBox",
- 'label' : "Comparator",
+ 'type' : 'SelectBox',
+ 'label' : 'Comparator',
'value' : 1,
'options' : helenos.util.CassandraTypes.comparatorTypes,
- "validation" : {
- "required" : true
+ 'validation' : {
+ 'required' : true
}
},
'subComparatorType' : {
- 'type' : "SelectBox",
- 'label' : "Subcomparator",
+ 'type' : 'SelectBox',
+ 'label' : 'Subcomparator',
'value' : 1,
'options' : helenos.util.CassandraTypes.comparatorTypes
}
,
'keyValidationclass' : {
- 'type' : "SelectBox",
- 'label' : "Key validation class",
+ 'type' : 'SelectBox',
+ 'label' : 'Key validation class',
'value' : 5,
'options' : helenos.util.CassandraTypes.validationClasses,
- "validation" : {
- "required" : true
+ 'validation' : {
+ 'required' : true
}
},
'defaultValidationclass' : {
- 'type' : "SelectBox",
- 'label' : "Default validation class",
+ 'type' : 'SelectBox',
+ 'label' : 'Default validation class',
'value' : 4,
'options' : helenos.util.CassandraTypes.validationClasses,
- "validation" : {
- "required" : true
+ 'validation' : {
+ 'required' : true
}
},
'gcGraceSeconds' : {
- 'type' : "TextField",
- 'label' : "GC grace seconds",
+ 'type' : 'TextField',
+ 'label' : 'GC grace seconds',
'value' : '86400',
- "validation" : {
- "required" : true
- //,"validator" : qx.util.Validate.number()
+ 'validation' : {
+ 'required' : true
+ //,'validator' : qx.util.Validate.number()
}
},
'comment' :
{
- 'type' : "TextArea",
- 'label' : "Comment",
+ 'type' : 'TextArea',
+ 'label' : 'Comment',
'lines' : 4,
- 'value' : ""
+ 'value' : ''
}
};
dialog.Dialog.form('<h4>Create new column family</h4>', formData, function(result) {
View
31 src/main/frontend/source/class/helenos/components/tab/BrowserPage.js
@@ -6,7 +6,9 @@ License:
Authors:
Tomek Kuprowski (tomekkuprowski at gmail dot com)
************************************************************************ */
-
+/*
+#asset(qx/icon/${qx.icontheme}/16/actions/system-search.png)
+*/
qx.Class.define("helenos.components.tab.BrowserPage",
{
extend : helenos.components.tab.AbstractCloseablePage,
@@ -20,10 +22,35 @@ qx.Class.define("helenos.components.tab.BrowserPage",
label: (ksName + ' : ' + cfName)
});
+ var cfDef = helenos.util.RpcActionsProvider.describeColumnFamily(ksName, cfName);
+
+ this.__addFilterPane(cfDef);
},
members :
{
-
+ __keyStart : null,
+ __keyEnd : null,
+
+ __performSearch : function(e) {
+
+ },
+
+ __addFilterPane : function(cfDef) {
+ this.__keyStart = new qx.ui.form.TextField();
+ this.__keyEnd = new qx.ui.form.TextField();
+ var searchButton = new qx.ui.form.Button('Search', 'icon/16/actions/system-search.png');
+ searchButton.addListener("execute", this.__performSearch, this);
+
+ var filterGB = new qx.ui.groupbox.GroupBox('Filter');
+ filterGB.setLayout(new qx.ui.layout.HBox(8));
+
+ this.add(filterGB);
+ filterGB.add(new qx.ui.basic.Label('Key:'));
+ filterGB.add(this.__keyStart);
+ filterGB.add(new qx.ui.basic.Label(' to '));
+ filterGB.add(this.__keyEnd);
+ filterGB.add(searchButton);
+ }
}
});
View
6 .../com/kuprowski/helenos/service/QueryProvider.java → ...rowski/helenos/service/StandardQueryProvider.java
@@ -16,8 +16,8 @@
* @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
* *******************************************************
*/
-public interface QueryProvider {
+public interface StandardQueryProvider {
+
+ <K, N> String singleColumn(@JsonRpcParam("keyClass") Class<K> keyClass, @JsonRpcParam("valueClass") Class<N> valueClass, @JsonRpcParam("columnFamily") String keyspaceName, @JsonRpcParam("columnFamily") String columnFamily, @JsonRpcParam("key") K key, @JsonRpcParam("name") N name);
- String get(@JsonRpcParam("cf") String columnFamily,@JsonRpcParam("uuidKey") UUID key,@JsonRpcParam("column") String column);
- String get(@JsonRpcParam("cf") String columnFamily,@JsonRpcParam("stringKey") String key,@JsonRpcParam("column") String column);
}
View
22 src/main/java/com/kuprowski/helenos/service/SuperQueryProvider.java
@@ -0,0 +1,22 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.kuprowski.helenos.service;
+
+import com.googlecode.jsonrpc4j.JsonRpcParam;
+import java.util.UUID;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public interface SuperQueryProvider {
+
+ <K,SN, N> String singleColumn(@JsonRpcParam("keyClass") Class<K> keyClass, @JsonRpcParam("sNameClass") Class<SN> sNameClass, @JsonRpcParam("nameClass") Class<N> nameClass, @JsonRpcParam("keyspaceName") String keyspaceName, @JsonRpcParam("columnFamily") String columnFamily, @JsonRpcParam("key") K key, @JsonRpcParam("superColumn") SN supercolumn, @JsonRpcParam("column") N column);
+}
View
23 src/main/java/com/kuprowski/helenos/service/impl/AbstractProvider.java
@@ -4,8 +4,13 @@
*/
package com.kuprowski.helenos.service.impl;
+import me.prettyprint.cassandra.serializers.ObjectSerializer;
+import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
import me.prettyprint.hector.api.Cluster;
import me.prettyprint.hector.api.ConsistencyLevelPolicy;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.Serializer;
+import me.prettyprint.hector.api.factory.HFactory;
import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
@@ -20,16 +25,26 @@
* *******************************************************
*/
public abstract class AbstractProvider {
-
+
@Autowired
protected Mapper mapper;
-
@Autowired
protected Cluster cluster;
-
@Autowired
protected ConsistencyLevelPolicy consistencyLevelPolicy;
-
+
+ protected <V> Serializer<V> getSerializer(Class<V> clazz) {
+ Serializer<V> serializer = SerializerTypeInferer.getSerializer(clazz);
+ if (serializer.getClass().equals(ObjectSerializer.class)) {
+ throw new IllegalStateException("can not obtain correct serializer for class: " + clazz);
+ }
+ return serializer;
+ }
+
+ protected Keyspace getKeyspace(String keyspaceName) {
+ return HFactory.createKeyspace(keyspaceName, cluster, consistencyLevelPolicy);
+ }
+
@Required
public void setMapper(Mapper mapper) {
this.mapper = mapper;
View
43 src/main/java/com/kuprowski/helenos/service/impl/QueryProviderImpl.java
@@ -1,43 +0,0 @@
-package com.kuprowski.helenos.service.impl;
-
-import com.kuprowski.helenos.service.QueryProvider;
-import java.util.UUID;
-import org.springframework.stereotype.Component;
-
-/**
- * query example:
- {
- "id": 1,
- "jsonrpc": "2.0",
- "method": "get",
- "params": {
- "cf": "none",
- "uuidKey": "550e8400-e29b-41d4-a716-446655440000",
- "column": "none"
- }
- }
- */
-/**
- * ********************************************************
- * Copyright: 2012 Tomek Kuprowski
- *
- * License: GPLv2: http://www.gnu.org/licences/gpl.html
- *
- * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
- * *******************************************************
- */
-@Component("queryProvider")
-public class QueryProviderImpl extends AbstractProvider implements QueryProvider {
-
- @Override
- public String get(String columnFamily, UUID key, String column) {
- return "UUID xxx";
- }
-
- @Override
- public String get(String columnFamily, String key, String column) {
- return "String xxx";
- }
-
-
-}
View
39 src/main/java/com/kuprowski/helenos/service/impl/StandardQueryProviderImpl.java
@@ -0,0 +1,39 @@
+package com.kuprowski.helenos.service.impl;
+
+import com.kuprowski.helenos.service.StandardQueryProvider;
+import java.util.UUID;
+import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate;
+import me.prettyprint.cassandra.service.template.ThriftColumnFamilyTemplate;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.Serializer;
+import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.factory.HFactory;
+import me.prettyprint.hector.api.query.ColumnQuery;
+import me.prettyprint.hector.api.query.SubColumnQuery;
+import org.springframework.stereotype.Component;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+@Component("standardQueryProvider")
+public class StandardQueryProviderImpl extends AbstractProvider implements StandardQueryProvider {
+
+ @Override
+ public <K,N> String singleColumn(Class<K> keyClass, Class<N> nameClass, String keyspaceName, String columnFamily, K key, N name) {
+ ColumnQuery<K,N,String> query = HFactory.createColumnQuery(getKeyspace(keyspaceName), getSerializer(keyClass), getSerializer(nameClass), StringSerializer.get());
+ query.setColumnFamily(columnFamily);
+ query.setKey(key);
+ query.setName(name);
+
+ HColumn<N, String> column = query.execute().get();
+ return column != null ? column.getValue() : null;
+ }
+}
View
42 src/main/java/com/kuprowski/helenos/service/impl/SuperQueryProviderImpl.java
@@ -0,0 +1,42 @@
+package com.kuprowski.helenos.service.impl;
+
+import com.kuprowski.helenos.service.StandardQueryProvider;
+import com.kuprowski.helenos.service.SuperQueryProvider;
+import java.util.UUID;
+import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate;
+import me.prettyprint.cassandra.service.template.ThriftColumnFamilyTemplate;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.Serializer;
+import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.factory.HFactory;
+import me.prettyprint.hector.api.query.ColumnQuery;
+import me.prettyprint.hector.api.query.SubColumnQuery;
+import org.springframework.stereotype.Component;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+@Component("superQueryProvider")
+public class SuperQueryProviderImpl extends AbstractProvider implements SuperQueryProvider {
+
+ @Override
+ public <K,SN, N> String singleColumn(Class<K> keyClass, Class<SN> sNameClass, Class<N> nameClass, String keyspaceName, String columnFamily, K key, SN supercolumn, N column) {
+ SubColumnQuery<K,SN,N,String> query = HFactory.createSubColumnQuery(getKeyspace(keyspaceName), getSerializer(keyClass), getSerializer(sNameClass), getSerializer(nameClass), StringSerializer.get());
+ query.setColumnFamily(columnFamily);
+ query.setKey(key);
+ query.setSuperColumn(supercolumn);
+ query.setColumn(column);
+
+ HColumn<N, String> column2 = query.execute().get();
+ return column2 != null ? column2.getValue() : null;
+ }
+
+}
View
11 src/main/webapp/WEB-INF/helenos-servlet.xml
@@ -11,8 +11,13 @@
<property name="serviceInterface" value="com.kuprowski.helenos.service.SchemaProvider"/>
</bean>
- <bean name="/Query.json" class="com.googlecode.jsonrpc4j.spring.JsonServiceExporter">
- <property name="service" ref="queryProvider"/>
- <property name="serviceInterface" value="com.kuprowski.helenos.service.QueryProvider"/>
+ <bean name="/query/Standard.json" class="com.googlecode.jsonrpc4j.spring.JsonServiceExporter">
+ <property name="service" ref="standardQueryProvider"/>
+ <property name="serviceInterface" value="com.kuprowski.helenos.service.StandardQueryProvider"/>
+ </bean>
+
+ <bean name="/query/Super.json" class="com.googlecode.jsonrpc4j.spring.JsonServiceExporter">
+ <property name="service" ref="superQueryProvider"/>
+ <property name="serviceInterface" value="com.kuprowski.helenos.service.SuperQueryProvider"/>
</bean>
</beans>
View
2  src/main/webapp/WEB-INF/helenos.properties
@@ -1,2 +1,2 @@
-host=developer-master
+host=dev-host1
cluster.name=LookmindersCluster
View
4 src/main/webapp/WEB-INF/web.xml
@@ -23,6 +23,10 @@
<param-name>log4jRefreshInterval</param-name>
<param-value>360000</param-value>
</context-param>
+ <context-param>
+ <param-name>useFileMappedBuffer</param-name>
+ <param-value>false</param-value>
+ </context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
View
77 todo.txt
@@ -0,0 +1,77 @@
+Single column :
+
+zaleznie od tego czy CF jest standard czy super wola on query typu ColumnQuery lub SubColumnQuery jak rowniez CounterQuery i SubColumnQuery
+jesli typem danych jest Counter
+
+Slice predicate:
+wola SliceQuery i jego odpowiedniki zgodnie z powyzszym
+
+
+
+
+
+MultigetSliceCounterQuery<UUID, Character> query = HFactory.createMultigetSliceCounterQuery(getKeyspace(), UUIDSerializer.get(), CharSerializer.get());
+ query = query.setColumnFamily(PHOTO_COUNTERS_CF_NAME).setColumnNames(LikeType.ALL_COLUMN_NAMES);
+ query = query.setKeys(photosIds);
+ QueryResult<CounterRows<UUID, Character>> ret = query.execute();
+
+
+----------------------------------------------------------------------------------------------------------------
+
+SliceQuery<UUID, Long, Comment> query = createSliceQuery(UUIDSerializer.get(), LongSerializer.get(), CommentSerializer.get(), COMMENTS_CF_NAME, photoId);
+ query.setRange(fromTime - ONE, 0l, true, limit);
+
+ QueryResult<ColumnSlice<Long, Comment>> result = query.execute();
+
+----------------------------------------------------------------------------------------------------------------
+
+SliceCounterQuery<String, Character> query = HFactory.createCounterSliceQuery(getKeyspace(), stringSerializer, CharSerializer.get());
+ query = query.setKey(user.getUsername()).setColumnNames(LikeType.USER_COLUMN_NAMES).setColumnFamily(USER_COUNTERS_CF_NAME);
+
+----------------------------------------------------------------------------------------------------------------
+
+SubSliceQuery<UUID, Character, UUID, PhotoDevotee> query = HFactory.createSubSliceQuery(getKeyspace(), UUIDSerializer.get(), CharSerializer.get(), UUIDSerializer.get(), PhotoDevoteeSerializer.get());
+
+ query.setColumnFamily(LISTS_PHOTOS_DEVOTEES_CF_NAME);
+ query.setSuperColumn(likeType.getCode());
+ query.setKey(photoId);
+ query.setRange(UUIDHelper.getNextTimeUUID(from), null, true, maxResults);
+
+ QueryResult<ColumnSlice<UUID, PhotoDevotee>> result = query.execute();
+
+----------------------------------------------------------------------------------------------------------------
+
+IndexedSlicesQuery<String, String, byte[]> query = HFactory.createIndexedSlicesQuery(getKeyspace(), StringSerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
+
+ query.addEqualsExpression("email", email.getBytes());
+ query.setColumnFamily(USERS_CF_NAME);
+ query.setStartKey("");
+ query.setRowCount(1);
+ query.setColumnNames("email", "userdata"); // nie zwracam specjalnie lastPhoto
+ QueryResult<OrderedRows<String, String, byte[]>> result = query.execute();
+
+
+----------------------------------------------------------------------------------------------------------------
+
+ColumnQuery<K, N, V> query = this.createColumnQuery(keySerializer, nameSerializer, valueSerializer);
+ query.setColumnFamily(family);
+ query.setKey(key);
+ query.setName(name);
+
+ QueryResult<HColumn<N, V>> result = query.execute();
+
+ return result.get() != null ? result.get().getValue() : null;
+
+----------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.