bug fixing init app for handler ID
This commit is contained in:
parent
d03d1a1477
commit
9dd99c5d73
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -52,7 +56,11 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -105,7 +113,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -158,7 +170,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -211,7 +227,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -219,7 +239,11 @@
|
|||
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -272,7 +296,11 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -325,7 +353,11 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -378,7 +410,11 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import java.util.TreeMap;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
|
@ -26,7 +28,7 @@ public class GeoPortalClientCaches {
|
|||
|
||||
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
|
||||
|
||||
private Map<String, List<ConfigurationDV<?>>> mapHandlersConfigurationsForProfileId;
|
||||
//private Map<String, List<HandlerDeclarationDV>> mapHandlersConfigurationsForProfileId;
|
||||
|
||||
private Map<String, UseCaseDescriptorDV> mapUseCaseDescriptor;
|
||||
|
||||
|
@ -39,22 +41,11 @@ public class GeoPortalClientCaches {
|
|||
*/
|
||||
public GeoPortalClientCaches() {
|
||||
mapGcubeProfilePerItemType = new TreeMap<String, List<GeoNaFormCardModel>>();
|
||||
mapHandlersConfigurationsForProfileId = new HashMap<String, List<ConfigurationDV<?>>>();
|
||||
mapSearchingFilterParametersForProfileId = new HashMap<String, GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig>();
|
||||
mapUseCaseDescriptor = new HashMap<String, UseCaseDescriptorDV>();
|
||||
mapRelationsNamesForProfileId = new HashMap<String, List<RelationshipDefinitionDV>>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Put handler configurations for profile id.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @param lsitConfigurations the lsit configurations
|
||||
*/
|
||||
public void putHandlerConfigurationsForProfileId(String profileId, List<ConfigurationDV<?>> lsitConfigurations) {
|
||||
mapHandlersConfigurationsForProfileId.put(profileId, lsitConfigurations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put list relationships definition for profile ID.
|
||||
*
|
||||
|
@ -96,16 +87,6 @@ public class GeoPortalClientCaches {
|
|||
return mapUseCaseDescriptor.get(profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the handler configurations for profile id.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @return the handler configurations for profile id
|
||||
*/
|
||||
public List<ConfigurationDV<?>> getHandlerConfigurationsForProfileId(String profileId) {
|
||||
return mapHandlersConfigurationsForProfileId.get(profileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put gcube profile per item type.
|
||||
*
|
||||
|
@ -132,7 +113,8 @@ public class GeoPortalClientCaches {
|
|||
* @param profileID the profile ID
|
||||
* @return the filter parameters for profile id
|
||||
*/
|
||||
public CacheSearchingFilterParametersFromConfig getFilterParametersForProfileId(String profileID) {
|
||||
public CacheSearchingFilterParametersFromConfig getFilterParametersForProfileId(String profileID,
|
||||
GEOPORTAL_DATA_HANDLER handlerType) {
|
||||
GWT.log("getFilterParametersForProfileId for: " + profileID);
|
||||
|
||||
CacheSearchingFilterParametersFromConfig searchingFilterParameters = mapSearchingFilterParametersForProfileId
|
||||
|
@ -141,57 +123,63 @@ public class GeoPortalClientCaches {
|
|||
if (searchingFilterParameters == null) {
|
||||
|
||||
searchingFilterParameters = new CacheSearchingFilterParametersFromConfig();
|
||||
UseCaseDescriptorDV ucd = mapUseCaseDescriptor.get(profileID);
|
||||
|
||||
for (HandlerDeclarationDV handler : ucd.getHandlers()) {
|
||||
|
||||
List<ConfigurationDV<?>> config = mapHandlersConfigurationsForProfileId.get(profileID);
|
||||
if (handler.getDataHandlerType().equals(handlerType)) {
|
||||
ConfigurationDV<?> configurationDV = handler.getConfiguration();
|
||||
GWT.log("For profileID " + profileID + " and handler type " + handlerType + ", read config for : "
|
||||
+ configurationDV);
|
||||
|
||||
GWT.log("For profileID " + profileID + ", read config for : " + config);
|
||||
switch (configurationDV.getConfigurationType()) {
|
||||
case item_fields: {
|
||||
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
|
||||
for (ItemFieldDV itemField : listItemFields) {
|
||||
if (itemField.isDisplayAsResult()) {
|
||||
searchingFilterParameters.addDisplayField(itemField);
|
||||
// adding to projection for filtering
|
||||
for (String jsonFieldPath : itemField.getJsonFields()) {
|
||||
// String mongoProjection = itemField.getProjection() + "." + jsonField;
|
||||
searchingFilterParameters.putMongoProjection(jsonFieldPath, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (ConfigurationDV<?> configurationDV : config) {
|
||||
switch (configurationDV.getConfigurationType()) {
|
||||
case item_fields: {
|
||||
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
|
||||
for (ItemFieldDV itemField : listItemFields) {
|
||||
if (itemField.isDisplayAsResult()) {
|
||||
searchingFilterParameters.addDisplayField(itemField);
|
||||
// adding to projection for filtering
|
||||
for (String jsonFieldPath : itemField.getJsonFields()) {
|
||||
// String mongoProjection = itemField.getProjection() + "." + jsonField;
|
||||
searchingFilterParameters.putMongoProjection(jsonFieldPath, 1);
|
||||
if (itemField.isSearchable()) {
|
||||
searchingFilterParameters.addSearchByField(itemField);
|
||||
}
|
||||
|
||||
if (itemField.isSortable()) {
|
||||
searchingFilterParameters.addOrderByField(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemField.isSearchable()) {
|
||||
searchingFilterParameters.addSearchByField(itemField);
|
||||
}
|
||||
|
||||
if (itemField.isSortable()) {
|
||||
searchingFilterParameters.addOrderByField(itemField);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case gcube_profiles:
|
||||
break;
|
||||
mapSearchingFilterParametersForProfileId.put(profileID, searchingFilterParameters);
|
||||
}
|
||||
}
|
||||
|
||||
mapSearchingFilterParametersForProfileId.put(profileID, searchingFilterParameters);
|
||||
}
|
||||
|
||||
return searchingFilterParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the cache handler configurations.
|
||||
*/
|
||||
// DEBUGGING
|
||||
public void printCacheHandlerConfigurations() {
|
||||
GWT.log("print - mapHandlersConfigurationsForProfileId is:");
|
||||
for (String key : mapHandlersConfigurationsForProfileId.keySet()) {
|
||||
GWT.log("print - key: " + key + ", value: " + mapHandlersConfigurationsForProfileId.get(key));
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * Prints the cache handler configurations.
|
||||
// */
|
||||
// // DEBUGGING
|
||||
// public void printCacheHandlerConfigurations() {
|
||||
// GWT.log("print - mapHandlersConfigurationsForProfileId is:");
|
||||
// for (String key : mapHandlersConfigurationsForProfileId.keySet()) {
|
||||
// GWT.log("print - key: " + key + ", value: " + mapHandlersConfigurationsForProfileId.get(key));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Prints the cache gcube profile per item type.
|
||||
|
|
|
@ -13,13 +13,13 @@ import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
|||
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights.OPERATION_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
|
@ -317,6 +317,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert);
|
||||
Window.alert(errorMsg);
|
||||
GWT.log(caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -352,23 +353,23 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
for (final UseCaseDescriptorDV ucdDV : listUCDescriptors) {
|
||||
|
||||
List<ConfigurationDV<?>> listConfigurations = geoportalCaches
|
||||
.getHandlerConfigurationsForProfileId(ucdDV.getProfileID());
|
||||
|
||||
if (listConfigurations == null) {
|
||||
listConfigurations = new ArrayList<ConfigurationDV<?>>();
|
||||
}
|
||||
|
||||
for (HandlerDeclarationDV handler : ucdDV.getHandlers()) {
|
||||
ConfigurationDV<?> config = handler.getConfiguration();
|
||||
listConfigurations.add(config);
|
||||
}
|
||||
|
||||
geoportalCaches.putHandlerConfigurationsForProfileId(ucdDV.getProfileID(), listConfigurations);
|
||||
// List<ConfigurationDV<?>> listConfigurations = geoportalCaches
|
||||
// .getHandlerConfigurationsForProfileId(ucdDV.getProfileID());
|
||||
//
|
||||
// if (listConfigurations == null) {
|
||||
// listConfigurations = new ArrayList<ConfigurationDV<?>>();
|
||||
// }
|
||||
//
|
||||
// for (HandlerDeclarationDV handler : ucdDV.getHandlers()) {
|
||||
// ConfigurationDV<?> config = handler.getConfiguration();
|
||||
// listConfigurations.add(config);
|
||||
// }
|
||||
//
|
||||
// geoportalCaches.putHandlerConfigurationsForProfileId(ucdDV.getProfileID(), listConfigurations);
|
||||
geoportalCaches.putUCDForProfileId(ucdDV.getProfileID(), ucdDV);
|
||||
}
|
||||
|
||||
geoportalCaches.printCacheHandlerConfigurations();
|
||||
//geoportalCaches.printCacheHandlerConfigurations();
|
||||
|
||||
}
|
||||
|
||||
|
@ -784,9 +785,13 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||
GWT.log("Fired: " + getListOfRecordsEvent);
|
||||
SearchingFilter searchingFilter = getListOfRecordsEvent.getSearchingFilter();
|
||||
|
||||
|
||||
CacheSearchingFilterParametersFromConfig seachingFilterParameters =
|
||||
geoportalCaches.getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID(), GEOPORTAL_DATA_HANDLER.geoportal_data_list);
|
||||
|
||||
CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
|
||||
.getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
|
||||
// CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
|
||||
// .getFilterParametersForProfileId(getListOfRecordsEvent.getProfileID());
|
||||
|
||||
String profileID = getListOfRecordsEvent.getProfileID();
|
||||
if (profileID == null) {
|
||||
|
|
|
@ -925,31 +925,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
listUCDDV.add(ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null));
|
||||
}
|
||||
|
||||
// MOCK
|
||||
/*
|
||||
* List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>();
|
||||
* UseCaseDescriptorDV usecaseDescriptorDV = new UseCaseDescriptorDV("theId",
|
||||
* "version", "listConcessioni", null); List<HandlerDeclarationDV> handlers =
|
||||
* new ArrayList<HandlerDeclarationDV>();
|
||||
*
|
||||
* List<GcubeProfileDV> gcubeProfiles = new ArrayList<GcubeProfileDV>();
|
||||
* GcubeProfileDV profile = new GcubeProfileDV();
|
||||
* profile.setGcubeName("GcubeName");
|
||||
* profile.setGcubeSecondaryType("GcubeSecondaryType");
|
||||
* gcubeProfiles.add(profile);
|
||||
*
|
||||
* ConfigurationDV<List<GcubeProfileDV>> configuration = new
|
||||
* ConfigurationDV<List<GcubeProfileDV>>(gcubeProfiles); HandlerDeclarationDV
|
||||
* handler = new
|
||||
* HandlerDeclarationDV(GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId(),
|
||||
* GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getType(), "Concessioni",
|
||||
* configuration, GEOPORTAL_DATA_HANDLER.geoportal_data_entry);
|
||||
*
|
||||
* handlers.add(handler); usecaseDescriptorDV.setHandlers(handlers);
|
||||
* listUCDDV.add(usecaseDescriptorDV);
|
||||
*/
|
||||
|
||||
LOG.info("for handlersIds {} returning {} " + UseCaseDescriptor.class.getSimpleName(), handlersIds,
|
||||
LOG.info("for handlersIds {} returning {} " + UseCaseDescriptorDV.class.getSimpleName(), handlersIds,
|
||||
listUCDDV.size());
|
||||
return listUCDDV;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -94,7 +94,7 @@ public class Complex_Tests {
|
|||
|
||||
}
|
||||
|
||||
@Before
|
||||
//@Before
|
||||
public void init() {
|
||||
ScopeProvider.instance.set(CONTEXT);
|
||||
SecurityTokenProvider.instance.set(TOKEN);
|
||||
|
@ -102,7 +102,7 @@ public class Complex_Tests {
|
|||
clientUCD = GeoportalClientCaller.useCaseDescriptors();
|
||||
}
|
||||
|
||||
@Before
|
||||
//@Before
|
||||
public void preloadgCubeProfilesForUCDs() {
|
||||
LOG.debug("preloadgCubeProfilesForUCDs called");
|
||||
try {
|
||||
|
@ -163,7 +163,7 @@ public class Complex_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void testReadProjectForUCDDataEntry() {
|
||||
ScopeProvider.instance.set(CONTEXT);
|
||||
SecurityTokenProvider.instance.set(TOKEN);
|
||||
|
|
Loading…
Reference in New Issue