minor fix for twin columns widget
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@144202 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b891f94b09
commit
e666ee4366
|
@ -36,10 +36,10 @@ public class CKanMetadataPublisher implements EntryPoint {
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
// remove comment to the below line for testing the widget
|
// remove comment to the below line for testing the widget
|
||||||
//startExample();
|
// startExample();
|
||||||
//testMetadata();
|
// testMetadata();
|
||||||
//testSelectionPanel();
|
// testSelectionPanel();
|
||||||
//testHideOption();
|
// testHideOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -214,12 +214,10 @@ public class CKanMetadataPublisher implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void startExample() {
|
private void startExample() {
|
||||||
|
|
||||||
String idFolderWorkspace = "e87bfc7d-4fb0-4795-9c79-0c495500ca9c";
|
String idFolderWorkspace = "1fede4e2-5859-4f19-bddb-aec7dd5b632f";
|
||||||
String owner = "costantino.perciante";
|
|
||||||
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(idFolderWorkspace, eventBus));
|
RootPanel.get("ckan-metadata-publisher-div").add(new CreateDatasetForm(idFolderWorkspace, eventBus));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
|
|
||||||
public TwinColumnSelectionMainPanel(ResourceElementBean initialBean) {
|
public TwinColumnSelectionMainPanel(ResourceElementBean initialBean) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
|
GWT.log(initialBean.toString());
|
||||||
|
|
||||||
this.initialBean = initialBean;
|
this.initialBean = initialBean;
|
||||||
|
|
||||||
|
@ -199,7 +201,9 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
//breadcrumbsUpdater();
|
//breadcrumbsUpdater();
|
||||||
|
|
||||||
Collections.sort(selectedBean.getChildren());
|
Collections.sort(selectedBean.getChildren());
|
||||||
|
GWT.log("Children " + selectedBean.getChildren());
|
||||||
dataProviderLeft.setList(selectedBean.getChildren());
|
dataProviderLeft.setList(selectedBean.getChildren());
|
||||||
|
cellListLeft.setPageSize(selectedBean.getChildren().size());
|
||||||
dataProviderLeft.refresh();
|
dataProviderLeft.refresh();
|
||||||
}
|
}
|
||||||
selectionModelLeft.setSelected(selectedBean, false);
|
selectionModelLeft.setSelected(selectedBean, false);
|
||||||
|
@ -234,7 +238,9 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
||||||
|
|
||||||
// set back the root content list
|
// set back the root content list
|
||||||
dataProviderLeft.setList(initialBean.getChildren());
|
dataProviderLeft.setList(initialBean.getChildren());
|
||||||
|
cellListLeft.setPageSize(initialBean.getChildren().size());
|
||||||
dataProviderLeft.refresh();
|
dataProviderLeft.refresh();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
logger.info("DEV MODE DETECTED");
|
||||||
|
Utils.getCurrentToken(getThreadLocalRequest(), true);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
bean = new DatasetMetadataBean();
|
bean = new DatasetMetadataBean();
|
||||||
bean.setId(folderId);
|
bean.setId(folderId);
|
||||||
|
@ -225,7 +228,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
bean.setAuthorEmail("costantino.perciante@isti.cnr.it");
|
bean.setAuthorEmail("costantino.perciante@isti.cnr.it");
|
||||||
bean.setMaintainer("Costantino Perciante");
|
bean.setMaintainer("Costantino Perciante");
|
||||||
bean.setMaintainerEmail("costantino.perciante@isti.cnr.it");
|
bean.setMaintainerEmail("costantino.perciante@isti.cnr.it");
|
||||||
bean.setOrganizationList(getUserOrganizationsListAdmin(userName, Utils.getCurrentContext(getThreadLocalRequest(), true)));
|
//bean.setOrganizationList(getUserOrganizationsListAdmin(userName, Utils.getCurrentContext(getThreadLocalRequest(), true)));
|
||||||
|
bean.setOrganizationList(Arrays.asList(new OrganizationBean("preVRE", "prevre")));
|
||||||
bean.setOwnerIdentifier(userName);
|
bean.setOwnerIdentifier(userName);
|
||||||
|
|
||||||
if(folderId != null && !folderId.isEmpty()){
|
if(folderId != null && !folderId.isEmpty()){
|
||||||
|
@ -236,6 +240,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("Returning bean " + bean);
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,16 +459,21 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
String toReturn = null;
|
String toReturn = null;
|
||||||
|
|
||||||
if(mapOrganizationScope.containsKey(orgName))
|
if(isWithinPortal()){
|
||||||
toReturn = mapOrganizationScope.get(orgName);
|
if(mapOrganizationScope.containsKey(orgName))
|
||||||
else{
|
toReturn = mapOrganizationScope.get(orgName);
|
||||||
try{
|
else{
|
||||||
String evaluatedScope = Utils.retrieveScopeFromOrganizationName(orgName);
|
try{
|
||||||
mapOrganizationScope.put(orgName, evaluatedScope);
|
String evaluatedScope = Utils.retrieveScopeFromOrganizationName(orgName);
|
||||||
toReturn = evaluatedScope;
|
mapOrganizationScope.put(orgName, evaluatedScope);
|
||||||
}catch(Exception e){
|
toReturn = evaluatedScope;
|
||||||
logger.error("Failed to retrieve scope from OrgName for organization " + orgName, e);
|
}catch(Exception e){
|
||||||
|
logger.error("Failed to retrieve scope from OrgName for organization " + orgName, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
toReturn = "/gcube/preprod/preVRE";
|
||||||
|
mapOrganizationScope.put(orgName, toReturn);
|
||||||
}
|
}
|
||||||
logger.debug("Returning scope " + toReturn);
|
logger.debug("Returning scope " + toReturn);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -505,7 +515,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
logger.warn("Dev mode detected");
|
logger.warn("Dev mode detected");
|
||||||
toReturn = Arrays.asList(new GroupBean("Group title", "aaa"));
|
toReturn = Arrays.asList();
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +529,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
if(!isWithinPortal()){
|
if(!isWithinPortal()){
|
||||||
logger.warn("OUT FROM PORTAL DETECTED RETURNING TRUE");
|
logger.warn("OUT FROM PORTAL DETECTED RETURNING TRUE");
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
|
@ -600,6 +600,26 @@ public class Utils {
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the current token by using the portal manager
|
||||||
|
* @param b
|
||||||
|
* @return a GcubeUser object
|
||||||
|
*/
|
||||||
|
public static String getCurrentToken(HttpServletRequest request, boolean setInThread){
|
||||||
|
|
||||||
|
if(request == null)
|
||||||
|
throw new IllegalArgumentException("HttpServletRequest is null!");
|
||||||
|
|
||||||
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
String token = pContext.getCurrentUserToken(getCurrentContext(request, false), getCurrentUser(request).getUsername());
|
||||||
|
logger.debug("Returning token " + token);
|
||||||
|
|
||||||
|
if(token != null && setInThread)
|
||||||
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the group given the scope
|
* Retrieve the group given the scope
|
||||||
|
|
|
@ -123,6 +123,8 @@ public class WorkspaceUtils {
|
||||||
.getHome().getWorkspace();
|
.getHome().getWorkspace();
|
||||||
|
|
||||||
WorkspaceItem originalFolderOrFile = ws.getItem(folderId);
|
WorkspaceItem originalFolderOrFile = ws.getItem(folderId);
|
||||||
|
|
||||||
|
logger.debug("Item retrieved is " + originalFolderOrFile);
|
||||||
|
|
||||||
if(!originalFolderOrFile.isFolder()){
|
if(!originalFolderOrFile.isFolder()){
|
||||||
|
|
||||||
|
@ -193,6 +195,8 @@ public class WorkspaceUtils {
|
||||||
logger.error("Failed to build the resource tree", e);
|
logger.error("Failed to build the resource tree", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("Tree that is going to be returned is " + rootElem);
|
||||||
return rootElem;
|
return rootElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +219,7 @@ public class WorkspaceUtils {
|
||||||
elem.setDescription(item.getDescription());
|
elem.setDescription(item.getDescription());
|
||||||
extractEditableNameFromPath(elem, pathSeparator);
|
extractEditableNameFromPath(elem, pathSeparator);
|
||||||
childrenInTree.add(elem);
|
childrenInTree.add(elem);
|
||||||
|
logger.trace("Elem is " + elem);
|
||||||
if(item.isFolder())
|
if(item.isFolder())
|
||||||
visit(elem, item, fullPathBase, pathSeparator);
|
visit(elem, item, fullPathBase, pathSeparator);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
||||||
return item == null ? null : item.identifierGWT;
|
return item == null ? null : item.identifierGWT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor
|
* Copy constructor
|
||||||
* @param another
|
* @param another
|
||||||
|
@ -54,7 +54,7 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
||||||
this.url = another.url;
|
this.url = another.url;
|
||||||
this.description = another.description;
|
this.description = another.description;
|
||||||
this.organizationNameDatasetParent = another.organizationNameDatasetParent;
|
this.organizationNameDatasetParent = another.organizationNameDatasetParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
|
@ -246,4 +246,5 @@ public class ResourceElementBean implements Comparable<ResourceElementBean>, Ser
|
||||||
+ organizationNameDatasetParent + ", parent=" + parent
|
+ organizationNameDatasetParent + ", parent=" + parent
|
||||||
+ ", children number=" + (children == null ? 0 : children.size()) + "]";
|
+ ", children number=" + (children == null ? 0 : children.size()) + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue