Embedded ckan-metadata widget and ignored target directory

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129079 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-06-13 10:54:15 +00:00
parent d7a9786971
commit cfe72fe3e1
13 changed files with 159 additions and 20 deletions

View File

@ -33,5 +33,22 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-user.jar">
<attributes>
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-codeserver.jar">
<attributes>
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-dev.jar">
<attributes>
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA.jar" sourcepath="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

0
.gwt/.gwt-log Normal file
View File

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT lastWarOutDir=/home/costantino/workspace/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

13
pom.xml
View File

@ -57,11 +57,11 @@
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<!-- <scope>provided</scope> --> <scope>provided</scope>
<scope>compile</scope> <!-- <scope>compile</scope> -->
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.gwtbootstrap</groupId> <groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId> <artifactId>gwt-bootstrap</artifactId>
<scope>compile</scope> <scope>compile</scope>
@ -84,6 +84,13 @@
</dependency> </dependency>
<!-- END FWS --> <!-- END FWS -->
<!-- Metadata publisher widget -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId> <artifactId>authorization-client</artifactId>

View File

@ -17,6 +17,12 @@
<entry-point <entry-point
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' /> class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
<!-- Inherits widget -->
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- Specify the paths for translatable code --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />

View File

@ -3,7 +3,17 @@
*/ */
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client; package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm;
import com.github.gwtbootstrap.client.ui.Modal;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
/** /**
@ -20,6 +30,57 @@ public class CkanEventHandlerManager {
* *
*/ */
public CkanEventHandlerManager() { public CkanEventHandlerManager() {
bind();
}
private void bind() {
// bind on insert metadata
eventBus.addHandler(InsertMetadataEvent.TYPE, new InsertMetadataEventHandler() {
@Override
public void onInsertMetadata(InsertMetadataEvent loadSelecteReleaseEvent) {
final Modal modal = new Modal(true);
// request who's doing the insert
GCubeCkanDataCatalog.service.getUser(new AsyncCallback<String>() {
@Override
public void onSuccess(String username) {
if(username != null){
modal.setTitle("Insert Metadata");
modal.addStyleName("insert-metadata-modal-style");
modal.add(new CreateDatasetForm(username));
modal.setCloseVisible(true);
modal.show();
}
else
Window.alert("Please, logout and login again then retry.");
}
@Override
public void onFailure(Throwable caught) {
Window.alert("Please, logout and login again then retry.");
}
});
}
});
// bind on edit (TODO)
eventBus.addHandler(EditMetadataEvent.TYPE, new EditMetadataEventHandler() {
@Override
public void onEditMetadata(EditMetadataEvent editMetadataEvent) {
// TODO Auto-generated method stub
}
});
} }
@ -29,4 +90,7 @@ public class CkanEventHandlerManager {
public HandlerManager getEventBus() { public HandlerManager getEventBus() {
return eventBus; return eventBus;
} }
} }

View File

@ -18,4 +18,10 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
* @throws Exception * @throws Exception
*/ */
CkanRole getMyRole() throws Exception; CkanRole getMyRole() throws Exception;
/**
* Asks who is the current user
* @return
*/
String getUser();
} }

View File

@ -17,4 +17,6 @@ public interface GcubeCkanDataCatalogServiceAsync {
void getCKanConnector(AsyncCallback<String> callback); void getCKanConnector(AsyncCallback<String> callback);
void getMyRole(AsyncCallback<CkanRole> callback); void getMyRole(AsyncCallback<CkanRole> callback);
void getUser(AsyncCallback<String> callback);
} }

View File

@ -39,6 +39,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX); // this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
insertMeta.setType(ButtonType.LINK); insertMeta.setType(ButtonType.LINK);
editMeta.setType(ButtonType.LINK); editMeta.setType(ButtonType.LINK);
editMeta.setVisible(false); // hide for now (it is not supported yet)
nav.add(insertMeta); nav.add(insertMeta);
nav.add(editMeta); nav.add(editMeta);
nav.setClose(false); nav.setClose(false);

View File

@ -151,4 +151,14 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
//TODO READ FROM IS //TODO READ FROM IS
return CkanRole.ADMIN; return CkanRole.ADMIN;
} }
@Override
public String getUser() {
HttpSession httpSession = this.getThreadLocalRequest().getSession();
logger.debug("User in session is " + getASLSession(httpSession).getUsername());
return getASLSession(httpSession).getUsername();
}
} }

View File

@ -17,6 +17,12 @@
<entry-point <entry-point
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' /> class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
<!-- Inherits widget -->
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- Specify the paths for translatable code --> <!-- Specify the paths for translatable code -->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />

View File

@ -1,39 +1,48 @@
/** Add css rules here for your application. */ /** Add css rules here for your application. */
body { body {
padding-top: 0px !important; /** OVERRIDE GWT BOOTSTRAP PADDING TOP TO 50px*/ padding-top: 0px !important;
/** OVERRIDE GWT BOOTSTRAP PADDING TOP TO 50px*/
} }
/** Example rules used by the template application (remove for your app) */ /** Example rules used by the template application (remove for your app) */
h1 { h1 {
font-size: 2em; font-size: 2em;
font-weight: bold; font-weight: bold;
color: #777777; color: #777777;
margin: 40px 0px 70px; margin: 40px 0px 70px;
text-align: center; text-align: center;
} }
.sendButton { .sendButton {
display: block; display: block;
font-size: 16pt; font-size: 16pt;
} }
/** Most GWT widgets already have a style name defined */ /** Most GWT widgets already have a style name defined */
.gwt-DialogBox { .gwt-DialogBox {
width: 400px; width: 400px;
} }
.dialogVPanel { .dialogVPanel {
margin: 5px; margin: 5px;
} }
.serverResponseLabelError { .serverResponseLabelError {
color: red; color: red;
} }
/** Set ids using widget.getElement().setId("idOfElement") */ /** Set ids using widget.getElement().setId("idOfElement") */
#closeButton { #closeButton {
margin: 15px 6px 6px; margin: 15px 6px 6px;
} }
/** For the modal **/
.insert-metadata-modal-style {
width: 1024px !important;
margin-left: -500px !important;
}
.modal-body {
height: 600px;
max-height: none !important;
}

View File

@ -7,7 +7,7 @@
<context-param> <context-param>
<param-name>CkanConnectorContext</param-name> <param-name>CkanConnectorContext</param-name>
<!-- <param-value>/connect</param-value> --> <!-- <param-value>/connect</param-value> -->
<param-value>/gcube/service/connect</param-value> <param-value>/gcube/service/connect</param-value>
</context-param> </context-param>
@ -17,11 +17,22 @@
<servlet-class>org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.GcubeCkanDataCatalogServiceImpl</servlet-class> <servlet-class>org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.GcubeCkanDataCatalogServiceImpl</servlet-class>
</servlet> </servlet>
<servlet>
<servlet-name>ckanpublisherservices</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckandatapublisherwidget.server.CKANPublisherServicesImpl</servlet-class>
</servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>gcubeckandatacatalogservice</servlet-name> <servlet-name>gcubeckandatacatalogservice</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/ckandatacatalogue</url-pattern> <url-pattern>/gCubeCkanDataCatalog/ckandatacatalogue</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>ckanpublisherservices</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/ckanservices</url-pattern>
</servlet-mapping>
<!-- Default page to serve --> <!-- Default page to serve -->