org.gcube.application.aquamaps.aquamapsportlet.servlet.db
Class DBManager

java.lang.Object
  extended by org.gcube.application.aquamaps.aquamapsportlet.servlet.db.DBManager
All Implemented Interfaces:
DBInterface

public class DBManager
extends Object
implements DBInterface


Field Summary
protected  String associatedScope
           
protected  DBSession session
           
 
Constructor Summary
protected DBManager(String scope)
           
 
Method Summary
 int addToAreaSelection(String user, List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> selection)
           
 int addToObjectBasket(List<String> speciesIds, String userName, String title)
           
 int addToUserBasket(List<String> speciesIds, String userName)
           
 int changeGis(String userName, List<String> titles)
           
 int clearBasket(String userName)
           
 int clearObjectBasket(String userName, String title)
           
 void clearPerturbation(String speciesId, String userName)
           
 int createObjectsBySelection(List<String> ids, String title, ClientObjectType type, float threshold, String bbox, String username)
           
static void deleteDb(String currentScope)
           
 int deleteFetched(String objId)
           
 int fetchGeneratedObjRelatedSpecies(int objId, List<String> speciesIds)
           
 int fetchSpecies()
           
 List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> getAreasByType(boolean includeFAO, boolean includeEEZ, boolean includeLME)
           
 List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> getAreaSelection(String user)
           
 String getAssociatedScope()
           
 long getBasketCount(String userName)
           
 String getFetchedJSONBasket(int objId, int start, int limit, String sortColumn, String sortDirection)
           
static Set<String> getInitializedScopes()
           
static DBInterface getInstance(String currentScopeString)
           
 String getJSONAreasByType(boolean includeFAO, boolean includeEEZ, boolean includeLME, org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.PagedRequestSettings settings)
           
 String getJSONAreaSelection(String user, org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.PagedRequestSettings settings)
           
 String getJSONObjectsByType(String userName, ClientObjectType type, int start, int limit, String sortColumn, String sortDirection)
           
 long getObjectBasketCount(String userName, String title)
           
 List<String> getObjectBasketIds(String userName, String title)
           
 long getObjectCount(String userName)
           
 long getObjectCountByType(String userName, ClientObjectType type)
           
 String getObjectJSONBasket(String userName, String title, int start, int limit, String sortColumn, String sortDirection)
           
 List<ClientObject> getObjects(String userName)
           
 String getPerturbation(String speciesId, String userName)
           
 String getPhylogenyJSON(String level)
           
 String getSpecies()
           
 List<String> getUserBasketIds(String userName)
           
 String getUserJSONBasket(String userName, int start, int limit, String sortColumn, String sortDirection)
           
 boolean isUpToDate()
           
 int removeFromAreaSelection(String user, List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> toRemove)
           
 int removeFromBasket(List<String> speciesIds, String userName)
           
 int removeFromObjectBasket(List<String> speciesIds, String userName, String title)
           
 int removeObjectByTitle(String userName, String title)
           
 int removeObjectByType(String userName, ClientObjectType type)
           
 int removeSession(String userName)
           
 void setLastUpdateTime(long lastUpdateTime)
           
 void setPerturbation(String speciesIds, String userName, String jsonString)
           
 int updateObject(String userName, String oldTitle, String title, ClientObjectType type, String bbox, float threshold, boolean gis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected DBSession session

associatedScope

protected String associatedScope
Constructor Detail

DBManager

protected DBManager(String scope)
             throws Exception
Throws:
Exception
Method Detail

getInitializedScopes

public static Set<String> getInitializedScopes()

deleteDb

public static void deleteDb(String currentScope)
                     throws Exception
Throws:
Exception

getInstance

public static DBInterface getInstance(String currentScopeString)
                               throws Exception
Throws:
Exception

isUpToDate

public boolean isUpToDate()
Specified by:
isUpToDate in interface DBInterface

setLastUpdateTime

public void setLastUpdateTime(long lastUpdateTime)

getAssociatedScope

public String getAssociatedScope()

fetchSpecies

public int fetchSpecies()
                 throws Exception
Specified by:
fetchSpecies in interface DBInterface
Throws:
Exception

getPhylogenyJSON

public String getPhylogenyJSON(String level)
                        throws Exception
Specified by:
getPhylogenyJSON in interface DBInterface
Throws:
Exception

getJSONAreasByType

public String getJSONAreasByType(boolean includeFAO,
                                 boolean includeEEZ,
                                 boolean includeLME,
                                 org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.PagedRequestSettings settings)
                          throws Exception
Specified by:
getJSONAreasByType in interface DBInterface
Throws:
Exception

getAreasByType

public List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> getAreasByType(boolean includeFAO,
                                                                                                         boolean includeEEZ,
                                                                                                         boolean includeLME)
                                                                                                  throws Exception
Specified by:
getAreasByType in interface DBInterface
Throws:
Exception

getUserJSONBasket

public String getUserJSONBasket(String userName,
                                int start,
                                int limit,
                                String sortColumn,
                                String sortDirection)
                         throws Exception
Specified by:
getUserJSONBasket in interface DBInterface
Throws:
Exception

removeFromBasket

public int removeFromBasket(List<String> speciesIds,
                            String userName)
                     throws Exception
Specified by:
removeFromBasket in interface DBInterface
Throws:
Exception

addToUserBasket

public int addToUserBasket(List<String> speciesIds,
                           String userName)
                    throws Exception
Specified by:
addToUserBasket in interface DBInterface
Throws:
Exception

addToObjectBasket

public int addToObjectBasket(List<String> speciesIds,
                             String userName,
                             String title)
                      throws Exception
Specified by:
addToObjectBasket in interface DBInterface
Throws:
Exception

removeFromObjectBasket

public int removeFromObjectBasket(List<String> speciesIds,
                                  String userName,
                                  String title)
                           throws Exception
Specified by:
removeFromObjectBasket in interface DBInterface
Throws:
Exception

getObjectJSONBasket

public String getObjectJSONBasket(String userName,
                                  String title,
                                  int start,
                                  int limit,
                                  String sortColumn,
                                  String sortDirection)
                           throws Exception
Specified by:
getObjectJSONBasket in interface DBInterface
Throws:
Exception

getObjectBasketIds

public List<String> getObjectBasketIds(String userName,
                                       String title)
                                throws Exception
Specified by:
getObjectBasketIds in interface DBInterface
Throws:
Exception

getUserBasketIds

public List<String> getUserBasketIds(String userName)
                              throws Exception
Specified by:
getUserBasketIds in interface DBInterface
Throws:
Exception

removeObjectByTitle

public int removeObjectByTitle(String userName,
                               String title)
                        throws Exception
Specified by:
removeObjectByTitle in interface DBInterface
Throws:
Exception

removeSession

public int removeSession(String userName)
                  throws Exception
Specified by:
removeSession in interface DBInterface
Throws:
Exception

updateObject

public int updateObject(String userName,
                        String oldTitle,
                        String title,
                        ClientObjectType type,
                        String bbox,
                        float threshold,
                        boolean gis)
                 throws Exception
Specified by:
updateObject in interface DBInterface
Throws:
Exception

getObjects

public List<ClientObject> getObjects(String userName)
                              throws Exception
Specified by:
getObjects in interface DBInterface
Throws:
Exception

clearBasket

public int clearBasket(String userName)
                throws Exception
Specified by:
clearBasket in interface DBInterface
Throws:
Exception

clearObjectBasket

public int clearObjectBasket(String userName,
                             String title)
                      throws Exception
Specified by:
clearObjectBasket in interface DBInterface
Throws:
Exception

getSpecies

public String getSpecies()
                  throws Exception
Specified by:
getSpecies in interface DBInterface
Throws:
Exception

fetchGeneratedObjRelatedSpecies

public int fetchGeneratedObjRelatedSpecies(int objId,
                                           List<String> speciesIds)
                                    throws Exception
Specified by:
fetchGeneratedObjRelatedSpecies in interface DBInterface
Throws:
Exception

getFetchedJSONBasket

public String getFetchedJSONBasket(int objId,
                                   int start,
                                   int limit,
                                   String sortColumn,
                                   String sortDirection)
                            throws Exception
Specified by:
getFetchedJSONBasket in interface DBInterface
Throws:
Exception

deleteFetched

public int deleteFetched(String objId)
                  throws Exception
Specified by:
deleteFetched in interface DBInterface
Throws:
Exception

getBasketCount

public long getBasketCount(String userName)
                    throws Exception
Specified by:
getBasketCount in interface DBInterface
Throws:
Exception

getObjectBasketCount

public long getObjectBasketCount(String userName,
                                 String title)
                          throws Exception
Specified by:
getObjectBasketCount in interface DBInterface
Throws:
Exception

getObjectCount

public long getObjectCount(String userName)
                    throws Exception
Specified by:
getObjectCount in interface DBInterface
Throws:
Exception

getObjectCountByType

public long getObjectCountByType(String userName,
                                 ClientObjectType type)
                          throws Exception
Specified by:
getObjectCountByType in interface DBInterface
Throws:
Exception

getJSONObjectsByType

public String getJSONObjectsByType(String userName,
                                   ClientObjectType type,
                                   int start,
                                   int limit,
                                   String sortColumn,
                                   String sortDirection)
                            throws Exception
Specified by:
getJSONObjectsByType in interface DBInterface
Throws:
Exception

getPerturbation

public String getPerturbation(String speciesId,
                              String userName)
                       throws Exception
Specified by:
getPerturbation in interface DBInterface
Throws:
Exception

setPerturbation

public void setPerturbation(String speciesIds,
                            String userName,
                            String jsonString)
                     throws Exception
Specified by:
setPerturbation in interface DBInterface
Throws:
Exception

removeObjectByType

public int removeObjectByType(String userName,
                              ClientObjectType type)
                       throws Exception
Specified by:
removeObjectByType in interface DBInterface
Throws:
Exception

changeGis

public int changeGis(String userName,
                     List<String> titles)
              throws Exception
Specified by:
changeGis in interface DBInterface
Throws:
Exception

addToAreaSelection

public int addToAreaSelection(String user,
                              List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> selection)
                       throws Exception
Specified by:
addToAreaSelection in interface DBInterface
Throws:
Exception

getJSONAreaSelection

public String getJSONAreaSelection(String user,
                                   org.gcube.application.aquamaps.aquamapsservice.stubs.fw.model.PagedRequestSettings settings)
                            throws Exception
Specified by:
getJSONAreaSelection in interface DBInterface
Throws:
Exception

getAreaSelection

public List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> getAreaSelection(String user)
                                                                                                    throws Exception
Specified by:
getAreaSelection in interface DBInterface
Throws:
Exception

removeFromAreaSelection

public int removeFromAreaSelection(String user,
                                   List<org.gcube.application.aquamaps.aquamapsservice.stubs.datamodel.enhanced.Area> toRemove)
                            throws Exception
Specified by:
removeFromAreaSelection in interface DBInterface
Throws:
Exception

createObjectsBySelection

public int createObjectsBySelection(List<String> ids,
                                    String title,
                                    ClientObjectType type,
                                    float threshold,
                                    String bbox,
                                    String username)
                             throws Exception
Specified by:
createObjectsBySelection in interface DBInterface
Throws:
Exception

clearPerturbation

public void clearPerturbation(String speciesId,
                              String userName)
                       throws Exception
Specified by:
clearPerturbation in interface DBInterface
Throws:
Exception


Copyright © 2014. All Rights Reserved.