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

@ -412,11 +412,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(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);
columns.add(cData);
i++;
@ -495,11 +517,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(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);
columns.add(cData);
i++;
@ -518,7 +562,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
* {@inheritDoc}
@ -533,10 +576,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
aslSession.getUsername()));
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();
ColumnLocalId columnId=new ColumnLocalId(columnLocalId);
ColumnLocalId columnId = new ColumnLocalId(columnLocalId);
Column c = table.getColumnById(columnId);
if (c.getColumnType() instanceof IdColumnType) {
@ -588,10 +632,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue());
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(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);
}
@ -676,10 +743,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: " + cl.getValue());
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(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);
}
@ -3412,7 +3502,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
operationDefinition.getOperationId(), map);
break;
case CODENAME:
DataLocaleMetadata locale=new DataLocaleMetadata(changeColumnTypeSession.getLocale());
DataLocaleMetadata locale = new DataLocaleMetadata(
changeColumnTypeSession.getLocale());
map.put(Constants.PARAMETER_ADDITIONAL_META, locale);
operationDefinition = OperationDefinitionMap.map(
OperationsId.ChangeToCodeName.toString(), capabilities);
@ -4438,11 +4529,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(cl.getValue());
logger.debug("Column Set Label: "
+ cl.getValue());
if (cl.getValue() == null
|| cl.getValue().isEmpty()) {
cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en");
} else {
cData.setLabel(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);
columns.add(cData);
i++;
@ -4950,13 +5063,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("GetOccurencesForBatchReplace: " + occurrencesForReplaceBatchColumnSession.toString());
logger.debug("GetOccurencesForBatchReplace: "
+ occurrencesForReplaceBatchColumnSession.toString());
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService();
ArrayList<Occurrences> occurences = QueryService.queryOccurences(
service, occurrencesForReplaceBatchColumnSession, Direction.ASC);
service, occurrencesForReplaceBatchColumnSession,
Direction.ASC);
logger.debug("Retrieved Occurences");
return occurences;
@ -5502,37 +5617,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* {@inheritDoc}
*/
@Override
public ArrayList<String> getLocales()
throws TDGWTServiceException {
public ArrayList<String> getLocales() throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
@SuppressWarnings("unused")
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("getLocales()");
List<String> listLocales=Arrays.asList(Locales.ALLOWED_LOCALES);
ArrayList<String> locales=new ArrayList<String>();
locales.addAll(listLocales);
logger.debug("locales :"+locales);
return locales;
List<String> listLocales = Arrays.asList(Locales.ALLOWED_LOCALES);
ArrayList<String> locales = new ArrayList<String>();
locales.addAll(listLocales);
logger.debug("locales :" + locales);
return locales;
} catch (Throwable e) {
logger.debug("getLocales(): "+e.getLocalizedMessage());
logger.debug("getLocales(): " + e.getLocalizedMessage());
e.printStackTrace();
throw new TDGWTServiceException(
"Error retrieving locales: "
+ e.getLocalizedMessage());
throw new TDGWTServiceException("Error retrieving locales: "
+ e.getLocalizedMessage());
}
}
}

View File

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