├── .gitignore ├── LICENSE ├── README.md ├── WebContent ├── META-INF │ └── MANIFEST.MF ├── WEB-INF │ ├── checkbox.jsp │ ├── datetime.jsp │ ├── errorPage.jsp │ ├── fieldgroup.jsp │ ├── hidden.jsp │ ├── index.jsp │ ├── input.jsp │ ├── list.jsp │ ├── multiselect.jsp │ ├── select.jsp │ ├── settings.jsp │ ├── springmvc-dispatcher-servlet.xml │ ├── style.css │ ├── submit.jsp │ └── web.xml └── resources │ └── parsley.css ├── appconfig.xjb ├── appconfig.xsd ├── package.json ├── pom.xml └── src ├── .DS_Store ├── main ├── java │ ├── com │ │ └── jamfsoftware │ │ │ └── research │ │ │ └── macingestor │ │ │ ├── ErrorController.java │ │ │ ├── JAXBReader.java │ │ │ ├── MACDataType.java │ │ │ ├── SettingsServlet.java │ │ │ ├── Specfile.java │ │ │ ├── SpecfileComparator.java │ │ │ ├── SpecfileRepository.java │ │ │ ├── SpecfileServlet.java │ │ │ ├── SpringConfig.java │ │ │ ├── SubmitServlet.java │ │ │ ├── jaxb │ │ │ ├── Boolean.java │ │ │ ├── BooleanConstraintType.java │ │ │ ├── BooleanValueType.java │ │ │ ├── Date.java │ │ │ ├── DateAdapter.java │ │ │ ├── DateConstraintType.java │ │ │ ├── DateValueType.java │ │ │ ├── Description.java │ │ │ ├── DeviceVariable.java │ │ │ ├── Dict.java │ │ │ ├── Field.java │ │ │ ├── FieldGroup.java │ │ │ ├── Float.java │ │ │ ├── FloatArray.java │ │ │ ├── FloatArrayConstraintType.java │ │ │ ├── FloatArrayValueType.java │ │ │ ├── FloatConstraintType.java │ │ │ ├── FloatValueType.java │ │ │ ├── Integer.java │ │ │ ├── IntegerArray.java │ │ │ ├── IntegerArrayValueType.java │ │ │ ├── IntegerConstraintType.java │ │ │ ├── IntegerValueType.java │ │ │ ├── Label.java │ │ │ ├── Language.java │ │ │ ├── ManagedAppConfiguration.java │ │ │ ├── ObjectFactory.java │ │ │ ├── Options.java │ │ │ ├── Presentation.java │ │ │ ├── String.java │ │ │ ├── StringArray.java │ │ │ ├── StringArrayValueType.java │ │ │ ├── StringConstraintType.java │ │ │ ├── StringValueType.java │ │ │ └── UserVariable.java │ │ │ └── uibean │ │ │ ├── Field.java │ │ │ ├── SelectField.java │ │ │ └── TextField.java │ ├── mac.xml │ └── wandera.xml └── resources │ └── application.properties └── test └── java └── com.jamfsoftware.research.macingestor.test └── SpecfileServletTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | \.idea/ 15 | 16 | \.DS_Store 17 | 18 | target/ 19 | 20 | *.iml 21 | 22 | \.settings/ 23 | 24 | \.project 25 | 26 | \.classpath 27 | 28 | node_modules/ 29 | /node 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Jamf Open Source Community 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AppConfig Generator 2 | 3 | The AppConfig Generator is a tool which assists in the generation of a configuration plist for a mobile app on a device enrolled in an MDM solution. 4 | 5 | The AppConfig Generator takes in a spec file which can either be created by hand, through the use of the [AppConfig Spec Creator](https://github.com/jamf/AppConfigSpecCreator), or selected from the repository of existing spec files. 6 | 7 | It will then display a form with areas to fill out with the configuration values you would like the app to have. 8 | 9 | Once you configure the values you want, you can download the plist from the AppConfig Generator and upload it to your MDM provider so it can be installed onto the device. 10 | 11 | You can view the [AppConfig Spec Reference](https://storage.googleapis.com/appconfig-media/appconfig-content/uploads/2017/01/ManagedAppConfig.pdf) for how documentation on how these spec files are formatted. 12 | 13 | More information about AppConfig can be found at: [appconfig.org](https://appconfig.org/) 14 | 15 | ## Build & Run the AppConfig Generator 16 | 1. Using Maven: ```mvn package``` 17 | 2. Output: ```target/managedAppConfigIngestor.war``` 18 | 3. Deploy war using tomcat -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/checkbox.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 5 | 6 | 7 |
8 | <% 9 | MACDataType data = (MACDataType)request.getAttribute("data"); 10 | String checked = ""; 11 | 12 | // try catch to catch nullpointer exception below 13 | try { 14 | if(data.getDefaultValueList().get(0).equals("true")) checked = "checked"; 15 | } catch (Exception e){ 16 | 17 | } 18 | %> 19 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/datetime.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 5 | 6 | 7 |
8 | 9 | 10 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 11 |
12 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/errorPage.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 3 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 5 | 6 | 7 | AppConfig Generator 8 | <%----%> 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 40 |
41 |
42 |

AppConfig Generator

43 |
44 |

${errorMsg}

45 |
46 |

For more information on AppConfig visit: appconfig.org or view the AppConfig Spec Reference

47 |
48 |
49 | 50 | 55 | 56 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/fieldgroup.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 6 | 7 | 8 | 9 | 10 |
11 | ${group.name.getName(pageContext.request.locale, defaultLocale)} 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/hidden.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 6 | 7 | 8 |
9 | 10 | 11 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 12 |
-------------------------------------------------------------------------------- /WebContent/WEB-INF/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 3 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 5 | 6 | 7 | AppConfig Generator 8 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 40 |
41 |

AppConfig Generator


42 |

The AppConfig Generator is a tool which assists in the generation of configuration plist for a mobile app on a device enrolled in an MDM solution.

43 |

For more information on AppConfig visit: appconfig.org or view the AppConfig Spec Reference

44 |

Follow the steps below to get started:

45 |
    46 |
  1. Obtain a Managed App Configuration specfile from the application developer
    and upload the specfile in the form below
  2. 47 | 48 |
    49 | 50 |
    51 | 52 |

    or select a specfile from the repository

    53 |
    54 | 60 | 61 |
    62 | 63 |
  3. Fill out the presented configuration options
  4. 64 |
  5. Download the plist configuration file
  6. 65 |
  7. Upload the plist to your MDM provider to be installed onto the device
  8. 66 | 67 |
68 |
69 |
70 | 71 | 76 | 77 | 78 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/input.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 6 | 7 | 8 |
9 | 10 | 11 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 12 |
13 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/list.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 6 | 7 | 53 | 54 | 55 |
56 | 57 | 58 |
59 |
60 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 61 |
62 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/multiselect.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Options.Option" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 6 | 7 |
8 | 9 | 22 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 23 |
24 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/select.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Options.Option" %> 5 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 6 | 7 | 8 |
9 | 10 | 23 | ${field.description.getDescription(pageContext.request.locale, defaultLocale) } 24 |
25 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/settings.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 3 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 4 | 5 | 6 | AppConfig Generator 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 |
29 |

AppConfig Generator

30 |
31 |

The AppConfig Generator is a tool which assists in the generation of configuration plist for a mobile app on a device enrolled in an MDM solution.

32 |

For more information on AppConfig visit: appconfig.org or view the AppConfig Spec Reference

33 |

Follow the steps below to get started:

34 |
    35 |
  1. Fill out the presented configuration options
  2. 36 |
  3. Download the plist configuration file
  4. 37 |
  5. Upload the plist to your MDM provider to be installed onto the device
  6. 38 |
39 | 40 |
41 | 42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
59 |
60 | 61 | 66 | 67 | 68 | 83 | 84 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/springmvc-dispatcher-servlet.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 10 | 11 | 13 | 14 | /WEB-INF/ 15 | 16 | 17 | .jsp 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/style.css: -------------------------------------------------------------------------------- 1 | html { 2 | position: relative; 3 | min-height: 100%; 4 | } 5 | body { 6 | /* Margin bottom by footer height */ 7 | margin-bottom: 60px; 8 | } 9 | .footer { 10 | position: absolute; 11 | bottom: 0; 12 | width: 100%; 13 | /* Set the fixed height of the footer here */ 14 | height: 60px; 15 | background-color: #f5f5f5; 16 | } 17 | 18 | .vertical-center { 19 | min-height: 100%; /* Fallback for browsers do NOT support vh unit */ 20 | min-height: 100vh; /* These two lines are counted as one :-) */ 21 | 22 | display: flex; 23 | align-items: center; 24 | } 25 | 26 | .center-text-trick { 27 | height: 50px; 28 | line-height: 60px; 29 | white-space: nowrap; 30 | } -------------------------------------------------------------------------------- /WebContent/WEB-INF/submit.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page import="com.jamfsoftware.research.macingestor.MACDataType" %> 3 | <%@ page import="com.jamfsoftware.research.macingestor.jaxb.Field" %> 4 | 5 | 6 | AppConfig Generator 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 |
29 |

AppConfig Generator

30 |
31 |

The AppConfig Generator is a tool which assists in the generation of configuration plist for a mobile app on a device enrolled in an MDM solution.

32 |

For more information on AppConfig visit: appconfig.org or view the AppConfig Spec Reference

33 |

Follow the steps below to get started:

34 |
    35 |
  1. Fill out the presented configuration options
  2. 36 |
  3. Download the plist configuration file
  4. 37 |
  5. Upload the plist to your MDM provider to be installed onto the device
  6. 38 |
39 | 40 |
41 | 42 | 67 | 68 | 69 |
70 | 71 |
72 | 73 | 74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
83 | 84 | 85 |
86 |
87 | 88 | 91 |
92 | 93 | 98 | 99 | 100 | 115 | 116 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | springmvc-dispatcher 9 | org.springframework.web.servlet.DispatcherServlet 10 | 1 11 | 12 | 13 | 14 | springmvc-dispatcher 15 | /settings 16 | 17 | 18 | springmvc-dispatcher 19 | /settings/repository 20 | 21 | 22 | 23 | springmvc-dispatcher 24 | /submit 25 | 26 | 27 | 28 | springmvc-dispatcher 29 | / 30 | 31 | 32 | 33 | /errors 34 | 35 | 36 | 37 | defaultHtmlEscape 38 | true 39 | 40 | 41 | -------------------------------------------------------------------------------- /WebContent/resources/parsley.css: -------------------------------------------------------------------------------- 1 | input.parsley-success, 2 | select.parsley-success, 3 | textarea.parsley-success { 4 | color: #468847; 5 | background-color: #DFF0D8; 6 | border: 1px solid #D6E9C6; 7 | } 8 | 9 | input.parsley-error, 10 | select.parsley-error, 11 | textarea.parsley-error { 12 | color: #B94A48; 13 | background-color: #F2DEDE; 14 | border: 1px solid #EED3D7; 15 | } 16 | 17 | .parsley-errors-list { 18 | margin: 2px 0 3px; 19 | padding: 0; 20 | list-style-type: none; 21 | font-size: 0.9em; 22 | line-height: 0.9em; 23 | opacity: 0; 24 | 25 | transition: all .3s ease-in; 26 | -o-transition: all .3s ease-in; 27 | -moz-transition: all .3s ease-in; 28 | -webkit-transition: all .3s ease-in; 29 | } 30 | 31 | .parsley-errors-list.filled { 32 | opacity: 1; 33 | } 34 | -------------------------------------------------------------------------------- /appconfig.xjb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "appconfiggenerator", 3 | "version": "1.0.0", 4 | "description": "The AppConfig Generator is a tool which assists in the generation of a configuration plist for a mobile app on a device enrolled in an MDM solution.", 5 | "dependencies": { 6 | "bootstrap": "^3.4.1", 7 | "bootstrap-fileinput": "^5.0.8", 8 | "jquery-ui-dist": "^1.12.1", 9 | "parsleyjs": "^2.9.2", 10 | "select2": "^4.0.12", 11 | "jquery": "^3.5.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.jamfsoftware.research 5 | managedAppConfigIngestor 6 | war 7 | 0.0.1 8 | managedAppConfigIngestor Maven Webapp 9 | http://maven.apache.org 10 | 11 | 12 | 13 | 14 | javax.servlet 15 | servlet-api 16 | 2.5 17 | 18 | 19 | org.springframework 20 | spring-core 21 | 4.3.20.RELEASE 22 | 23 | 24 | org.springframework 25 | spring-webmvc 26 | 4.3.20.RELEASE 27 | 28 | 29 | org.springframework 30 | spring-web 31 | 4.3.20.RELEASE 32 | 33 | 34 | org.springframework 35 | spring-beans 36 | 4.3.20.RELEASE 37 | 38 | 39 | javax.servlet 40 | jstl 41 | 1.2 42 | 43 | 44 | javax.el 45 | el-api 46 | 2.2 47 | 48 | 49 | org.json 50 | json 51 | 20090211 52 | 53 | 54 | commons-io 55 | commons-io 56 | 2.4 57 | 58 | 59 | com.googlecode.plist 60 | dd-plist 61 | 1.16 62 | 63 | 64 | commons-fileupload 65 | commons-fileupload 66 | [1.3.3,) 67 | 68 | 69 | junit 70 | junit 71 | 4.13.1 72 | 73 | 74 | org.springframework 75 | spring-test 76 | 4.3.9.RELEASE 77 | test 78 | 79 | 80 | javax.xml.bind 81 | jaxb-api 82 | 2.2.11 83 | 84 | 85 | com.sun.xml.bind 86 | jaxb-core 87 | 2.2.11 88 | 89 | 90 | com.sun.xml.bind 91 | jaxb-impl 92 | 2.2.11 93 | 94 | 95 | javax.activation 96 | activation 97 | 1.1.1 98 | 99 | 100 | 101 | managedAppConfigIngestor 102 | 103 | 104 | com.github.eirslett 105 | frontend-maven-plugin 106 | 1.6 107 | 108 | 109 | 110 | install-node-and-npm 111 | install-node-and-npm 112 | generate-resources 113 | 114 | 115 | 116 | npm-install 117 | npm 118 | 119 | install 120 | 121 | 122 | 123 | 124 | 125 | v8.11.1 126 | 5.6.0 127 | 128 | 129 | 130 | 131 | org.apache.maven.plugins 132 | maven-compiler-plugin 133 | 3.5.1 134 | 135 | 8 136 | 8 137 | 138 | 139 | 140 | 141 | maven-war-plugin 142 | 2.4 143 | 144 | WebContent/WEB-INF/web.xml 145 | WebContent 146 | 147 | 148 | 149 | node_modules 150 | 151 | 152 | **/dist/** 153 | **/**min.js 154 | **/**min.css 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | org.apache.maven.plugins 163 | maven-dependency-plugin 164 | 165 | 166 | package 167 | copy 168 | 169 | 170 | 171 | com.github.jsimone 172 | webapp-runner 173 | 9.0.19.0 174 | webapp-runner.jar 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamf/AppConfig-Generator/HEAD/src/.DS_Store -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/ErrorController.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.servlet.ModelAndView; 8 | 9 | @Controller 10 | public class ErrorController { 11 | 12 | @RequestMapping(value = "errors") 13 | public ModelAndView renderErrorPage(HttpServletRequest httpRequest) { 14 | ModelAndView errorPage = new ModelAndView("errorPage"); 15 | String errorMsg = "Something went wrong."; 16 | 17 | int httpErrorCode = getErrorCode(httpRequest); 18 | switch (httpErrorCode) { 19 | case 400: { 20 | errorMsg = "Bad Request"; 21 | break; 22 | } 23 | case 401: { 24 | errorMsg = "Unauthorized"; 25 | break; 26 | } 27 | case 404: { 28 | errorMsg = "Resource not found"; 29 | break; 30 | } 31 | case 500: { 32 | errorMsg = "Internal Server Error"; 33 | break; 34 | } 35 | } 36 | errorPage.addObject("errorMsg", errorMsg); 37 | return errorPage; 38 | } 39 | 40 | private int getErrorCode(HttpServletRequest httpRequest) { 41 | return (Integer) httpRequest 42 | .getAttribute("javax.servlet.error.status_code"); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/JAXBReader.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.io.File; 4 | import java.io.InputStream; 5 | import java.util.List; 6 | 7 | import javax.xml.bind.JAXBContext; 8 | import javax.xml.bind.JAXBException; 9 | import javax.xml.bind.Unmarshaller; 10 | 11 | import com.jamfsoftware.research.macingestor.jaxb.ManagedAppConfiguration; 12 | 13 | public class JAXBReader { 14 | 15 | private Class type; 16 | 17 | public JAXBReader(Class type){ 18 | this.type = type; 19 | } 20 | 21 | public static void main(String[] args) { 22 | try { 23 | JAXBContext jc = JAXBContext.newInstance(ManagedAppConfiguration.class); 24 | Unmarshaller unmarshaller = jc.createUnmarshaller(); 25 | ManagedAppConfiguration mac = (ManagedAppConfiguration) unmarshaller.unmarshal(new File("mac.xml")); 26 | List dict = mac.getDict().getStringOrStringArrayOrInteger(); 27 | for(Object o : dict){ 28 | MACDataType data = (MACDataType)o; 29 | System.out.println(data.getValidation()); 30 | System.out.println(data.isUserOrDeviceVariable()); 31 | } 32 | System.out.println(mac); 33 | } catch (JAXBException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | 38 | public T read(InputStream is){ 39 | try { 40 | JAXBContext jc = JAXBContext.newInstance(type); 41 | Unmarshaller unmarshaller = jc.createUnmarshaller(); 42 | return (T) unmarshaller.unmarshal(is); 43 | } catch (JAXBException e) { 44 | e.printStackTrace(); 45 | } 46 | 47 | return null; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/MACDataType.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.util.List; 4 | 5 | import com.jamfsoftware.research.macingestor.jaxb.Options; 6 | 7 | public interface MACDataType { 8 | 9 | public String getValidation(); 10 | public List getDefaultValueList(); 11 | public boolean isUserOrDeviceVariable(); 12 | public String getKeyName(); 13 | public String getDefaultPresentationType(); 14 | public Options getOptions(); 15 | public Object getPlistObject(String[] submissions); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SettingsServlet.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.net.URL; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import javax.xml.bind.JAXBException; 13 | 14 | import org.springframework.beans.factory.annotation.Value; 15 | import org.springframework.http.HttpStatus; 16 | import org.springframework.stereotype.Controller; 17 | import org.springframework.ui.ModelMap; 18 | import org.springframework.web.bind.annotation.ExceptionHandler; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | import org.springframework.web.bind.annotation.RequestMethod; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.ResponseStatus; 23 | import org.springframework.web.multipart.MultipartFile; 24 | import org.springframework.web.servlet.ModelAndView; 25 | import org.xml.sax.SAXException; 26 | 27 | import com.jamfsoftware.research.macingestor.jaxb.Field; 28 | import com.jamfsoftware.research.macingestor.jaxb.FieldGroup; 29 | import com.jamfsoftware.research.macingestor.jaxb.Label; 30 | import com.jamfsoftware.research.macingestor.jaxb.Language; 31 | import com.jamfsoftware.research.macingestor.jaxb.ManagedAppConfiguration; 32 | import com.jamfsoftware.research.macingestor.jaxb.Presentation; 33 | 34 | @Controller 35 | @RequestMapping("/settings") 36 | public class SettingsServlet { 37 | 38 | @Value("${repository.url}") 39 | private String repositoryURL; 40 | 41 | @RequestMapping(method = RequestMethod.POST) 42 | public String prepareSettings(ModelMap model, HttpServletRequest request, HttpServletResponse response, @RequestParam("file") MultipartFile file) { 43 | 44 | JAXBReader reader = new JAXBReader<>(ManagedAppConfiguration.class); 45 | try { 46 | ManagedAppConfiguration mac = reader.read(file.getInputStream()); 47 | prepareSchemaData(mac, model); 48 | request.getSession().setAttribute("mac", mac); 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | 53 | return "settings"; 54 | } 55 | 56 | @RequestMapping(value = "/repository", method = RequestMethod.POST) 57 | public String prepareSettingsFromRepository(ModelMap model, HttpServletRequest request, HttpServletResponse response, @RequestParam("file") String specfileURL) { 58 | 59 | SpecfileRepository repository = new SpecfileRepository(repositoryURL); 60 | if (repository.validSpecfile(specfileURL)) { 61 | 62 | JAXBReader reader = new JAXBReader<>(ManagedAppConfiguration.class); 63 | try { 64 | InputStream fileInputStream = new URL(specfileURL).openStream(); 65 | 66 | ManagedAppConfiguration mac = reader.read(fileInputStream); 67 | prepareSchemaData(mac, model); 68 | request.getSession().setAttribute("mac", mac); 69 | 70 | fileInputStream.close(); 71 | 72 | request.setAttribute("specfile", mac.getBundleId() + "/" + mac.getVersion()); 73 | } catch(IOException e) { 74 | e.printStackTrace(); 75 | } 76 | } 77 | 78 | request.setAttribute("repository", "../"); 79 | return "settings"; 80 | } 81 | 82 | 83 | private void prepareSchemaData(ManagedAppConfiguration mac, ModelMap model){ 84 | // Make HashMap of ID's to MACDataTypes 85 | Map datas = new HashMap(); 86 | 87 | List dict = mac.getDict().getStringOrStringArrayOrInteger(); 88 | for(Object o : dict){ 89 | MACDataType data = (MACDataType)o; 90 | datas.put(data.getKeyName(), data); 91 | } 92 | 93 | // ensure the Presentation field exists 94 | if(mac.getPresentation() == null){ 95 | mac.setPresentation(new Presentation()); 96 | } 97 | 98 | 99 | // Verify all MACDataTypes have a presentation Field entry 100 | // also correct to hide default values 101 | for(String s : datas.keySet()){ 102 | Field f = findField(mac.getPresentation().getFieldGroupOrField(), s); 103 | if(f == null){ 104 | f = new Field(); 105 | f.setType(datas.get(s).getDefaultPresentationType()); 106 | 107 | Language lang = new Language(); 108 | lang.setValueAttribute("en"); 109 | lang.setValue(s); 110 | Label l = new Label(); 111 | l.getLanguage().add(lang); 112 | f.setLabel(l); 113 | f.setKeyName(s); 114 | f.setOptions(datas.get(s).getOptions()); 115 | 116 | mac.getPresentation().getFieldGroupOrField().add(f); 117 | } else { 118 | if(datas.get(s).isUserOrDeviceVariable()){ 119 | f.setType("hidden"); 120 | } 121 | } 122 | } 123 | 124 | model.addAttribute("mac", mac); 125 | model.addAttribute("datas", datas); 126 | } 127 | 128 | 129 | private Field findField(List fields, String keyname){ 130 | for(Object o : fields){ 131 | try{ 132 | Field f = (Field)o; 133 | if(f.getKeyName().equals(keyname)) return f; 134 | } catch(Exception e){ 135 | FieldGroup fg = (FieldGroup)o; 136 | Field f = findField((List)(Object)fg.getField(), keyname); 137 | if(f != null) return f; 138 | } 139 | } 140 | return null; 141 | } 142 | 143 | @ResponseStatus(value = HttpStatus.UNSUPPORTED_MEDIA_TYPE) 144 | @ExceptionHandler({ // 3 main exceptions thrown when file uploaded isn't in a valid format 145 | JAXBException.class, // xml isn't formatted correctly 146 | SAXException.class, 147 | NullPointerException.class // file is not xml 148 | }) 149 | public ModelAndView badSpecfile() { 150 | ModelAndView errorPage = new ModelAndView("errorPage"); 151 | 152 | String errorMsg = "Invalid Specfile Format"; 153 | 154 | errorPage.addObject("errorMsg", errorMsg); 155 | return errorPage; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/Specfile.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | public class Specfile { 4 | 5 | private String resourceLocation; 6 | private String version; 7 | private String bundleId; 8 | 9 | public Specfile(String bundleId, String version, String resourceLocation) { 10 | this.bundleId = bundleId; 11 | this.version = version; 12 | this.resourceLocation = resourceLocation; 13 | } 14 | 15 | public String getResourceLocation() { 16 | return resourceLocation; 17 | } 18 | 19 | public String getVersion() { 20 | return version; 21 | } 22 | 23 | public String getBundleId() { 24 | return bundleId; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SpecfileComparator.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.util.Comparator; 4 | 5 | public class SpecfileComparator implements Comparator { 6 | @Override 7 | public int compare(final Specfile s1, final Specfile s2) { 8 | if (s1.getBundleId().equals(s2.getBundleId())) { // same bundle id 9 | try { // check version 10 | int s1Version = Integer.parseInt(s1.getVersion()); 11 | int s2Version = Integer.parseInt(s2.getVersion()); 12 | 13 | // sort in descending version order 14 | return -(Integer.compare(s1Version, s2Version)); 15 | } catch(NumberFormatException e) { // check for 'current' 16 | if (s1.getVersion().equals("current")) { 17 | return -1; // s1 is the most recent one 18 | } else { 19 | return 1; // fallback in case somehow version is neither a number or 'current' (throw it at the end) 20 | } 21 | } 22 | } else { // different bundle ids, order alphabetically 23 | return s1.getBundleId().compareTo(s2.getBundleId()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SpecfileRepository.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.net.HttpURLConnection; 4 | import java.net.URL; 5 | import java.util.ArrayList; 6 | import java.util.Collections; 7 | import java.util.List; 8 | 9 | import javax.xml.parsers.DocumentBuilder; 10 | import javax.xml.parsers.DocumentBuilderFactory; 11 | 12 | import org.w3c.dom.Document; 13 | import org.w3c.dom.Node; 14 | import org.w3c.dom.NodeList; 15 | 16 | public class SpecfileRepository { 17 | 18 | private String repositoryURL; 19 | 20 | public SpecfileRepository(String repositoryURL) { 21 | this.repositoryURL = repositoryURL; 22 | } 23 | 24 | public List getSpecfiles(String bundleId) { 25 | List allSpecfiles = getSpecfiles(); 26 | List specificSpecfiles = new ArrayList<>(); 27 | 28 | // only return specfiles corresponding to that bundle id 29 | for(Specfile s : allSpecfiles) { 30 | if (s.getBundleId().equals(bundleId)) { 31 | specificSpecfiles.add(s); 32 | } 33 | } 34 | 35 | return specificSpecfiles; 36 | } 37 | 38 | public List getSpecfiles() { 39 | List specfiles = new ArrayList<>(); 40 | 41 | Document specfileXML = getSpecfileXML(); 42 | if (specfileXML != null) { 43 | NodeList list = specfileXML.getDocumentElement().getElementsByTagName("Contents"); 44 | // iterate through the 'Contents' nodes 45 | for(int i = 0; i < list.getLength(); i++) { 46 | Node n = list.item(i); 47 | 48 | // example 'Contents' element: com.bundle.id/specfileVersion/appconfig.xml 49 | String specfileName = n.getFirstChild().getFirstChild().getNodeValue(); 50 | String[] specfileNameSegments = specfileName.split("/"); // split bundle id and specfile version 51 | 52 | String specfileResourceLocation = repositoryURL + "/" + specfileName; 53 | String specfileBundleId = specfileNameSegments[0]; 54 | String specfileVersion = specfileNameSegments[1]; 55 | 56 | Specfile specfile = new Specfile(specfileBundleId, specfileVersion, specfileResourceLocation); 57 | specfiles.add(specfile); 58 | } 59 | Collections.sort(specfiles, new SpecfileComparator()); // sort using our custom SpecfileComparator 60 | } 61 | return specfiles; // returns empty list if repository does not contain any specfiles 62 | } 63 | 64 | public Document getSpecfileXML() { 65 | try { 66 | // get contents from repository 67 | URL url = new URL(repositoryURL); 68 | HttpURLConnection con = (HttpURLConnection) url.openConnection(); 69 | con.setRequestMethod("GET"); 70 | con.addRequestProperty("Accept", "application/xml"); 71 | 72 | DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 73 | DocumentBuilder db = dbf.newDocumentBuilder(); 74 | 75 | Document xml = db.parse(con.getInputStream()); 76 | con.disconnect(); 77 | 78 | return xml; 79 | } catch(Exception e) { 80 | e.printStackTrace(); 81 | } 82 | 83 | return null; 84 | } 85 | 86 | public boolean validSpecfile(String file) { 87 | boolean valid = false; 88 | for(Specfile s : getSpecfiles()) { 89 | if (s.getResourceLocation().equals(file)) { 90 | valid = true; 91 | } 92 | } 93 | return valid; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SpecfileServlet.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.ModelMap; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RequestMethod; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | 13 | @Controller 14 | @RequestMapping("/") 15 | public class SpecfileServlet { 16 | 17 | @Value("${repository.url}") 18 | private String repositoryURL; 19 | 20 | @RequestMapping(method = RequestMethod.GET) 21 | public String index(HttpServletRequest request, HttpServletResponse response, ModelMap model, @RequestParam(value = "bundleId", required = false) String bundleId) { 22 | 23 | SpecfileRepository repository = new SpecfileRepository(repositoryURL); 24 | if (bundleId != null) { 25 | model.addAttribute("files", repository.getSpecfiles(bundleId)); 26 | } else { 27 | model.addAttribute("files", repository.getSpecfiles()); 28 | } 29 | return "index"; 30 | } 31 | 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SpringConfig.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.PropertySource; 7 | import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; 8 | 9 | @Configuration 10 | @PropertySource(value= {"classpath:application.properties"}) 11 | public class SpringConfig { 12 | 13 | //spring will automatically bind value of property 14 | @Value("${repository.url}") 15 | private String repositoryURL; 16 | 17 | //this bean needed to resolve ${property.name} syntax 18 | @Bean 19 | public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() { 20 | return new PropertySourcesPlaceholderConfigurer(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/SubmitServlet.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor; 2 | 3 | import java.io.IOException; 4 | import java.io.Reader; 5 | import java.io.StringReader; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import org.apache.commons.io.IOUtils; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | 16 | import com.dd.plist.NSDictionary; 17 | import com.jamfsoftware.research.macingestor.jaxb.ManagedAppConfiguration; 18 | 19 | @Controller 20 | @RequestMapping("/submit") 21 | public class SubmitServlet { 22 | 23 | @RequestMapping(value = "/download", method = RequestMethod.GET, produces=MediaType.APPLICATION_OCTET_STREAM_VALUE) 24 | public String download(HttpServletRequest request, HttpServletResponse response) { 25 | response.setContentType("application/force-download"); 26 | response.addHeader("Content-Disposition","attachment; filename=\"mac.plist\""); 27 | Reader reader = new StringReader(generatePlist(request)); 28 | try { 29 | IOUtils.copy(reader, response.getOutputStream()); 30 | } catch (IOException e) { 31 | e.printStackTrace(); 32 | } 33 | 34 | return null; 35 | } 36 | 37 | @RequestMapping(method = RequestMethod.GET) 38 | public String submit(HttpServletRequest request, HttpServletResponse response) { 39 | 40 | String plist = generatePlist(request); 41 | request.setAttribute("plist", plist); 42 | 43 | ManagedAppConfiguration mac = (ManagedAppConfiguration) request.getSession().getAttribute("mac"); 44 | request.setAttribute("specfile", mac.getBundleId() + "/" + mac.getVersion()); 45 | 46 | return "submit"; 47 | } 48 | 49 | private String generatePlist(HttpServletRequest request){ 50 | ManagedAppConfiguration mac = (ManagedAppConfiguration)request.getSession().getAttribute("mac"); 51 | NSDictionary plist = new NSDictionary(); 52 | for(Object o : mac.getDict().getStringOrStringArrayOrInteger()){ 53 | MACDataType data = (MACDataType)o; 54 | plist.put(data.getKeyName(), data.getPlistObject(request.getParameterValues(data.getKeyName()))); 55 | } 56 | return plist.toXMLPropertyList(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Boolean.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import javax.xml.bind.annotation.XmlAccessType; 15 | import javax.xml.bind.annotation.XmlAccessorType; 16 | import javax.xml.bind.annotation.XmlAttribute; 17 | import javax.xml.bind.annotation.XmlRootElement; 18 | import javax.xml.bind.annotation.XmlType; 19 | 20 | import com.jamfsoftware.research.macingestor.MACDataType; 21 | 22 | 23 | 24 | /** 25 | *

Java class for anonymous complex type. 26 | * 27 | *

The following schema fragment specifies the expected content contained within this class. 28 | * 29 | *

 30 |  * <complexType>
 31 |  *   <complexContent>
 32 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 33 |  *       <sequence>
 34 |  *         <element name="defaultValue" type="{}booleanValueType" minOccurs="0"/>
 35 |  *         <element name="constraint" type="{}booleanConstraintType" minOccurs="0"/>
 36 |  *       </sequence>
 37 |  *       <attribute name="keyName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 38 |  *     </restriction>
 39 |  *   </complexContent>
 40 |  * </complexType>
 41 |  * 
42 | * 43 | * 44 | */ 45 | @XmlAccessorType(XmlAccessType.FIELD) 46 | @XmlType(name = "", propOrder = { 47 | "defaultValue", 48 | "constraint" 49 | }) 50 | @XmlRootElement(name = "boolean") 51 | public class Boolean implements MACDataType { 52 | 53 | protected BooleanValueType defaultValue; 54 | protected BooleanConstraintType constraint; 55 | @XmlAttribute(name = "keyName", required = true) 56 | protected java.lang.String keyName; 57 | 58 | /** 59 | * Gets the value of the defaultValue property. 60 | * 61 | * @return 62 | * possible object is 63 | * {@link BooleanValueType } 64 | * 65 | */ 66 | public BooleanValueType getDefaultValue() { 67 | return defaultValue; 68 | } 69 | 70 | /** 71 | * Sets the value of the defaultValue property. 72 | * 73 | * @param value 74 | * allowed object is 75 | * {@link BooleanValueType } 76 | * 77 | */ 78 | public void setDefaultValue(BooleanValueType value) { 79 | this.defaultValue = value; 80 | } 81 | 82 | /** 83 | * Gets the value of the constraint property. 84 | * 85 | * @return 86 | * possible object is 87 | * {@link BooleanConstraintType } 88 | * 89 | */ 90 | public BooleanConstraintType getConstraint() { 91 | return constraint; 92 | } 93 | 94 | /** 95 | * Sets the value of the constraint property. 96 | * 97 | * @param value 98 | * allowed object is 99 | * {@link BooleanConstraintType } 100 | * 101 | */ 102 | public void setConstraint(BooleanConstraintType value) { 103 | this.constraint = value; 104 | } 105 | 106 | /** 107 | * Gets the value of the keyName property. 108 | * 109 | * @return 110 | * possible object is 111 | * {@link java.lang.String } 112 | * 113 | */ 114 | public java.lang.String getKeyName() { 115 | return keyName; 116 | } 117 | 118 | /** 119 | * Sets the value of the keyName property. 120 | * 121 | * @param value 122 | * allowed object is 123 | * {@link java.lang.String } 124 | * 125 | */ 126 | public void setKeyName(java.lang.String value) { 127 | this.keyName = value; 128 | } 129 | 130 | @Override 131 | public java.lang.String getValidation() { 132 | return " "; 133 | } 134 | 135 | @Override 136 | public List getDefaultValueList() { 137 | List values = new ArrayList<>(); 138 | if (defaultValue != null && defaultValue.value != null) { 139 | values.add(defaultValue.value.toString()); 140 | } else { 141 | values.add(""); 142 | } 143 | return values; 144 | } 145 | 146 | @Override 147 | public boolean isUserOrDeviceVariable() { 148 | return false; 149 | } 150 | 151 | @Override 152 | public java.lang.String getDefaultPresentationType() { 153 | return "checkbox"; 154 | } 155 | 156 | @Override 157 | public Options getOptions() { 158 | return null; 159 | } 160 | 161 | @Override 162 | public Object getPlistObject(java.lang.String[] submissions) { 163 | return submissions.length == 2 ? true : false; 164 | } 165 | 166 | } 167 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/BooleanConstraintType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlType; 15 | 16 | 17 | /** 18 | *

Java class for booleanConstraintType complex type. 19 | * 20 | *

The following schema fragment specifies the expected content contained within this class. 21 | * 22 | *

23 |  * <complexType name="booleanConstraintType">
24 |  *   <complexContent>
25 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 |  *       <attribute name="nullable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
27 |  *     </restriction>
28 |  *   </complexContent>
29 |  * </complexType>
30 |  * 
31 | * 32 | * 33 | */ 34 | @XmlAccessorType(XmlAccessType.FIELD) 35 | @XmlType(name = "booleanConstraintType") 36 | public class BooleanConstraintType { 37 | 38 | @XmlAttribute(name = "nullable") 39 | protected java.lang.Boolean nullable; 40 | 41 | /** 42 | * Gets the value of the nullable property. 43 | * 44 | * @return 45 | * possible object is 46 | * {@link java.lang.Boolean } 47 | * 48 | */ 49 | public java.lang.Boolean isNullable() { 50 | return nullable; 51 | } 52 | 53 | /** 54 | * Sets the value of the nullable property. 55 | * 56 | * @param value 57 | * allowed object is 58 | * {@link java.lang.Boolean } 59 | * 60 | */ 61 | public void setNullable(java.lang.Boolean value) { 62 | this.nullable = value; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/BooleanValueType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlType; 14 | 15 | 16 | /** 17 | *

Java class for booleanValueType complex type. 18 | * 19 | *

The following schema fragment specifies the expected content contained within this class. 20 | * 21 | *

22 |  * <complexType name="booleanValueType">
23 |  *   <complexContent>
24 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
25 |  *       <choice>
26 |  *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
27 |  *       </choice>
28 |  *     </restriction>
29 |  *   </complexContent>
30 |  * </complexType>
31 |  * 
32 | * 33 | * 34 | */ 35 | @XmlAccessorType(XmlAccessType.FIELD) 36 | @XmlType(name = "booleanValueType", propOrder = { 37 | "value" 38 | }) 39 | public class BooleanValueType { 40 | 41 | protected java.lang.Boolean value; 42 | 43 | /** 44 | * Gets the value of the value property. 45 | * 46 | * @return 47 | * possible object is 48 | * {@link java.lang.Boolean } 49 | * 50 | */ 51 | public java.lang.Boolean isValue() { 52 | return value; 53 | } 54 | 55 | /** 56 | * Sets the value of the value property. 57 | * 58 | * @param value 59 | * allowed object is 60 | * {@link java.lang.Boolean } 61 | * 62 | */ 63 | public void setValue(java.lang.Boolean value) { 64 | this.value = value; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Date.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.text.ParseException; 12 | import java.text.SimpleDateFormat; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import javax.xml.bind.annotation.XmlAccessType; 17 | import javax.xml.bind.annotation.XmlAccessorType; 18 | import javax.xml.bind.annotation.XmlAttribute; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | import javax.xml.bind.annotation.XmlType; 21 | 22 | import com.dd.plist.NSDate; 23 | import com.jamfsoftware.research.macingestor.MACDataType; 24 | 25 | 26 | /** 27 | *

Java class for anonymous complex type. 28 | * 29 | *

The following schema fragment specifies the expected content contained within this class. 30 | * 31 | *

 32 |  * <complexType>
 33 |  *   <complexContent>
 34 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 35 |  *       <sequence>
 36 |  *         <element name="defaultValue" type="{}dateValueType" minOccurs="0"/>
 37 |  *         <element name="constraint" type="{}dateConstraintType" minOccurs="0"/>
 38 |  *       </sequence>
 39 |  *       <attribute name="keyName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 40 |  *     </restriction>
 41 |  *   </complexContent>
 42 |  * </complexType>
 43 |  * 
44 | * 45 | * 46 | */ 47 | @XmlAccessorType(XmlAccessType.FIELD) 48 | @XmlType(name = "", propOrder = { 49 | "defaultValue", 50 | "constraint" 51 | }) 52 | @XmlRootElement(name = "date") 53 | public class Date implements MACDataType{ 54 | 55 | protected DateValueType defaultValue; 56 | protected DateConstraintType constraint; 57 | @XmlAttribute(name = "keyName", required = true) 58 | protected java.lang.String keyName; 59 | 60 | /** 61 | * Gets the value of the defaultValue property. 62 | * 63 | * @return 64 | * possible object is 65 | * {@link DateValueType } 66 | * 67 | */ 68 | public DateValueType getDefaultValue() { 69 | return defaultValue; 70 | } 71 | 72 | /** 73 | * Sets the value of the defaultValue property. 74 | * 75 | * @param value 76 | * allowed object is 77 | * {@link DateValueType } 78 | * 79 | */ 80 | public void setDefaultValue(DateValueType value) { 81 | this.defaultValue = value; 82 | } 83 | 84 | /** 85 | * Gets the value of the constraint property. 86 | * 87 | * @return 88 | * possible object is 89 | * {@link DateConstraintType } 90 | * 91 | */ 92 | public DateConstraintType getConstraint() { 93 | return constraint; 94 | } 95 | 96 | /** 97 | * Sets the value of the constraint property. 98 | * 99 | * @param value 100 | * allowed object is 101 | * {@link DateConstraintType } 102 | * 103 | */ 104 | public void setConstraint(DateConstraintType value) { 105 | this.constraint = value; 106 | } 107 | 108 | /** 109 | * Gets the value of the keyName property. 110 | * 111 | * @return 112 | * possible object is 113 | * {@link java.lang.String } 114 | * 115 | */ 116 | public java.lang.String getKeyName() { 117 | return keyName; 118 | } 119 | 120 | /** 121 | * Sets the value of the keyName property. 122 | * 123 | * @param value 124 | * allowed object is 125 | * {@link java.lang.String } 126 | * 127 | */ 128 | public void setKeyName(java.lang.String value) { 129 | this.keyName = value; 130 | } 131 | 132 | @Override 133 | public java.lang.String getValidation() { 134 | java.lang.String attributes = ""; 135 | 136 | if(constraint != null && constraint.isNullable() != null && !constraint.isNullable()){ 137 | attributes += "data-parsley-required=\"\" "; 138 | } 139 | 140 | if(constraint != null && constraint.getMin() != null){ 141 | attributes += "data-parsley-min=\"" + constraint.getMin() + "\" "; 142 | } 143 | 144 | if(constraint != null && constraint.getMax() != null){ 145 | attributes += "data-parsley-max=\"" + constraint.getMax() + "\" "; 146 | } 147 | 148 | 149 | return attributes; 150 | } 151 | 152 | @Override 153 | public List getDefaultValueList() { 154 | List date = new ArrayList(); 155 | if (defaultValue != null && defaultValue.getValue() != null) { 156 | date.add(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(defaultValue.getValue())); 157 | } else { 158 | date.add(""); 159 | } 160 | return date; 161 | } 162 | 163 | @Override 164 | public boolean isUserOrDeviceVariable() { 165 | return false; 166 | } 167 | 168 | @Override 169 | public java.lang.String getDefaultPresentationType() { 170 | return "datetime"; 171 | } 172 | 173 | @Override 174 | public Options getOptions() { 175 | return null; 176 | } 177 | 178 | @Override 179 | public Object getPlistObject(java.lang.String[] submissions) { 180 | System.out.println(submissions[0]); 181 | try { 182 | return new NSDate(submissions[0] + ":00Z"); 183 | } catch (ParseException e) { 184 | e.printStackTrace(); 185 | } 186 | 187 | return null; 188 | } 189 | 190 | } 191 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/DateAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jamfsoftware.research.macingestor.jaxb; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.time.format.DateTimeFormatter; 6 | import java.util.Arrays; 7 | import java.util.Date; 8 | import java.util.List; 9 | 10 | import javax.xml.bind.annotation.adapters.XmlAdapter; 11 | 12 | /** 13 | * DateAdapter is an {@link XmlAdapter} implementation that 14 | * (un)marshals dates between String and Date representations. 15 | * All date strings meet ISO 16 | * 8601 basic format. For example, June 16, 2011 16:46:01 GMT is 17 | * "20110616164601Z". Adapted from 18 | * http://blogs.oracle.com/CoreJavaTechTips/entry/exchanging_data_with_xml_and 19 | */ 20 | 21 | public class DateAdapter extends XmlAdapter { 22 | 23 | private java.lang.String[] formats = { 24 | "yyyy-MM-dd'T'HH:mm:ss'Z'", 25 | "yyyy-MM-dd'T'HH:mm'Z'", 26 | "yyyyMMdd'T'HHmmss'Z'", 27 | "yyyy-MM-dd"}; 28 | 29 | private SimpleDateFormat format; 30 | 31 | public DateAdapter() { 32 | format = new SimpleDateFormat(formats[0]); 33 | } 34 | 35 | @Override 36 | public java.lang.String marshal(Date d) { 37 | try { 38 | return format.format(d); 39 | } catch (Exception e) { 40 | return null; 41 | } 42 | } 43 | 44 | @Override 45 | public Date unmarshal(java.lang.String d) { 46 | for (java.lang.String f: formats) { 47 | try { 48 | return new SimpleDateFormat(f).parse(d); 49 | } catch(ParseException ignored) {} 50 | } 51 | return null; 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/DateConstraintType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlSchemaType; 15 | import javax.xml.bind.annotation.XmlType; 16 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 17 | import javax.xml.datatype.XMLGregorianCalendar; 18 | 19 | /** 20 | *

Java class for dateConstraintType complex type. 21 | * 22 | *

The following schema fragment specifies the expected content contained within this class. 23 | * 24 | *

 25 |  * <complexType name="dateConstraintType">
 26 |  *   <complexContent>
 27 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 28 |  *       <attribute name="max" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
 29 |  *       <attribute name="min" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
 30 |  *       <attribute name="nullable" type="{http://www.w3.org/2001/XMLSchema}boolean" />
 31 |  *     </restriction>
 32 |  *   </complexContent>
 33 |  * </complexType>
 34 |  * 
35 | * 36 | * 37 | */ 38 | @XmlAccessorType(XmlAccessType.FIELD) 39 | @XmlType(name = "dateConstraintType") 40 | public class DateConstraintType { 41 | 42 | @XmlJavaTypeAdapter(value = DateAdapter.class, type = java.util.Date.class) 43 | 44 | @XmlAttribute(name = "max") 45 | @XmlSchemaType(name = "dateTime") 46 | protected java.util.Date max; 47 | 48 | @XmlAttribute(name = "min") 49 | @XmlSchemaType(name = "dateTime") 50 | protected java.util.Date min; 51 | 52 | @XmlAttribute(name = "nullable") 53 | protected java.lang.Boolean nullable; 54 | 55 | /** 56 | * Gets the value of the max property. 57 | * 58 | * @return 59 | * possible object is 60 | * {@link XMLGregorianCalendar } 61 | * 62 | */ 63 | public java.util.Date getMax() { 64 | return max; 65 | } 66 | 67 | /** 68 | * Sets the value of the max property. 69 | * 70 | * @param value 71 | * allowed object is 72 | * {@link XMLGregorianCalendar } 73 | * 74 | */ 75 | public void setMax(java.util.Date value) { 76 | this.max = value; 77 | } 78 | 79 | /** 80 | * Gets the value of the min property. 81 | * 82 | * @return 83 | * possible object is 84 | * {@link XMLGregorianCalendar } 85 | * 86 | */ 87 | public java.util.Date getMin() { 88 | return min; 89 | } 90 | 91 | /** 92 | * Sets the value of the min property. 93 | * 94 | * @param value 95 | * allowed object is 96 | * {@link XMLGregorianCalendar } 97 | * 98 | */ 99 | public void setMin(java.util.Date value) { 100 | this.min = value; 101 | } 102 | 103 | /** 104 | * Gets the value of the nullable property. 105 | * 106 | * @return 107 | * possible object is 108 | * {@link java.lang.Boolean } 109 | * 110 | */ 111 | public java.lang.Boolean isNullable() { 112 | return nullable; 113 | } 114 | 115 | /** 116 | * Sets the value of the nullable property. 117 | * 118 | * @param value 119 | * allowed object is 120 | * {@link java.lang.Boolean } 121 | * 122 | */ 123 | public void setNullable(java.lang.Boolean value) { 124 | this.nullable = value; 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/DateValueType.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlSchemaType; 14 | import javax.xml.bind.annotation.XmlType; 15 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 16 | import javax.xml.datatype.XMLGregorianCalendar; 17 | 18 | /** 19 | *

Java class for dateValueType complex type. 20 | * 21 | *

The following schema fragment specifies the expected content contained within this class. 22 | * 23 | *

24 |  * <complexType name="dateValueType">
25 |  *   <complexContent>
26 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 |  *       <choice>
28 |  *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
29 |  *       </choice>
30 |  *     </restriction>
31 |  *   </complexContent>
32 |  * </complexType>
33 |  * 
34 | * 35 | * 36 | */ 37 | @XmlAccessorType(XmlAccessType.FIELD) 38 | @XmlType(name = "dateValueType", propOrder = { 39 | "value" 40 | }) 41 | public class DateValueType { 42 | @XmlJavaTypeAdapter(value = DateAdapter.class, type = java.util.Date.class) 43 | 44 | @XmlSchemaType(name = "dateTime") 45 | protected java.util.Date value; 46 | 47 | /** 48 | * Gets the value of the value property. 49 | * 50 | * @return 51 | * possible object is 52 | * {@link XMLGregorianCalendar } 53 | * 54 | */ 55 | public java.util.Date getValue() { 56 | return value; 57 | } 58 | 59 | /** 60 | * Sets the value of the value property. 61 | * 62 | * @param value 63 | * allowed object is 64 | * {@link XMLGregorianCalendar } 65 | * 66 | */ 67 | public void setValue(java.util.Date value) { 68 | this.value = value; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Description.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Locale; 14 | 15 | import javax.xml.bind.annotation.XmlAccessType; 16 | import javax.xml.bind.annotation.XmlAccessorType; 17 | import javax.xml.bind.annotation.XmlElement; 18 | import javax.xml.bind.annotation.XmlRootElement; 19 | import javax.xml.bind.annotation.XmlType; 20 | 21 | 22 | /** 23 | *

Java class for anonymous complex type. 24 | * 25 | *

The following schema fragment specifies the expected content contained within this class. 26 | * 27 | *

28 |  * <complexType>
29 |  *   <complexContent>
30 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
31 |  *       <sequence>
32 |  *         <element ref="{}language" maxOccurs="unbounded"/>
33 |  *       </sequence>
34 |  *     </restriction>
35 |  *   </complexContent>
36 |  * </complexType>
37 |  * 
38 | * 39 | * 40 | */ 41 | @XmlAccessorType(XmlAccessType.FIELD) 42 | @XmlType(name = "", propOrder = { 43 | "language" 44 | }) 45 | @XmlRootElement(name = "description") 46 | public class Description { 47 | 48 | @XmlElement(required = true) 49 | protected List language; 50 | 51 | /** 52 | * Gets the value of the language property. 53 | * 54 | *

55 | * This accessor method returns a reference to the live list, 56 | * not a snapshot. Therefore any modification you make to the 57 | * returned list will be present inside the JAXB object. 58 | * This is why there is not a set method for the language property. 59 | * 60 | *

61 | * For example, to add a new item, do as follows: 62 | *

63 |      *    getLanguage().add(newItem);
64 |      * 
65 | * 66 | * 67 | *

68 | * Objects of the following type(s) are allowed in the list 69 | * {@link Language } 70 | * 71 | * 72 | */ 73 | public List getLanguage() { 74 | if (language == null) { 75 | language = new ArrayList(); 76 | } 77 | return this.language; 78 | } 79 | 80 | public java.lang.String getDescription(Locale locale, java.lang.String defaultLocale){ 81 | return Language.getLanguageForLocale(locale, defaultLocale, language); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/DeviceVariable.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlRootElement; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | 18 | /** 19 | *

Java class for anonymous complex type. 20 | * 21 | *

The following schema fragment specifies the expected content contained within this class. 22 | * 23 | *

24 |  * <complexType>
25 |  *   <complexContent>
26 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 |  *       <attribute name="value" use="required">
28 |  *         <simpleType>
29 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
30 |  *             <enumeration value="iccid"/>
31 |  *             <enumeration value="imei"/>
32 |  *             <enumeration value="imsi"/>
33 |  *             <enumeration value="meid"/>
34 |  *             <enumeration value="model"/>
35 |  *             <enumeration value="phoneNumber"/>
36 |  *             <enumeration value="serialNumber"/>
37 |  *             <enumeration value="udid"/>
38 |  *             <enumeration value="wifiMacAddress"/>
39 |  *           </restriction>
40 |  *         </simpleType>
41 |  *       </attribute>
42 |  *     </restriction>
43 |  *   </complexContent>
44 |  * </complexType>
45 |  * 
46 | * 47 | * 48 | */ 49 | @XmlAccessorType(XmlAccessType.FIELD) 50 | @XmlType(name = "") 51 | @XmlRootElement(name = "deviceVariable") 52 | public class DeviceVariable { 53 | 54 | @XmlAttribute(name = "value", required = true) 55 | protected java.lang.String value; 56 | 57 | /** 58 | * Gets the value of the value property. 59 | * 60 | * @return 61 | * possible object is 62 | * {@link java.lang.String } 63 | * 64 | */ 65 | public java.lang.String getValue() { 66 | return value; 67 | } 68 | 69 | /** 70 | * Sets the value of the value property. 71 | * 72 | * @param value 73 | * allowed object is 74 | * {@link java.lang.String } 75 | * 76 | */ 77 | public void setValue(java.lang.String value) { 78 | this.value = value; 79 | } 80 | 81 | public java.lang.String getJSSVariableName(){ 82 | switch(value){ 83 | case "iccid": return "$ICCID"; 84 | case "imei": return "$IMEI"; 85 | case "imsi": return "$IMSI"; 86 | case "meid": return "MEID"; 87 | case "model": return "$MODEL"; 88 | case "phoneNumber": return "$PHONE"; 89 | case "serialNumber": return "$SERIALNUMBER"; 90 | case "udid": return "$UDID"; 91 | case "wifiMacAddress": return "$MACADDRESS"; 92 | default: return null; 93 | } 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Dict.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import javax.xml.bind.annotation.XmlAccessType; 14 | import javax.xml.bind.annotation.XmlAccessorType; 15 | import javax.xml.bind.annotation.XmlElement; 16 | import javax.xml.bind.annotation.XmlElements; 17 | import javax.xml.bind.annotation.XmlRootElement; 18 | import javax.xml.bind.annotation.XmlType; 19 | 20 | 21 | /** 22 | *

Java class for anonymous complex type. 23 | * 24 | *

The following schema fragment specifies the expected content contained within this class. 25 | * 26 | *

 27 |  * <complexType>
 28 |  *   <complexContent>
 29 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 30 |  *       <choice maxOccurs="unbounded">
 31 |  *         <element ref="{}string"/>
 32 |  *         <element ref="{}stringArray"/>
 33 |  *         <element ref="{}integer"/>
 34 |  *         <element ref="{}integerArray"/>
 35 |  *         <element ref="{}float"/>
 36 |  *         <element ref="{}floatArray"/>
 37 |  *         <element ref="{}date"/>
 38 |  *         <element ref="{}boolean"/>
 39 |  *       </choice>
 40 |  *     </restriction>
 41 |  *   </complexContent>
 42 |  * </complexType>
 43 |  * 
44 | * 45 | * 46 | */ 47 | @XmlAccessorType(XmlAccessType.FIELD) 48 | @XmlType(name = "", propOrder = { 49 | "stringOrStringArrayOrInteger" 50 | }) 51 | @XmlRootElement(name = "dict") 52 | public class Dict { 53 | 54 | @XmlElements({ 55 | @XmlElement(name = "string", type = String.class), 56 | @XmlElement(name = "stringArray", type = StringArray.class), 57 | @XmlElement(name = "integer", type = Integer.class), 58 | @XmlElement(name = "integerArray", type = IntegerArray.class), 59 | @XmlElement(name = "float", type = Float.class), 60 | @XmlElement(name = "floatArray", type = FloatArray.class), 61 | @XmlElement(name = "date", type = Date.class), 62 | @XmlElement(name = "boolean", type = Boolean.class) 63 | }) 64 | protected List stringOrStringArrayOrInteger; 65 | 66 | /** 67 | * Gets the value of the stringOrStringArrayOrInteger property. 68 | * 69 | *

70 | * This accessor method returns a reference to the live list, 71 | * not a snapshot. Therefore any modification you make to the 72 | * returned list will be present inside the JAXB object. 73 | * This is why there is not a set method for the stringOrStringArrayOrInteger property. 74 | * 75 | *

76 | * For example, to add a new item, do as follows: 77 | *

 78 |      *    getStringOrStringArrayOrInteger().add(newItem);
 79 |      * 
80 | * 81 | * 82 | *

83 | * Objects of the following type(s) are allowed in the list 84 | * {@link String } 85 | * {@link StringArray } 86 | * {@link Integer } 87 | * {@link IntegerArray } 88 | * {@link Float } 89 | * {@link FloatArray } 90 | * {@link Date } 91 | * {@link Boolean } 92 | * 93 | * 94 | */ 95 | public List getStringOrStringArrayOrInteger() { 96 | if (stringOrStringArrayOrInteger == null) { 97 | stringOrStringArrayOrInteger = new ArrayList(); 98 | } 99 | return this.stringOrStringArrayOrInteger; 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Field.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import javax.xml.bind.annotation.XmlAccessType; 12 | import javax.xml.bind.annotation.XmlAccessorType; 13 | import javax.xml.bind.annotation.XmlAttribute; 14 | import javax.xml.bind.annotation.XmlRootElement; 15 | import javax.xml.bind.annotation.XmlType; 16 | 17 | 18 | /** 19 | *

Java class for anonymous complex type. 20 | * 21 | *

The following schema fragment specifies the expected content contained within this class. 22 | * 23 | *

 24 |  * <complexType>
 25 |  *   <complexContent>
 26 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 27 |  *       <sequence>
 28 |  *         <element ref="{}label" minOccurs="0"/>
 29 |  *         <element ref="{}description" minOccurs="0"/>
 30 |  *         <element ref="{}options" minOccurs="0"/>
 31 |  *       </sequence>
 32 |  *       <attribute name="keyName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 33 |  *       <attribute name="type" use="required">
 34 |  *         <simpleType>
 35 |  *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 36 |  *             <enumeration value="input"/>
 37 |  *             <enumeration value="select"/>
 38 |  *             <enumeration value="multiselect"/>
 39 |  *             <enumeration value="checkbox"/>
 40 |  *             <enumeration value="hidden"/>
 41 |  *             <enumeration value="datetime"/>
 42 |  *             <enumeration value="list"/>
 43 |  *           </restriction>
 44 |  *         </simpleType>
 45 |  *       </attribute>
 46 |  *     </restriction>
 47 |  *   </complexContent>
 48 |  * </complexType>
 49 |  * 
50 | * 51 | * 52 | */ 53 | @XmlAccessorType(XmlAccessType.FIELD) 54 | @XmlType(name = "", propOrder = { 55 | "label", 56 | "description", 57 | "options" 58 | }) 59 | @XmlRootElement(name = "field") 60 | public class Field { 61 | 62 | protected Label label; 63 | protected Description description; 64 | protected Options options; 65 | @XmlAttribute(name = "keyName", required = true) 66 | protected java.lang.String keyName; 67 | @XmlAttribute(name = "type", required = true) 68 | protected java.lang.String type; 69 | 70 | /** 71 | * 72 | * The display name on the EMM service admin console of the UI control 73 | * for the configuration setting. 74 | * 75 | * 76 | * @return 77 | * possible object is 78 | * {@link Label } 79 | * 80 | */ 81 | public Label getLabel() { 82 | return label; 83 | } 84 | 85 | /** 86 | * Sets the value of the label property. 87 | * 88 | * @param value 89 | * allowed object is 90 | * {@link Label } 91 | * 92 | */ 93 | public void setLabel(Label value) { 94 | this.label = value; 95 | } 96 | 97 | /** 98 | * Gets the value of the description property. 99 | * 100 | * @return 101 | * possible object is 102 | * {@link Description } 103 | * 104 | */ 105 | public Description getDescription() { 106 | return description; 107 | } 108 | 109 | /** 110 | * Sets the value of the description property. 111 | * 112 | * @param value 113 | * allowed object is 114 | * {@link Description } 115 | * 116 | */ 117 | public void setDescription(Description value) { 118 | this.description = value; 119 | } 120 | 121 | /** 122 | * Gets the value of the options property. 123 | * 124 | * @return 125 | * possible object is 126 | * {@link Options } 127 | * 128 | */ 129 | public Options getOptions() { 130 | return options; 131 | } 132 | 133 | /** 134 | * Sets the value of the options property. 135 | * 136 | * @param value 137 | * allowed object is 138 | * {@link Options } 139 | * 140 | */ 141 | public void setOptions(Options value) { 142 | this.options = value; 143 | } 144 | 145 | /** 146 | * Gets the value of the keyName property. 147 | * 148 | * @return 149 | * possible object is 150 | * {@link java.lang.String } 151 | * 152 | */ 153 | public java.lang.String getKeyName() { 154 | return keyName; 155 | } 156 | 157 | /** 158 | * Sets the value of the keyName property. 159 | * 160 | * @param value 161 | * allowed object is 162 | * {@link java.lang.String } 163 | * 164 | */ 165 | public void setKeyName(java.lang.String value) { 166 | this.keyName = value; 167 | } 168 | 169 | /** 170 | * Gets the value of the type property. 171 | * 172 | * @return 173 | * possible object is 174 | * {@link java.lang.String } 175 | * 176 | */ 177 | public java.lang.String getType() { 178 | return type; 179 | } 180 | 181 | /** 182 | * Sets the value of the type property. 183 | * 184 | * @param value 185 | * allowed object is 186 | * {@link java.lang.String } 187 | * 188 | */ 189 | public void setType(java.lang.String value) { 190 | this.type = value; 191 | } 192 | 193 | } 194 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/FieldGroup.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Locale; 14 | 15 | import javax.xml.bind.annotation.XmlAccessType; 16 | import javax.xml.bind.annotation.XmlAccessorType; 17 | import javax.xml.bind.annotation.XmlElement; 18 | import javax.xml.bind.annotation.XmlRootElement; 19 | import javax.xml.bind.annotation.XmlType; 20 | 21 | 22 | /** 23 | *

Java class for anonymous complex type. 24 | * 25 | *

The following schema fragment specifies the expected content contained within this class. 26 | * 27 | *

 28 |  * <complexType>
 29 |  *   <complexContent>
 30 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 31 |  *       <sequence>
 32 |  *         <element name="name">
 33 |  *           <complexType>
 34 |  *             <complexContent>
 35 |  *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 36 |  *                 <sequence>
 37 |  *                   <element ref="{}language" maxOccurs="unbounded"/>
 38 |  *                 </sequence>
 39 |  *               </restriction>
 40 |  *             </complexContent>
 41 |  *           </complexType>
 42 |  *         </element>
 43 |  *         <element ref="{}field" maxOccurs="unbounded"/>
 44 |  *       </sequence>
 45 |  *     </restriction>
 46 |  *   </complexContent>
 47 |  * </complexType>
 48 |  * 
49 | * 50 | * 51 | */ 52 | @XmlAccessorType(XmlAccessType.FIELD) 53 | @XmlType(name = "", propOrder = { 54 | "name", 55 | "field" 56 | }) 57 | @XmlRootElement(name = "fieldGroup") 58 | public class FieldGroup { 59 | 60 | @XmlElement(required = true) 61 | protected FieldGroup.Name name; 62 | @XmlElement(required = true) 63 | protected List field; 64 | 65 | /** 66 | * Gets the value of the name property. 67 | * 68 | * @return 69 | * possible object is 70 | * {@link FieldGroup.Name } 71 | * 72 | */ 73 | public FieldGroup.Name getName() { 74 | return name; 75 | } 76 | 77 | /** 78 | * Sets the value of the name property. 79 | * 80 | * @param value 81 | * allowed object is 82 | * {@link FieldGroup.Name } 83 | * 84 | */ 85 | public void setName(FieldGroup.Name value) { 86 | this.name = value; 87 | } 88 | 89 | /** 90 | * Gets the value of the field property. 91 | * 92 | *

93 | * This accessor method returns a reference to the live list, 94 | * not a snapshot. Therefore any modification you make to the 95 | * returned list will be present inside the JAXB object. 96 | * This is why there is not a set method for the field property. 97 | * 98 | *

99 | * For example, to add a new item, do as follows: 100 | *

101 |      *    getField().add(newItem);
102 |      * 
103 | * 104 | * 105 | *

106 | * Objects of the following type(s) are allowed in the list 107 | * {@link Field } 108 | * 109 | * 110 | */ 111 | public List getField() { 112 | if (field == null) { 113 | field = new ArrayList(); 114 | } 115 | return this.field; 116 | } 117 | 118 | public java.lang.String getType(){ 119 | return "fieldgroup"; 120 | } 121 | 122 | /** 123 | *

Java class for anonymous complex type. 124 | * 125 | *

The following schema fragment specifies the expected content contained within this class. 126 | * 127 | *

128 |      * <complexType>
129 |      *   <complexContent>
130 |      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
131 |      *       <sequence>
132 |      *         <element ref="{}language" maxOccurs="unbounded"/>
133 |      *       </sequence>
134 |      *     </restriction>
135 |      *   </complexContent>
136 |      * </complexType>
137 |      * 
138 | * 139 | * 140 | */ 141 | @XmlAccessorType(XmlAccessType.FIELD) 142 | @XmlType(name = "", propOrder = { 143 | "language" 144 | }) 145 | public static class Name { 146 | 147 | @XmlElement(required = true) 148 | protected List language; 149 | 150 | /** 151 | * Gets the value of the language property. 152 | * 153 | *

154 | * This accessor method returns a reference to the live list, 155 | * not a snapshot. Therefore any modification you make to the 156 | * returned list will be present inside the JAXB object. 157 | * This is why there is not a set method for the language property. 158 | * 159 | *

160 | * For example, to add a new item, do as follows: 161 | *

162 |          *    getLanguage().add(newItem);
163 |          * 
164 | * 165 | * 166 | *

167 | * Objects of the following type(s) are allowed in the list 168 | * {@link Language } 169 | * 170 | * 171 | */ 172 | public List getLanguage() { 173 | if (language == null) { 174 | language = new ArrayList(); 175 | } 176 | return this.language; 177 | } 178 | 179 | public java.lang.String getName(Locale locale, java.lang.String defaultLocale){ 180 | for(Language l : language ){ 181 | if(l.getValueAttribute().equals(locale.toLanguageTag())){ 182 | return l.getValue(); 183 | } 184 | } 185 | 186 | for(Language l : language ){ 187 | if(l.getValueAttribute().equals(locale.getLanguage())){ 188 | return l.getValue(); 189 | } 190 | } 191 | 192 | for(Language l : language ){ 193 | if(l.getValueAttribute().equals(locale.getLanguage())){ 194 | return l.getValue(); 195 | } 196 | } 197 | 198 | return language.get(0).getValue(); 199 | } 200 | 201 | } 202 | 203 | } 204 | -------------------------------------------------------------------------------- /src/main/java/com/jamfsoftware/research/macingestor/jaxb/Float.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 3 | // See http://java.sun.com/xml/jaxb 4 | // Any modifications to this file will be lost upon recompilation of the source schema. 5 | // Generated on: 2016.03.17 at 09:04:29 AM CDT 6 | // 7 | 8 | 9 | package com.jamfsoftware.research.macingestor.jaxb; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import javax.xml.bind.annotation.XmlAccessType; 15 | import javax.xml.bind.annotation.XmlAccessorType; 16 | import javax.xml.bind.annotation.XmlAttribute; 17 | import javax.xml.bind.annotation.XmlRootElement; 18 | import javax.xml.bind.annotation.XmlType; 19 | 20 | import com.jamfsoftware.research.macingestor.MACDataType; 21 | import com.jamfsoftware.research.macingestor.jaxb.Options.Option; 22 | 23 | 24 | /** 25 | *

Java class for anonymous complex type. 26 | * 27 | *

The following schema fragment specifies the expected content contained within this class. 28 | * 29 | *

 30 |  * <complexType>
 31 |  *   <complexContent>
 32 |  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 33 |  *       <sequence>
 34 |  *         <element name="defaultValue" type="{}floatValueType" minOccurs="0"/>
 35 |  *         <element name="constraint" type="{}floatConstraintType" minOccurs="0"/>
 36 |  *       </sequence>
 37 |  *       <attribute name="keyName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
 38 |  *     </restriction>
 39 |  *   </complexContent>
 40 |  * </complexType>
 41 |  * 
42 | * 43 | * 44 | */ 45 | @XmlAccessorType(XmlAccessType.FIELD) 46 | @XmlType(name = "", propOrder = { 47 | "defaultValue", 48 | "constraint" 49 | }) 50 | @XmlRootElement(name = "float") 51 | public class Float implements MACDataType{ 52 | 53 | protected FloatValueType defaultValue; 54 | protected FloatConstraintType constraint; 55 | @XmlAttribute(name = "keyName", required = true) 56 | protected java.lang.String keyName; 57 | 58 | /** 59 | * Gets the value of the defaultValue property. 60 | * 61 | * @return 62 | * possible object is 63 | * {@link FloatValueType } 64 | * 65 | */ 66 | public FloatValueType getDefaultValue() { 67 | return defaultValue; 68 | } 69 | 70 | /** 71 | * Sets the value of the defaultValue property. 72 | * 73 | * @param value 74 | * allowed object is 75 | * {@link FloatValueType } 76 | * 77 | */ 78 | public void setDefaultValue(FloatValueType value) { 79 | this.defaultValue = value; 80 | } 81 | 82 | /** 83 | * Gets the value of the constraint property. 84 | * 85 | * @return 86 | * possible object is 87 | * {@link FloatConstraintType } 88 | * 89 | */ 90 | public FloatConstraintType getConstraint() { 91 | return constraint; 92 | } 93 | 94 | /** 95 | * Sets the value of the constraint property. 96 | * 97 | * @param value 98 | * allowed object is 99 | * {@link FloatConstraintType } 100 | * 101 | */ 102 | public void setConstraint(FloatConstraintType value) { 103 | this.constraint = value; 104 | } 105 | 106 | /** 107 | * Gets the value of the keyName property. 108 | * 109 | * @return 110 | * possible object is 111 | * {@link java.lang.String } 112 | * 113 | */ 114 | public java.lang.String getKeyName() { 115 | return keyName; 116 | } 117 | 118 | /** 119 | * Sets the value of the keyName property. 120 | * 121 | * @param value 122 | * allowed object is 123 | * {@link java.lang.String } 124 | * 125 | */ 126 | public void setKeyName(java.lang.String value) { 127 | this.keyName = value; 128 | } 129 | 130 | @Override 131 | public java.lang.String getValidation() { 132 | java.lang.String attributes = "pattern=\"(([1-9][0-9]*\\.?[0-9]*)|(\\.[0-9]+))([Ee][+-]?[0-9]+)?\" "; 133 | 134 | if(constraint != null && constraint.isNullable() != null && !constraint.isNullable()){ 135 | attributes += "data-parsley-required=\"\" "; 136 | } 137 | 138 | 139 | if(constraint != null && constraint.getMin() != null){ 140 | attributes += "data-parsley-min=\"" + constraint.getMin() + "\" "; 141 | } 142 | 143 | if(constraint != null && constraint.getMax() != null){ 144 | attributes += "data-parsley-max=\"" + constraint.getMax() + "\" "; 145 | } 146 | 147 | attributes += "data-parsley-validate-if-empty "; 148 | 149 | return attributes; 150 | } 151 | 152 | @Override 153 | public List getDefaultValueList() { 154 | try { 155 | List defaults = new ArrayList(); 156 | if (defaultValue != null && defaultValue.getValue() != null) { 157 | defaults.add(defaultValue.getValue().toString()); 158 | } else { 159 | defaults.add(""); 160 | } 161 | return defaults; 162 | } catch (Exception e){ 163 | return null; 164 | } 165 | } 166 | 167 | @Override 168 | public boolean isUserOrDeviceVariable() { 169 | return false; 170 | } 171 | 172 | @Override 173 | public java.lang.String getDefaultPresentationType() { 174 | if(constraint != null && constraint.values != null) { 175 | return "select"; 176 | } 177 | 178 | return "input"; 179 | } 180 | 181 | @Override 182 | public Options getOptions() { 183 | try { 184 | Options options = new Options(); 185 | options.option = new ArrayList