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"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); if (cl.getValue() == null
logger.debug("Column Set Label: " || cl.getValue().isEmpty()) {
+ cl.getValue()); 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); cData.setTrId(trId);
columns.add(cData); columns.add(cData);
i++; i++;
@ -495,11 +517,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); if (cl.getValue() == null
logger.debug("Column Set Label: " || cl.getValue().isEmpty()) {
+ cl.getValue()); 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); cData.setTrId(trId);
columns.add(cData); columns.add(cData);
i++; i++;
@ -517,8 +561,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
+ e.getLocalizedMessage()); + e.getLocalizedMessage());
} }
} }
/** /**
* *
* {@inheritDoc} * {@inheritDoc}
@ -533,10 +576,11 @@ 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);
Column c = table.getColumnById(columnId); Column c = table.getColumnById(columnId);
if (c.getColumnType() instanceof IdColumnType) { if (c.getColumnType() instanceof IdColumnType) {
@ -588,10 +632,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); if (cl.getValue() == null
logger.debug("Column Set Label: " + cl.getValue()); || 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); cData.setTrId(trId);
} }
@ -676,10 +743,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); if (cl.getValue() == null
logger.debug("Column Set Label: " + cl.getValue()); || 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); 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);
@ -4438,11 +4529,33 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
cData.setLabel("nolabel"); cData.setLabel("nolabel");
logger.debug("ColumnLabel no label in en"); logger.debug("ColumnLabel no label in en");
} else { } else {
cData.setLabel(cl.getValue()); if (cl.getValue() == null
logger.debug("Column Set Label: " || cl.getValue().isEmpty()) {
+ cl.getValue()); 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); 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,37 +5617,32 @@ 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")
ASLSession aslSession = SessionUtil.getAslSession(session); ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("getLocales()"); logger.debug("getLocales()");
List<String> listLocales=Arrays.asList(Locales.ALLOWED_LOCALES); List<String> listLocales = Arrays.asList(Locales.ALLOWED_LOCALES);
ArrayList<String> locales=new ArrayList<String>(); ArrayList<String> locales = new ArrayList<String>();
locales.addAll(listLocales); locales.addAll(listLocales);
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;
@ -133,22 +135,31 @@ public class ColumnData implements Serializable {
public ArrayList<String> getValidationColumnReferences() { public ArrayList<String> getValidationColumnReferences() {
return validationColumnReferences; return validationColumnReferences;
} }
public void setValidationColumnReferences( public void setValidationColumnReferences(
ArrayList<String> validationColumnReferences) { ArrayList<String> validationColumnReferences) {
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 + "]";
} }
} }