Skip to content

Commit

Permalink
Merge branch 'release' of github.com:metasfresh/metasfresh-webui into…
Browse files Browse the repository at this point in the history
… release
  • Loading branch information
metas-ts committed May 12, 2017
2 parents 3c00cc9 + 23221e4 commit 3de4bdd
Show file tree
Hide file tree
Showing 151 changed files with 6,393 additions and 2,985 deletions.

This file was deleted.

11 changes: 10 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>

<spring-boot.version>1.4.1.RELEASE</spring-boot.version>
<spring-boot.version>1.5.3.RELEASE</spring-boot.version>
<springfox-swagger.version>2.6.1</springfox-swagger.version>

<!-- See http://www.mojohaus.org/versions-maven-plugin/examples/update-properties.html
Expand Down Expand Up @@ -97,6 +97,15 @@
<version>${metasfresh.version}</version>
</dependency>

<!-- https://github.com/metasfresh/metasfresh/issues/523 -->
<!-- we need those classes in the webui-api and swing-UI in order to run the MD_Candidate_Request_PP_Order process -->
<dependency>
<groupId>de.metas.material</groupId>
<artifactId>metasfresh-material-dispo</artifactId>
<version>${metasfresh.version}</version>
<type>jar</type>
</dependency>

<!-- Elasticsearch -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
21 changes: 21 additions & 0 deletions src/main/configs/metasfresh-webui-api.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

#
# Uncomment if needed
# see for documentation http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
#
# USE_START_STOP_DAEMON=false

LOG_FOLDER=/opt/metasfresh/log

PID_FOLDER=/opt/metasfresh/metasfresh-webui-api

JAVA_OPTS="\
-Xmx2048M\
-XX:+HeapDumpOnOutOfMemoryError\
-DPropertyFile=/opt/metasfresh/metasfresh.properties\
-Dspring.boot.admin.url=http://localhost:9090\
-Dcom.sun.management.jmxremote.port=1618\
-Dcom.sun.management.jmxremote.authenticate=false\
-Dcom.sun.management.jmxremote.ssl=false\
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8789\
"
16 changes: 16 additions & 0 deletions src/main/configs/metasfresh-webui-api.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# systemd service file for metasfresh-webui-api
# to install it, copy it to /etc/systemd/system and chmod it to 0644
#
[Unit]
Description=metasfresh-webui-api
After=syslog.target

[Service]
User=metasfresh
ExecStart=/opt/metasfresh/metasfresh-webui-api/metasfresh-webui-api.jar
SuccessExitStatus=143
PIDFile=/opt/metasfresh/metasfresh-webui-api/metasfresh-webui-api/metasfresh-webui-api.service.pid

[Install]
WantedBy=multi-user.target
27 changes: 17 additions & 10 deletions src/main/java/de/metas/ui/web/WebRestApiApplication.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package de.metas.ui.web;

import org.adempiere.ad.migration.logger.IMigrationLogger;
import org.adempiere.model.InterfaceWrapperHelper;
import org.adempiere.util.Check;
import org.adempiere.util.Services;
import org.apache.catalina.connector.Connector;
import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.compiere.Adempiere;
Expand All @@ -18,10 +20,12 @@
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.EnableAsync;

import de.metas.logging.LogManager;
import de.metas.ui.web.base.model.I_T_WEBUI_ViewSelection;
import de.metas.ui.web.session.WebRestApiContextProvider;
import de.metas.ui.web.window.model.DocumentInterfaceWrapperHelper;

Expand All @@ -35,23 +39,21 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

@SpringBootApplication(scanBasePackageClasses = {
WebRestApiApplication.class // this one
, org.adempiere.ad.dao.IQueryStatisticsLogger.class // FIXME: hardcoded because else SQL tracing is not working and atm i am not confident to scan the whole de.metas/org.compiere/org.adempiere trees.
})
@SpringBootApplication(scanBasePackages = { "de.metas", "org.adempiere" })
@EnableAsync
@Profile(WebRestApiApplication.PROFILE_Webui)
public class WebRestApiApplication
{
/**
Expand All @@ -62,7 +64,7 @@ public class WebRestApiApplication

public static final String PROFILE_Test = "test";
public static final String PROFILE_NotTest = "!" + PROFILE_Test;
public static final String PROFILE_Webui = "webui";
public static final String PROFILE_Webui = "metasfresh-webui";
/** Profile activate when running from IDE */
public static final String PROFILE_Development = "development";

Expand Down Expand Up @@ -110,7 +112,9 @@ public static boolean isProfileActive(final String profile)
@Autowired
private ApplicationContext applicationContext;

@Bean
public static final String BEANNAME_Adempiere = "adempiere";

@Bean(BEANNAME_Adempiere)
public Adempiere adempiere(final WebRestApiContextProvider webuiContextProvider)
{
Env.setContextProvider(webuiContextProvider);
Expand All @@ -120,6 +124,9 @@ public Adempiere adempiere(final WebRestApiContextProvider webuiContextProvider)
final Adempiere adempiere = Env.getSingleAdempiereInstance();
adempiere.setApplicationContext(applicationContext);
adempiere.startup(RunMode.WEBUI);

Services.get(IMigrationLogger.class).addTableToIgnoreList(I_T_WEBUI_ViewSelection.Table_Name);

return adempiere;
}

Expand All @@ -140,9 +147,9 @@ public void customize(Connector connector)
final AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>)connector.getProtocolHandler();
httpProtocol.setCompression("on");
httpProtocol.setCompressionMinSize(256);
String mimeTypes = httpProtocol.getCompressableMimeType();
String mimeTypes = httpProtocol.getCompressibleMimeType();
String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE + ",application/javascript";
httpProtocol.setCompressableMimeType(mimeTypesWithJson);
httpProtocol.setCompressibleMimeType(mimeTypesWithJson);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.metas.ui.web.address;

