Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@93414 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-03-21 11:32:37 +00:00
parent c973a5f7a3
commit cce2146b7c
6 changed files with 214 additions and 0 deletions

View File

@ -20,6 +20,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
@ -586,6 +589,29 @@ public interface TDGWTService extends RemoteService {
throws TDGWTServiceException;
//Templates
/**
* Retrieves templates of user
*
* @return
*/
public ArrayList<TemplateData> getTemplates() throws TDGWTServiceException;
/**
* Get Operation Monitor during ApplyTemplate operation
*
* @param callback
*/
public TemplateApplyMonitor getTemplateApplyMonitor() throws TDGWTServiceException;
/**
* Start Apply Template
*
* @param applyTemplateSession
*
*/
void startTemplateApply(TemplateApplySession applyTemplateSession) throws TDGWTServiceException;
}

View File

@ -19,6 +19,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
@ -181,4 +184,11 @@ public interface TDGWTServiceAsync {
//BatchReplace Operation
void getOccurencesForBatchReplace(ColumnData column, AsyncCallback<ArrayList<Occurences>> callback);
//Templates
void getTemplates(AsyncCallback<ArrayList<TemplateData>> callback);
void getTemplateApplyMonitor(AsyncCallback<TemplateApplyMonitor> callback);
void startTemplateApply(TemplateApplySession applyTemplateSession,AsyncCallback<Void> callback);
}

View File

@ -37,6 +37,7 @@ import org.gcube.common.resources.gcore.utils.Group;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationProvider;
import org.gcube.data.analysis.tabulardata.commons.utils.AuthorizationToken;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TaskStatus;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.TemplateDescription;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationDefinition;
import org.gcube.data.analysis.tabulardata.commons.webservice.types.operations.OperationExecution;
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
@ -105,6 +106,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts;
import org.gcube.portlets.user.td.gwtservice.shared.share.ShareInfo;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplyMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateApplySession;
import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
@ -4318,4 +4322,51 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
@Override
public ArrayList<TemplateData> getTemplates() throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("GetTemplates");
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService();
List<TemplateDescription> templateDescriptorList=service.getTemplates();
ArrayList<TemplateData> templateDataList=new ArrayList<TemplateData>();
TemplateData templateData;
for(TemplateDescription desc:templateDescriptorList){
templateData=new TemplateData();
templateData.setId(desc.getId());
templateData.setName(desc.getName());
templateData.setDescription(desc.getDescription());
templateData.setAgency(desc.getAgency());
templateDataList.add(templateData);
}
logger.debug("Retrieved TemplateData List");
return templateDataList;
} catch (Throwable e) {
logger.debug("Error in GetTemplates: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new TDGWTServiceException(
"Error in GetOccurencesForBatchReplace: "
+ e.getLocalizedMessage());
}
}
@Override
public TemplateApplyMonitor getTemplateApplyMonitor() throws TDGWTServiceException {
// TODO Auto-generated method stub
return null;
}
@Override
public void startTemplateApply(TemplateApplySession applyTemplateSession) throws TDGWTServiceException {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.td.gwtservice.shared.template;
import java.io.Serializable;
import org.gcube.portlets.user.td.gwtservice.shared.OperationMonitor;
/**
* Apply Template Monitor
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateApplyMonitor extends OperationMonitor implements Serializable {
private static final long serialVersionUID = 7429207202237589027L;
}

View File

@ -0,0 +1,44 @@
package org.gcube.portlets.user.td.gwtservice.shared.template;
import java.io.Serializable;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
/**
* Apply Template Session
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateApplySession implements Serializable {
private static final long serialVersionUID = -8834066207159106968L;
protected TemplateData templateData;
protected TRId trId;
public TRId getTrId() {
return trId;
}
public void setTrId(TRId trId) {
this.trId = trId;
}
public TemplateData getTemplateData() {
return templateData;
}
public void setTemplateData(TemplateData templateData) {
this.templateData = templateData;
}
@Override
public String toString() {
return "TemplateApplySession [templateData=" + templateData + ", trId="
+ trId + "]";
}
}

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.user.td.gwtservice.shared.template;
import java.io.Serializable;
/**
* Template Description
*
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateData implements Serializable {
private static final long serialVersionUID = -2884032748710752646L;
private long id;
private String name;
private String description;
private String agency;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAgency() {
return agency;
}
public void setAgency(String agency) {
this.agency = agency;
}
@Override
public String toString() {
return "TemplateData [id=" + id + ", name=" + name + ", description="
+ description + ", agency=" + agency + "]";
}
}