Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94592 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-08 17:55:28 +00:00
parent d221f6e251
commit 391e1ff5ec
2 changed files with 161 additions and 40 deletions

View File

@ -411,12 +411,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (cl == null) { if (cl == null) {
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else {
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " logger.debug("Column Set Label: "
+ cl.getValue()); + cl.getValue());
} }
} }
}
DataLocaleMetadata dataLocaleMetadata = null;
try {
dataLocaleMetadata = c
.getMetadata(DataLocaleMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (dataLocaleMetadata == null) {
logger.debug("No DataLocaleMetadata");
} else {
cData.setLocale(dataLocaleMetadata.getLocale());
}
cData.setTrId(trId); cData.setTrId(trId);
columns.add(cData); columns.add(cData);
i++; i++;
@ -494,12 +516,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (cl == null) { if (cl == null) {
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else {
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " logger.debug("Column Set Label: "
+ cl.getValue()); + cl.getValue());
} }
} }
}
DataLocaleMetadata dataLocaleMetadata = null;
try {
dataLocaleMetadata = c
.getMetadata(DataLocaleMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (dataLocaleMetadata == null) {
logger.debug("No DataLocaleMetadata");
} else {
cData.setLocale(dataLocaleMetadata.getLocale());
}
cData.setTrId(trId); cData.setTrId(trId);
columns.add(cData); columns.add(cData);
i++; i++;
@ -518,7 +562,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
} }
/** /**
* *
* {@inheritDoc} * {@inheritDoc}
@ -533,7 +576,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
aslSession.getUsername())); aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
Table table = service.getTable(new TableId(Long.valueOf(trId.getTableId()))); Table table = service.getTable(new TableId(Long.valueOf(trId
.getTableId())));
ColumnData cData = new ColumnData(); ColumnData cData = new ColumnData();
ColumnLocalId columnId = new ColumnLocalId(columnLocalId); ColumnLocalId columnId = new ColumnLocalId(columnLocalId);
@ -587,11 +631,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (cl == null) { if (cl == null) {
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else {
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue()); logger.debug("Column Set Label: "
+ cl.getValue());
} }
} }
}
DataLocaleMetadata dataLocaleMetadata = null;
try {
dataLocaleMetadata = c
.getMetadata(DataLocaleMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (dataLocaleMetadata == null) {
logger.debug("No DataLocaleMetadata");
} else {
cData.setLocale(dataLocaleMetadata.getLocale());
}
cData.setTrId(trId); cData.setTrId(trId);
} }
@ -675,11 +742,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (cl == null) { if (cl == null) {
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else {
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue()); logger.debug("Column Set Label: "
+ cl.getValue());
} }
} }
}
DataLocaleMetadata dataLocaleMetadata = null;
try {
dataLocaleMetadata = c
.getMetadata(DataLocaleMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (dataLocaleMetadata == null) {
logger.debug("No DataLocaleMetadata");
} else {
cData.setLocale(dataLocaleMetadata.getLocale());
}
cData.setTrId(trId); cData.setTrId(trId);
} }
@ -3412,7 +3502,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
operationDefinition.getOperationId(), map); operationDefinition.getOperationId(), map);
break; break;
case CODENAME: case CODENAME:
DataLocaleMetadata locale=new DataLocaleMetadata(changeColumnTypeSession.getLocale()); DataLocaleMetadata locale = new DataLocaleMetadata(
changeColumnTypeSession.getLocale());
map.put(Constants.PARAMETER_ADDITIONAL_META, locale); map.put(Constants.PARAMETER_ADDITIONAL_META, locale);
operationDefinition = OperationDefinitionMap.map( operationDefinition = OperationDefinitionMap.map(
OperationsId.ChangeToCodeName.toString(), capabilities); OperationsId.ChangeToCodeName.toString(), capabilities);
@ -4437,12 +4528,34 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (cl == null) { if (cl == null) {
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else {
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " logger.debug("Column Set Label: "
+ cl.getValue()); + cl.getValue());
} }
} }
}
DataLocaleMetadata dataLocaleMetadata = null;
try {
dataLocaleMetadata = c
.getMetadata(DataLocaleMetadata.class);
} catch (NoSuchMetadataException e) {
logger.debug("DataLocaleMetadata: NoSuchMetadataException "
+ e.getLocalizedMessage());
}
if (dataLocaleMetadata == null) {
logger.debug("No DataLocaleMetadata");
} else {
cData.setLocale(dataLocaleMetadata.getLocale());
}
cData.setTrId(trId); cData.setTrId(trId);
columns.add(cData); columns.add(cData);
i++; i++;
@ -4950,13 +5063,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session); ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("GetOccurencesForBatchReplace: " + occurrencesForReplaceBatchColumnSession.toString()); logger.debug("GetOccurencesForBatchReplace: "
+ occurrencesForReplaceBatchColumnSession.toString());
AuthorizationProvider.instance.set(new AuthorizationToken( AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername())); aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
ArrayList<Occurrences> occurences = QueryService.queryOccurences( ArrayList<Occurrences> occurences = QueryService.queryOccurences(
service, occurrencesForReplaceBatchColumnSession, Direction.ASC); service, occurrencesForReplaceBatchColumnSession,
Direction.ASC);
logger.debug("Retrieved Occurences"); logger.debug("Retrieved Occurences");
return occurences; return occurences;
@ -5502,14 +5617,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
/** /**
* *
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public ArrayList<String> getLocales() public ArrayList<String> getLocales() throws TDGWTServiceException {
throws TDGWTServiceException {
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -5523,16 +5636,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("locales :" + locales); logger.debug("locales :" + locales);
return locales; return locales;
} catch (Throwable e) { } catch (Throwable e) {
logger.debug("getLocales(): " + e.getLocalizedMessage()); logger.debug("getLocales(): " + e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new TDGWTServiceException( throw new TDGWTServiceException("Error retrieving locales: "
"Error retrieving locales: "
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
} }
} }
} }

View File

@ -22,6 +22,8 @@ public class ColumnData implements Serializable {
protected String typeCode; protected String typeCode;
protected String dataTypeName; protected String dataTypeName;
protected String label; protected String label;
protected String locale;
protected TRId trId; protected TRId trId;
protected boolean viewColumn; protected boolean viewColumn;
protected ColumnViewData columnViewData; protected ColumnViewData columnViewData;
@ -139,16 +141,25 @@ public class ColumnData implements Serializable {
this.validationColumnReferences = validationColumnReferences; this.validationColumnReferences = validationColumnReferences;
} }
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
@Override @Override
public String toString() { public String toString() {
return "ColumnData [id=" + id + ", columnId=" + columnId + ", name=" return "ColumnData [id=" + id + ", columnId=" + columnId + ", name="
+ name + ", typeName=" + typeName + ", typeCode=" + typeCode + name + ", typeName=" + typeName + ", typeCode=" + typeCode
+ ", dataTypeName=" + dataTypeName + ", label=" + label + ", dataTypeName=" + dataTypeName + ", label=" + label
+ ", trId=" + trId + ", viewColumn=" + viewColumn + ", locale=" + locale + ", trId=" + trId + ", viewColumn="
+ ", columnViewData=" + columnViewData + viewColumn + ", columnViewData=" + columnViewData
+ ", validationColumnReferences=" + validationColumnReferences + ", validationColumnReferences=" + validationColumnReferences
+ ", validationColumn=" + validationColumn + ", validationColumn=" + validationColumn
+ ", validatedColumns=" + validatedColumns + "]"; + ", validatedColumns=" + validatedColumns + "]";
} }
} }