import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.adempiere.model.InterfaceWrapperHelper;
Expand Down Expand Up @@ -50,6 +51,7 @@

public class AddressCountryLookupDescriptor implements LookupDescriptor, LookupDataSourceFetcher
{
private static final Optional<String> LookupTableName = Optional.of(I_C_Country.Table_Name);
private static final String CACHE_PREFIX = I_C_Country.Table_Name;
private static final String CONTEXT_LookupTableName = I_C_Country.Table_Name;

Expand All @@ -67,6 +69,12 @@ public boolean isCached()
return true;
}

@Override
public Optional<String> getLookupTableName()
{
return LookupTableName;
}

@Override
public List<CCacheStats> getCacheStats()
{
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/de/metas/ui/web/address/AddressDescriptorFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
Expand Down Expand Up @@ -74,8 +74,8 @@ private DocumentEntityDescriptor createAddressEntityDescriptor()
.setCaption(Services.get(IMsgBL.class).getTranslatableMsgText("C_Location_ID"))
.setDataBinding(new AddressDataBindingDescriptorBuilder())
.disableDefaultTableCallouts()
//
;
//
;

addressDescriptor.addField(buildFieldDescriptor(IAddressModel.COLUMNNAME_Address1)
.setValueClass(String.class)
Expand Down Expand Up @@ -150,9 +150,9 @@ private DocumentFieldDescriptor.Builder buildFieldDescriptor(final String column
.setMandatoryLogic(false)
//
.addCharacteristic(Characteristic.PublicField)
//
// .setDataBinding(new AddressFieldBinding(columnName, false, I_C_Location::get))
//
//
// .setDataBinding(new AddressFieldBinding(columnName, false, I_C_Location::get))
//
;

}
Expand All @@ -177,7 +177,8 @@ private static DocumentLayoutElementDescriptor.Builder createLayoutElement(final
.setWidgetType(fieldDescriptor.getWidgetType())
.addField(DocumentLayoutElementFieldDescriptor.builder(fieldDescriptor.getFieldName())
.setLookupSource(fieldDescriptor.getLookupSourceType())
.setPublicField(true));
.setPublicField(true)
.setSupportZoomInto(fieldDescriptor.getWidgetType().isSupportZoomInto()));
}

private static class AddressDataBindingDescriptorBuilder implements DocumentEntityDataBindingDescriptorBuilder
Expand Down Expand Up @@ -224,7 +225,7 @@ private AddressFieldBinding(
, final boolean mandatory //
, final Function<I_C_Location, Object> readMethod //
, final BiConsumer<I_C_Location, IDocumentFieldView> writeMethod //
)
)
{
super();
this.columnName = columnName;
Expand Down Expand Up @@ -304,7 +305,7 @@ public static void writeValue_Address4(final I_C_Location toLocationRecord, fina
{
toLocationRecord.setAddress4(fromField.getValueAs(String.class));
}

public static void writeValue_Postal(final I_C_Location toLocationRecord, final IDocumentFieldView fromField)
{
toLocationRecord.setPostal(fromField.getValueAs(String.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.metas.ui.web.address;

import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.adempiere.ad.trx.api.ITrx;
Expand Down Expand Up @@ -50,6 +51,7 @@

public class AddressRegionLookupDescriptor implements LookupDescriptor, LookupDataSourceFetcher
{
private static final Optional<String> LookupTableName = Optional.of(I_C_Region.Table_Name);
private static final String CACHE_PREFIX = I_C_Region.Table_Name;
private static final String CONTEXT_LookupTableName = I_C_Region.Table_Name;
private static final Set<String> PARAMETERS = ImmutableSet.of(
Expand All @@ -61,6 +63,11 @@ public class AddressRegionLookupDescriptor implements LookupDescriptor, LookupDa

private final CCache<Integer, LookupValuesList> regionsByCountryId = CCache.newLRUCache(CACHE_PREFIX + "RegionLookupValues", 100, 0);

@Override
public Optional<String> getLookupTableName()
{
return LookupTableName;
}
@Override
public String getCachePrefix()
{
Expand Down
Loading

0 comments on commit 3de4bdd

Please sign in to comment.