From d080db57e55e267c87578787e4b7972525d0f53d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 30 Jan 2012 09:47:41 +0000 Subject: [PATCH] proxy connector screen add PolicyInformation bean git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1237581 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-rest/archiva-rest-api/pom.xml | 5 + .../rest/api/model/PolicyInformation.java | 104 ++++++++++++++++ .../webapp/js/archiva/proxy-connectors.js | 111 +++++++++++++++++- 3 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PolicyInformation.java diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml index 1c6ab9312..d28c32ed1 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml @@ -38,9 +38,14 @@ org.apache.archiva archiva-repository-admin-api + + + org.apache.archiva + archiva-policies + org.codehaus.redback redback-authorization-api diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PolicyInformation.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PolicyInformation.java new file mode 100644 index 000000000..1702a53a9 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/PolicyInformation.java @@ -0,0 +1,104 @@ +package org.apache.archiva.rest.api.model; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +/** + * @author Olivier Lamy + * @since 1.4-M3 + */ +@XmlRootElement( name = "policyInformation" ) +public class PolicyInformation +{ + private List options; + + private String defaultOption; + + private String id; + + private String name; + + public PolicyInformation() + { + // no op + } + + public PolicyInformation( List options, String defaultOption, String id, String name ) + { + this.options = options; + this.defaultOption = defaultOption; + this.id = id; + this.name = name; + } + + public List getOptions() + { + return options; + } + + public void setOptions( List options ) + { + this.options = options; + } + + public String getDefaultOption() + { + return defaultOption; + } + + public void setDefaultOption( String defaultOption ) + { + this.defaultOption = defaultOption; + } + + public String getId() + { + return id; + } + + public void setId( String id ) + { + this.id = id; + } + + public String getName() + { + return name; + } + + public void setName( String name ) + { + this.name = name; + } + + @Override + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append( "PolicyInformation" ); + sb.append( "{options=" ).append( options ); + sb.append( ", defaultOption='" ).append( defaultOption ).append( '\'' ); + sb.append( ", id='" ).append( id ).append( '\'' ); + sb.append( ", name='" ).append( name ).append( '\'' ); + sb.append( '}' ); + return sb.toString(); + } +} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js index e608884de..4f253262f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js @@ -31,9 +31,9 @@ $(function() { //private List whiteListPatterns; this.whiteListPatterns=ko.observableArray(whiteListPatterns); //private Map policies; - + this.policies=ko.observable(policies); //private Map properties; - + this.properties=ko.observable(properties); //private boolean disabled = false; this.disabled=ko.observable(disabled); //private int order = 0; @@ -43,6 +43,113 @@ $(function() { displayProxyConnectors=function(){ $("#main-content").html($("#proxyConnectorsMain").tmpl()); $("#main-content").append(smallSpinnerImg()); + PolicyInformation=function(options,defaultOption,id,name){ + //private List options; + this.options=ko.observableArray(options); + //private String defaultOption; + this.defaultOption=ko.observable(defaultOption); + //private String id; + this.id=ko.observable(id); + //private String name; + this.name=ko.observable(name); + } + + ProxyConnectorsViewModel=function(){ + this.proxyConnectors=ko.observableArray([]); + var self=this; + + editProxyConnector=function(proxyConnector){ + + } + + this.displayGrid=function(){ + var sourcesRepos=[]; + //sourceRepoId + for(i=0;i