Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@96012 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0b8254afa3
commit
17f7b3a774
|
@ -307,7 +307,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
|
||||
// ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
TabResource currentTR = SessionUtil.getTabResource(session);
|
||||
if (currentTR == null) {
|
||||
|
@ -326,8 +326,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
|
||||
.getTrId());
|
||||
updateTabResourceInformation(currentTR, trMetadatas);
|
||||
currentTR.setDate(getTRCreationDate(currentTR.getTrId()));
|
||||
currentTR.setValid(isTabularResourceValid(currentTR.getTrId()));
|
||||
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResource tr = service
|
||||
.getTabularResource(new TabularResourceId(Long.valueOf(currentTR
|
||||
.getId())));
|
||||
|
||||
currentTR.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
currentTR.setValid(tr.isValid());
|
||||
currentTR.setFinalized(tr.isFinalized());
|
||||
|
||||
SessionUtil.setTabResource(session, currentTR);
|
||||
logger.debug("GetTabResourceInformation() updated information:"
|
||||
+ currentTR.toString());
|
||||
|
@ -2960,6 +2972,44 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check finalized status of a tabular resource
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public Boolean isTabularResourceFinalized(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("IsTabularResourceFinalized: " + trId.toString());
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResource tr = service
|
||||
.getTabularResource(new TabularResourceId(Long.valueOf(trId
|
||||
.getId())));
|
||||
logger.debug("IsTabularResourceFinalized: " + tr.isFinalized());
|
||||
return tr.isFinalized();
|
||||
} catch (TDGWTSessionExpiredException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error checking if it is a finalized tabular resource: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error checking if it is a finalized tabular resource: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -5364,7 +5414,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
new Long(tabResource.getTrId().getId()));
|
||||
|
||||
TabularResource tr = service.getTabularResource(tabularResourceId);
|
||||
|
||||
tr.finalize(tabResource.isFinalized());
|
||||
|
||||
if (tabResource.getName() != null) {
|
||||
NameMetadata name = new NameMetadata(tabResource.getName());
|
||||
tr.setMetadata(name);
|
||||
|
|
|
@ -17,14 +17,16 @@ public class TabResource implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -8353499109124097114L;
|
||||
|
||||
protected String id;
|
||||
protected TRId trId;
|
||||
protected String id;//For grid only
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String agency;
|
||||
protected String date;
|
||||
protected String right;
|
||||
protected boolean valid;
|
||||
protected TRId trId;
|
||||
protected boolean finalized;
|
||||
|
||||
|
||||
public TabResource(){}
|
||||
|
||||
|
@ -110,14 +112,25 @@ public class TabResource implements Serializable {
|
|||
this.valid = valid;
|
||||
}
|
||||
|
||||
public boolean isFinalized() {
|
||||
return finalized;
|
||||
}
|
||||
|
||||
public void setFinalized(boolean finalized) {
|
||||
this.finalized = finalized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabResource [id=" + id + ", name=" + name + ", description="
|
||||
+ description + ", agency=" + agency + ", date=" + date
|
||||
+ ", right=" + right + ", valid=" + valid + ", trId=" + trId
|
||||
+ "]";
|
||||
return "TabResource [trId=" + trId + ", id=" + id + ", name=" + name
|
||||
+ ", description=" + description + ", agency=" + agency
|
||||
+ ", date=" + date + ", right=" + right + ", valid=" + valid
|
||||
+ ", finalized=" + finalized + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue