diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionTypeDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionTypeDAO.java index e72bdb1bf..9435edf6b 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionTypeDAO.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/CalendarExceptionTypeDAO.java @@ -25,7 +25,7 @@ import java.util.List; import org.hibernate.Criteria; import org.hibernate.criterion.Restrictions; import org.navalplanner.business.calendars.entities.CalendarExceptionType; -import org.navalplanner.business.common.daos.GenericDAOHibernate; +import org.navalplanner.business.common.daos.IntegrationEntityDAO; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; @@ -38,7 +38,7 @@ import org.springframework.stereotype.Repository; @Repository @Scope(BeanDefinition.SCOPE_SINGLETON) public class CalendarExceptionTypeDAO extends - GenericDAOHibernate implements + IntegrationEntityDAO implements ICalendarExceptionTypeDAO { @Override diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionTypeDAO.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionTypeDAO.java index dfb5fe846..1530fed78 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionTypeDAO.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/daos/ICalendarExceptionTypeDAO.java @@ -21,7 +21,7 @@ package org.navalplanner.business.calendars.daos; import org.navalplanner.business.calendars.entities.CalendarExceptionType; -import org.navalplanner.business.common.daos.IGenericDAO; +import org.navalplanner.business.common.daos.IIntegrationEntityDAO; /** * Contract for {@link CalendarExceptionTypeDAO} @@ -29,7 +29,7 @@ import org.navalplanner.business.common.daos.IGenericDAO; * @author Manuel Rego Casasnovas */ public interface ICalendarExceptionTypeDAO extends - IGenericDAO { + IIntegrationEntityDAO { boolean existsByName(CalendarExceptionType type); diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarExceptionType.java b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarExceptionType.java index b8ec5b890..f6cf68320 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarExceptionType.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/calendars/entities/CalendarExceptionType.java @@ -21,14 +21,16 @@ package org.navalplanner.business.calendars.entities; import org.apache.commons.lang.BooleanUtils; -import org.navalplanner.business.common.BaseEntity; +import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO; +import org.navalplanner.business.common.IntegrationEntity; +import org.navalplanner.business.common.Registry; /** * Type of an exception day. * * @author Manuel Rego Casasnovas */ -public class CalendarExceptionType extends BaseEntity { +public class CalendarExceptionType extends IntegrationEntity { public static CalendarExceptionType create(String name, String color, Boolean notAssignable) { @@ -69,4 +71,9 @@ public class CalendarExceptionType extends BaseEntity { public boolean isOverAssignable() { return BooleanUtils.isFalse(notAssignable); } + + @Override + protected ICalendarExceptionTypeDAO getIntegrationEntityDAO() { + return Registry.getCalendarExceptionTypeDAO(); + } } diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java b/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java index 46a6cb2ca..2ed0c7357 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/common/Registry.java @@ -22,6 +22,7 @@ package org.navalplanner.business.common; import org.navalplanner.business.advance.daos.IAdvanceTypeDAO; import org.navalplanner.business.calendars.daos.IBaseCalendarDAO; +import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO; import org.navalplanner.business.common.daos.IConfigurationDAO; import org.navalplanner.business.costcategories.daos.ICostCategoryDAO; import org.navalplanner.business.costcategories.daos.IHourCostDAO; @@ -153,6 +154,9 @@ public class Registry { @Autowired private IHourCostDAO hourCostDAO; + @Autowired + private ICalendarExceptionTypeDAO calendarExceptionTypeDAO; + private Registry() { } @@ -273,4 +277,9 @@ public class Registry { public static IHourCostDAO getHourCostDAO() { return getInstance().hourCostDAO; } -} + + public static ICalendarExceptionTypeDAO getCalendarExceptionTypeDAO() { + return getInstance().calendarExceptionTypeDAO; + } + +} \ No newline at end of file diff --git a/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml b/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml index 6fbaad8f1..eb030ca70 100644 --- a/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml +++ b/navalplanner-business/src/main/resources/org/navalplanner/business/calendars/entities/Calendars.hbm.xml @@ -66,6 +66,8 @@ + + diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeDTO.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeDTO.java new file mode 100644 index 000000000..8c9d3b56f --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeDTO.java @@ -0,0 +1,67 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.ws.calendarexceptiontypes.api; + +import javax.xml.bind.annotation.XmlAttribute; + +import org.navalplanner.business.calendars.entities.CalendarExceptionType; +import org.navalplanner.ws.common.api.IntegrationEntityDTO; + +/** + * DTO for {@link CalendarExceptionType} entity. + * + * @author Manuel Rego Casasnovas + */ +public class CalendarExceptionTypeDTO extends IntegrationEntityDTO { + + public final static String ENTITY_TYPE = "calendar-exception-type"; + + @XmlAttribute + public String name; + + @XmlAttribute + public String color; + + @XmlAttribute(name = "over-assignable") + public boolean overAssignable; + + public CalendarExceptionTypeDTO() { + } + + public CalendarExceptionTypeDTO(String code, String name, String color, + boolean overAssignable) { + super(code); + this.name = name; + this.color = color; + this.overAssignable = overAssignable; + } + + public CalendarExceptionTypeDTO(String name, String color, + boolean overAssignable) { + this(generateCode(), name, color, overAssignable); + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + +} \ No newline at end of file diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeListDTO.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeListDTO.java new file mode 100644 index 000000000..838f61eb9 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/CalendarExceptionTypeListDTO.java @@ -0,0 +1,50 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.ws.calendarexceptiontypes.api; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.navalplanner.business.calendars.entities.CalendarExceptionType; + +/** + * DTO for {@link CalendarExceptionType} entity. + * + * @author Manuel Rego Casasnovas + */ +@XmlRootElement(name = "calendar-exception-type-list") +public class CalendarExceptionTypeListDTO { + + @XmlElement(name = "calendar-exception-type") + public List calendarExceptionTypes = new ArrayList(); + + public CalendarExceptionTypeListDTO() { + } + + public CalendarExceptionTypeListDTO( + List calendarExceptionTypes) { + this.calendarExceptionTypes = calendarExceptionTypes; + } + +} \ No newline at end of file diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/ICalendarExceptionTypeService.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/ICalendarExceptionTypeService.java new file mode 100644 index 000000000..8412f5794 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/ICalendarExceptionTypeService.java @@ -0,0 +1,34 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.ws.calendarexceptiontypes.api; + +import org.navalplanner.business.calendars.entities.CalendarExceptionType; + +/** + * Service for managing {@link CalendarExceptionType} entities. + * + * @author Manuel Rego Casasnovas + */ +public interface ICalendarExceptionTypeService { + + CalendarExceptionTypeListDTO getCalendarExceptionType(); + +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/package-info.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/package-info.java new file mode 100644 index 000000000..515c63504 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/api/package-info.java @@ -0,0 +1,29 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * Specification of namespace for REST-based services. + * + * @author Manuel Rego Casasnovas + */ +@javax.xml.bind.annotation.XmlSchema(elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, namespace = WSCommonGlobalNames.REST_NAMESPACE) +package org.navalplanner.ws.calendarexceptiontypes.api; + +import org.navalplanner.ws.common.api.WSCommonGlobalNames; diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeConverter.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeConverter.java new file mode 100644 index 000000000..1f924763f --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeConverter.java @@ -0,0 +1,44 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.ws.calendarexceptiontypes.impl; + +import org.navalplanner.business.calendars.entities.CalendarExceptionType; +import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO; + +/** + * Converter from/to {@link CalendarExceptionType} related entities to/from + * DTOs. + * + * @author Manuel Rego Casasnovas + */ +public final class CalendarExceptionTypeConverter { + + private CalendarExceptionTypeConverter() { + } + + public final static CalendarExceptionTypeDTO toDTO( + CalendarExceptionType calendarExceptionType) { + return new CalendarExceptionTypeDTO(calendarExceptionType.getCode(), + calendarExceptionType.getName(), calendarExceptionType + .getColor(), calendarExceptionType.isOverAssignable()); + } + +} diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeServiceREST.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeServiceREST.java new file mode 100644 index 000000000..a2beb00a5 --- /dev/null +++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/calendarexceptiontypes/impl/CalendarExceptionTypeServiceREST.java @@ -0,0 +1,85 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.ws.calendarexceptiontypes.impl; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO; +import org.navalplanner.business.calendars.entities.CalendarExceptionType; +import org.navalplanner.business.common.daos.IIntegrationEntityDAO; +import org.navalplanner.business.common.exceptions.ValidationException; +import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO; +import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeListDTO; +import org.navalplanner.ws.calendarexceptiontypes.api.ICalendarExceptionTypeService; +import org.navalplanner.ws.common.impl.GenericRESTService; +import org.navalplanner.ws.common.impl.RecoverableErrorException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * REST-based implementation of {@link ICalendarExceptionTypeService}. + * + * @author Manuel Rego Casasnovas + */ +@Path("/calendarexceptiontypes/") +@Produces("application/xml") +@Service("calendarExceptionTypeServiceREST") +public class CalendarExceptionTypeServiceREST extends + GenericRESTService + implements + ICalendarExceptionTypeService { + + @Autowired + private ICalendarExceptionTypeDAO calendarExceptionTypeDAO; + + @Override + protected IIntegrationEntityDAO getIntegrationEntityDAO() { + return calendarExceptionTypeDAO; + } + + @Override + protected CalendarExceptionTypeDTO toDTO(CalendarExceptionType entity) { + return CalendarExceptionTypeConverter.toDTO(entity); + } + + @Override + protected CalendarExceptionType toEntity(CalendarExceptionTypeDTO entityDTO) + throws ValidationException, RecoverableErrorException { + return null; + } + + @Override + protected void updateEntity(CalendarExceptionType entity, + CalendarExceptionTypeDTO entityDTO) throws ValidationException, + RecoverableErrorException { + } + + @Override + @GET + @Transactional(readOnly = true) + public CalendarExceptionTypeListDTO getCalendarExceptionType() { + return new CalendarExceptionTypeListDTO(findAll()); + } + +} diff --git a/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml index 042a06024..28ee981cd 100644 --- a/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml +++ b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml @@ -67,6 +67,7 @@ + diff --git a/navalplanner-webapp/src/test/java/org/navalplanner/web/test/ws/calendarexceptiontypes/api/CalendarExceptionTypeServiceTest.java b/navalplanner-webapp/src/test/java/org/navalplanner/web/test/ws/calendarexceptiontypes/api/CalendarExceptionTypeServiceTest.java new file mode 100644 index 000000000..8947aff1f --- /dev/null +++ b/navalplanner-webapp/src/test/java/org/navalplanner/web/test/ws/calendarexceptiontypes/api/CalendarExceptionTypeServiceTest.java @@ -0,0 +1,103 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.web.test.ws.calendarexceptiontypes.api; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.navalplanner.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; +import static org.navalplanner.web.WebappGlobalNames.WEBAPP_SPRING_CONFIG_FILE; +import static org.navalplanner.web.test.WebappGlobalNames.WEBAPP_SPRING_CONFIG_TEST_FILE; + +import org.hibernate.SessionFactory; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO; +import org.navalplanner.business.calendars.entities.CalendarExceptionType; +import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeDTO; +import org.navalplanner.ws.calendarexceptiontypes.api.CalendarExceptionTypeListDTO; +import org.navalplanner.ws.calendarexceptiontypes.api.ICalendarExceptionTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +/** + * Tests for {@link ICalendarExceptionTypeService}. + * + * @author Manuel Rego Casasnovas + */ + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { BUSINESS_SPRING_CONFIG_FILE, + WEBAPP_SPRING_CONFIG_FILE, WEBAPP_SPRING_CONFIG_TEST_FILE }) +@Transactional +public class CalendarExceptionTypeServiceTest { + + @Autowired + private ICalendarExceptionTypeService calendarExceptionTypeService; + + @Autowired + private ICalendarExceptionTypeDAO calendarExceptionTypeDAO; + + @Autowired + private SessionFactory sessionFactory; + + private CalendarExceptionType givenCalendarExceptionTypeStored() { + CalendarExceptionType calendarExceptionType = CalendarExceptionType + .create("name", "color", false); + + calendarExceptionTypeDAO.save(calendarExceptionType); + calendarExceptionTypeDAO.flush(); + sessionFactory.getCurrentSession().evict(calendarExceptionType); + calendarExceptionType.dontPoseAsTransientObjectAnymore(); + + return calendarExceptionType; + } + + @Test + public void exportLabelTypes() { + CalendarExceptionTypeListDTO list = calendarExceptionTypeService + .getCalendarExceptionType(); + assertTrue(list.calendarExceptionTypes.isEmpty()); + } + + @Test + public void exportLabelTypes2() { + CalendarExceptionType calendarExceptionType = givenCalendarExceptionTypeStored(); + + CalendarExceptionTypeListDTO list = calendarExceptionTypeService + .getCalendarExceptionType(); + assertThat(list.calendarExceptionTypes.size(), equalTo(1)); + + CalendarExceptionTypeDTO calendarExceptionTypeDTO = list.calendarExceptionTypes + .get(0); + assertThat(calendarExceptionTypeDTO.code, equalTo(calendarExceptionType + .getCode())); + assertThat(calendarExceptionTypeDTO.name, equalTo(calendarExceptionType + .getName())); + assertThat(calendarExceptionTypeDTO.color, + equalTo(calendarExceptionType.getColor())); + assertThat(calendarExceptionTypeDTO.overAssignable, + equalTo(calendarExceptionType.isOverAssignable())); + } + +} diff --git a/scripts/rest-clients/README b/scripts/rest-clients/README index a64335c4b..0a8d22d1c 100644 --- a/scripts/rest-clients/README +++ b/scripts/rest-clients/README @@ -84,6 +84,10 @@ - export-resources-hours.sh 21654685 2010-01-01 2010-12-31 (authenticate with wsreader/wsreader) + * Export calendar exception types: + + - export-calendar-exception-types.sh (authenticate with wsreader/wsreader) + + When working with the online demo add "--prod" argument to every command. Example: diff --git a/scripts/rest-clients/export-calendar-exception-types.sh b/scripts/rest-clients/export-calendar-exception-types.sh new file mode 100755 index 000000000..19115f98e --- /dev/null +++ b/scripts/rest-clients/export-calendar-exception-types.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +. ./rest-common-env.sh + +printf "Login name: " +read loginName +printf "Password: " +read password + +if [ "$1" = "--prod" ]; then + baseServiceURL=$PRODUCTION_BASE_SERVICE_URL + certificate=$PRODUCTION_CERTIFICATE +else + baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL + certificate=$DEVELOPMENT_CERTIFICATE +fi + +authorization=`./base64.sh $loginName:$password` + +curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \ + $baseServiceURL/calendarexceptiontypes | tidy -xml -i -q -utf8