hexsha
stringlengths
40
40
size
int64
8
1.04M
content
stringlengths
8
1.04M
avg_line_length
float64
2.24
100
max_line_length
int64
4
1k
alphanum_fraction
float64
0.25
0.97
3e91389c6ea7eda7ca44bc9709744e6eca2736b0
695
package de.patgrosse.asyncfoldercompare.matcher.files; import de.patgrosse.asyncfoldercompare.constants.MatchStrategy; import de.patgrosse.asyncfoldercompare.entities.filesystem.real.RealFile; public class CharactersContainsFileMatcher extends SingleFileMatcher { public CharactersContainsFileMatcher() { super("CharactersSameFileMatcher", MatchStrategy.ONCE); } @Override public boolean filesMatch(RealFile oldFile, RealFile newFile) { String charsOld = oldFile.getName().replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); String charsNew = newFile.getName().replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); return charsOld.equals(charsNew); } }
36.578947
89
0.741007
ec69e709b17c6438bbb06f306ef6a37a9bd491f1
2,014
package com.lagou.springsecurity.config; import com.lagou.springsecurity.authentication.filter.CustomAuthenticationFilter; import com.lagou.springsecurity.authentication.provider.AuthCodeAuthenticationProvider; import com.lagou.springsecurity.authentication.provider.UsernamePasswordAuthenticationProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private CustomAuthenticationFilter initialAuthenticationFilter; @Autowired private AuthCodeAuthenticationProvider authCodeAuthenticationProvider; @Autowired private UsernamePasswordAuthenticationProvider usernamePasswordAuthenticationProvider; @Override protected void configure(AuthenticationManagerBuilder auth) { auth.authenticationProvider(authCodeAuthenticationProvider) .authenticationProvider(usernamePasswordAuthenticationProvider); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.addFilterAt( initialAuthenticationFilter, BasicAuthenticationFilter.class); http.authorizeRequests() .anyRequest().authenticated(); } @Override @Bean protected AuthenticationManager authenticationManager() throws Exception { return super.authenticationManager(); } }
38
107
0.807349
be2e2dadfdd3cca21f6d883c16361a0c9ee0f0e1
2,767
package com.y2w.uikit.utils; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; /** * 目前还没有提供自定义优先级的线程池 * 定义三个线程池 * 执行优先级分别是executUI > executNet > executLow * * @author maie * */ public class ThreadPool { private ExecutorService uiExecutorService; private ExecutorService netExecutorService; private ExecutorService lowExecutorService; private final int maxThreadNum = 5; private static ThreadPool threadPool; private ThreadPool(){ } public static ThreadPool getThreadPool(){ if(threadPool == null){ threadPool = new ThreadPool(); } return threadPool; } private void initNetExecutorService(){ if(netExecutorService == null){ ThreadFactory factory = new ThreadFactory() { @Override public Thread newThread(Runnable arg0) { Thread thread = new Thread(arg0); thread.setPriority(Thread.NORM_PRIORITY - 1); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_FOREGROUND + 2); return thread; } }; netExecutorService = Executors.newFixedThreadPool(maxThreadNum,factory); } } /** * 主要用于网络请求 * * @param netRunable */ public void executNet(Runnable netRunable){ if(netRunable == null){ return; } initNetExecutorService(); netExecutorService.submit(netRunable); } private void initUIExecutorService(){ if(uiExecutorService == null){ ThreadFactory factory = new ThreadFactory() { @Override public Thread newThread(Runnable arg0) { Thread thread = new Thread(arg0); thread.setPriority(Thread.NORM_PRIORITY + 1); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_FOREGROUND + 1); return thread; } }; uiExecutorService = Executors.newFixedThreadPool(maxThreadNum,factory); } } /** * 不是android 的UI线程,只是标识优先级高于其他线程池,主要用于做快速的UI变更和本地的操作 * * @param uiRunable */ public void executUI(Runnable uiRunable){ if(uiRunable == null){ return; } initUIExecutorService(); uiExecutorService.submit(uiRunable); } private void initLowExecutorService(){ if(lowExecutorService == null){ ThreadFactory factory = new ThreadFactory() { @Override public Thread newThread(Runnable arg0) { Thread thread = new Thread(arg0); thread.setPriority(Thread.NORM_PRIORITY - 2); android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND); return thread; } }; lowExecutorService = Executors.newFixedThreadPool(maxThreadNum,factory); } } /** * 用于优先级低的线程操作 * * @param lowRunable */ public void executLow(Runnable lowRunable){ if(lowRunable == null){ return; } initLowExecutorService(); lowExecutorService.submit(lowRunable); } }
22.680328
93
0.721359
38cd7cee559f5c8ddd728e8304eb48f14d667b72
12,241
package com.benayn.ustyle.base; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; import com.benayn.ustyle.Randoms; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; public class Domain { private Map<String, Integer> mStrInt; private Map<Long, Boolean> mLongBool; private Set<Domain> sDomains; private Set<Float> sFloats; private List<String> lStrs; private List<Map<String, Set<Integer>>> complex; private EnumType enum4Test; private BigDecimal bigDecimal; private BigInteger bigInteger; private Date date; private String string; private Long longa; private Long[] longaArr; private long longp; private long[] longpArr; private Integer integera; private Integer[] integeraArr; private int integerp; private int[] integerpArr; private Short shorta; private Short[] shortaArr; private short shortp; private short[] shortpArr; private Byte bytea; private Byte[] byteaArr; private byte bytep; private byte[] bytepArr; private Double doublea; private Double[] doubleaArr; private double doublep; private double[] doublepArr; private Float floata; private Float[] floataArr; private float floatp; private float[] floatpArr; private Boolean booleana; private Boolean[] booleanaArr; private boolean booleanp; private boolean[] booleanpArr; private Character charactera; private Character[] characteraArr; private char characterp; private char characterpArr; private Map<List<Map<String, Set<Integer>>>, Set<List<Map<String, Set<Integer>>>>> prop; public Map<List<Map<String, Set<Integer>>>, Set<List<Map<String, Set<Integer>>>>> getProp() { return prop; } public void setProp( Map<List<Map<String, Set<Integer>>>, Set<List<Map<String, Set<Integer>>>>> prop) { this.prop = prop; } public static Domain getDomain() { Domain d = Randoms.get(Domain.class); Set<Domain> sDomains = Sets.newHashSet(); for (int i = 0; i < 3; i++) { sDomains.add(Randoms.<Domain>get(Domain.class)); } d.setsDomains(sDomains); List<Map<String, Set<Integer>>> l = Lists.newLinkedList(); Set<Integer> s1 = Sets.newHashSet(); for (int i = 0; i < 5; i++) { s1.add((Integer) Randoms.get(Integer.class)); } Map<String, Set<Integer>> m = Maps.newLinkedHashMap(); m.put("m1", s1); l.add(m); d.setComplex(l); return d; } public static Map<String, Object> getProps() { Map<String, Object> m = Maps.newLinkedHashMap(); m.put("date", "2012-3-18 11:11:11"); m.put("string", 11); m.put("longa", "33"); m.put("longp", "3"); m.put("integera", "22"); m.put("integerp", 22); m.put("shorta", "11"); m.put("shortp", "11"); m.put("bytea", 10); m.put("bytep", 10); m.put("doublea", "88.88"); m.put("doublep", 88.8); m.put("floata", 99.33); m.put("floatp", "99.9"); m.put("booleana", "false"); m.put("booleanp", Boolean.TRUE); m.put("charactera", "a"); m.put("characterp", 3); return m; } public Set<Domain> getsDomains() { return sDomains; } public void setsDomains(Set<Domain> sDomains) { this.sDomains = sDomains; } public Set<Float> getsFloats() { return sFloats; } public void setsFloats(Set<Float> sFloats) { this.sFloats = sFloats; } public List<String> getlStrs() { return lStrs; } public void setlStrs(List<String> lStrs) { this.lStrs = lStrs; } public List<Map<String, Set<Integer>>> getComplex() { return complex; } public void setComplex(List<Map<String, Set<Integer>>> complex) { this.complex = complex; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public String getString() { return string; } public void setString(String string) { this.string = string; } public Long getLonga() { return longa; } public void setLonga(Long longa) { this.longa = longa; } public long getLongp() { return longp; } public void setLongp(long longp) { this.longp = longp; } public Integer getIntegera() { return integera; } public void setIntegera(Integer integera) { this.integera = integera; } public int getIntegerp() { return integerp; } public void setIntegerp(int integerp) { this.integerp = integerp; } public Short getShorta() { return shorta; } public void setShorta(Short shorta) { this.shorta = shorta; } public short getShortp() { return shortp; } public void setShortp(short shortp) { this.shortp = shortp; } public Byte getBytea() { return bytea; } public void setBytea(Byte bytea) { this.bytea = bytea; } public byte getBytep() { return bytep; } public void setBytep(byte bytep) { this.bytep = bytep; } public Double getDoublea() { return doublea; } public void setDoublea(Double doublea) { this.doublea = doublea; } public double getDoublep() { return doublep; } public void setDoublep(double doublep) { this.doublep = doublep; } public Float getFloata() { return floata; } public void setFloata(Float floata) { this.floata = floata; } public float getFloatp() { return floatp; } public void setFloatp(float floatp) { this.floatp = floatp; } public Boolean getBooleana() { return booleana; } public void setBooleana(Boolean booleana) { this.booleana = booleana; } public boolean isBooleanp() { return booleanp; } public void setBooleanp(boolean booleanp) { this.booleanp = booleanp; } public Character getCharactera() { return charactera; } public void setCharactera(Character charactera) { this.charactera = charactera; } public char getCharacterp() { return characterp; } public void setCharacterp(char characterp) { this.characterp = characterp; } public Map<String, Integer> getmStrInt() { return mStrInt; } public void setmStrInt(Map<String, Integer> mStrInt) { this.mStrInt = mStrInt; } public Map<Long, Boolean> getmLongBool() { return mLongBool; } public void setmLongBool(Map<Long, Boolean> mLongBool) { this.mLongBool = mLongBool; } public EnumType getEnum4Test() { return enum4Test; } public void setEnum4Test(EnumType enum4Test) { this.enum4Test = enum4Test; } public BigDecimal getBigDecimal() { return bigDecimal; } public void setBigDecimal(BigDecimal bigDecimal) { this.bigDecimal = bigDecimal; } public BigInteger getBigInteger() { return bigInteger; } public void setBigInteger(BigInteger bigInteger) { this.bigInteger = bigInteger; } public Long[] getLongaArr() { return longaArr; } public void setLongaArr(Long[] longaArr) { this.longaArr = longaArr; } public long[] getLongpArr() { return longpArr; } public void setLongpArr(long[] longpArr) { this.longpArr = longpArr; } public Integer[] getIntegeraArr() { return integeraArr; } public void setIntegeraArr(Integer[] integeraArr) { this.integeraArr = integeraArr; } public int[] getIntegerpArr() { return integerpArr; } public void setIntegerpArr(int[] integerpArr) { this.integerpArr = integerpArr; } public Short[] getShortaArr() { return shortaArr; } public void setShortaArr(Short[] shortaArr) { this.shortaArr = shortaArr; } public short[] getShortpArr() { return shortpArr; } public void setShortpArr(short[] shortpArr) { this.shortpArr = shortpArr; } public Byte[] getByteaArr() { return byteaArr; } public void setByteaArr(Byte[] byteaArr) { this.byteaArr = byteaArr; } public byte[] getBytepArr() { return bytepArr; } public void setBytepArr(byte[] bytepArr) { this.bytepArr = bytepArr; } public Double[] getDoubleaArr() { return doubleaArr; } public void setDoubleaArr(Double[] doubleaArr) { this.doubleaArr = doubleaArr; } public double[] getDoublepArr() { return doublepArr; } public void setDoublepArr(double[] doublepArr) { this.doublepArr = doublepArr; } public Float[] getFloataArr() { return floataArr; } public void setFloataArr(Float[] floataArr) { this.floataArr = floataArr; } public float[] getFloatpArr() { return floatpArr; } public void setFloatpArr(float[] floatpArr) { this.floatpArr = floatpArr; } public Boolean[] getBooleanaArr() { return booleanaArr; } public void setBooleanaArr(Boolean[] booleanaArr) { this.booleanaArr = booleanaArr; } public boolean[] getBooleanpArr() { return booleanpArr; } public void setBooleanpArr(boolean[] booleanpArr) { this.booleanpArr = booleanpArr; } public Character[] getCharacteraArr() { return characteraArr; } public void setCharacteraArr(Character[] characteraArr) { this.characteraArr = characteraArr; } public char getCharacterpArr() { return characterpArr; } public void setCharacterpArr(char characterpArr) { this.characterpArr = characterpArr; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((booleana == null) ? 0 : booleana.hashCode()); result = prime * result + (booleanp ? 1231 : 1237); result = prime * result + ((bytea == null) ? 0 : bytea.hashCode()); result = prime * result + bytep; result = prime * result + ((charactera == null) ? 0 : charactera.hashCode()); result = prime * result + characterp; result = prime * result + ((date == null) ? 0 : date.hashCode()); result = prime * result + ((doublea == null) ? 0 : doublea.hashCode()); long temp; temp = Double.doubleToLongBits(doublep); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((floata == null) ? 0 : floata.hashCode()); result = prime * result + Float.floatToIntBits(floatp); result = prime * result + ((integera == null) ? 0 : integera.hashCode()); result = prime * result + integerp; result = prime * result + ((longa == null) ? 0 : longa.hashCode()); result = prime * result + (int) (longp ^ (longp >>> 32)); result = prime * result + ((shorta == null) ? 0 : shorta.hashCode()); result = prime * result + shortp; result = prime * result + ((string == null) ? 0 : string.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Domain other = (Domain) obj; if (booleana == null) { if (other.booleana != null) return false; } else if (!booleana.equals(other.booleana)) return false; if (booleanp != other.booleanp) return false; if (bytea == null) { if (other.bytea != null) return false; } else if (!bytea.equals(other.bytea)) return false; if (bytep != other.bytep) return false; if (charactera == null) { if (other.charactera != null) return false; } else if (!charactera.equals(other.charactera)) return false; if (characterp != other.characterp) return false; if (date == null) { if (other.date != null) return false; } else if (!date.equals(other.date)) return false; if (doublea == null) { if (other.doublea != null) return false; } else if (!doublea.equals(other.doublea)) return false; if (Double.doubleToLongBits(doublep) != Double .doubleToLongBits(other.doublep)) return false; if (floata == null) { if (other.floata != null) return false; } else if (!floata.equals(other.floata)) return false; if (Float.floatToIntBits(floatp) != Float.floatToIntBits(other.floatp)) return false; if (integera == null) { if (other.integera != null) return false; } else if (!integera.equals(other.integera)) return false; if (integerp != other.integerp) return false; if (longa == null) { if (other.longa != null) return false; } else if (!longa.equals(other.longa)) return false; if (longp != other.longp) return false; if (shorta == null) { if (other.shorta != null) return false; } else if (!shorta.equals(other.shorta)) return false; if (shortp != other.shortp) return false; if (string == null) { if (other.string != null) return false; } else if (!string.equals(other.string)) return false; return true; } }
20.03437
94
0.672412
e8dd4cc6f8e0e50d20185e83f15b0edf28d890ec
3,404
package com.eva.api.system; import com.eva.api.BaseController; import com.eva.biz.system.SystemMenuBiz; import com.eva.core.annotation.pr.PreventRepeat; import com.eva.core.model.ApiResponse; import com.eva.core.constants.OperaType; import com.eva.dao.system.dto.UpdateSystemMenuSortDTO; import com.eva.dao.system.model.SystemMenu; import com.eva.dao.system.vo.SystemMenuListVO; import com.eva.dao.system.vo.SystemMenuNodeVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** * @author Eva.Caesar Liu * @date 2021/07/13 22:37 */ @Api(tags = "系统菜单") @RestController @RequestMapping("/system/menu") public class SystemMenuController extends BaseController { @Autowired private SystemMenuBiz systemMenuBiz; @ApiOperation("菜单排序") @PostMapping("/updateSort") @RequiresPermissions("system:menu:sort") public ApiResponse updateSort (@Validated @RequestBody UpdateSystemMenuSortDTO dto) { systemMenuBiz.updateSort(dto); return ApiResponse.success(null); } @ApiOperation("查询菜单树") @GetMapping("/treeNodes") public ApiResponse<List<SystemMenuNodeVO>> getTreeMenu () { return ApiResponse.success(systemMenuBiz.findTree(this.getLoginUser().getId())); } @ApiOperation("查询列表树") @PostMapping("/treeList") @RequiresPermissions("system:menu:query") public ApiResponse<List<SystemMenuListVO>> findTree () { return ApiResponse.success(systemMenuBiz.findTree()); } @PreventRepeat @ApiOperation("新建") @PostMapping("/create") @RequiresPermissions("system:menu:create") public ApiResponse create(@Validated(OperaType.Create.class) @RequestBody SystemMenu systemMenu) { return ApiResponse.success(systemMenuBiz.create(systemMenu)); } @ApiOperation("删除") @GetMapping("/delete/{id}") @RequiresPermissions("system:menu:delete") public ApiResponse deleteById(@PathVariable Integer id) { systemMenuBiz.deleteById(id); return ApiResponse.success(null); } @ApiOperation("批量删除") @GetMapping("/delete/batch") @RequiresPermissions("system:menu:delete") public ApiResponse deleteByIdInBatch(@RequestParam String ids) { String [] idArray = ids.split(","); List<Integer> idList = new ArrayList<>(); for (String id : idArray) { idList.add(Integer.valueOf(id)); } systemMenuBiz.deleteByIdInBatch(idList); return ApiResponse.success(null); } @ApiOperation("修改") @PostMapping("/updateById") @RequiresPermissions("system:menu:update") public ApiResponse updateById(@Validated(OperaType.Update.class) @RequestBody SystemMenu systemMenu) { systemMenuBiz.updateById(systemMenu); return ApiResponse.success(null); } @ApiOperation("修改菜单状态") @PostMapping("/updateStatus") @RequiresPermissions("system:menu:update") public ApiResponse updateStatus(@Validated(OperaType.UpdateStatus.class) @RequestBody SystemMenu systemMenu) { systemMenuBiz.updateById(systemMenu); return ApiResponse.success(null); } }
33.70297
114
0.724148
53c62518a6c38f43c3060bc9ce2fed5713d5831e
2,134
package com.example.win8.educon; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class teacher_welcome extends AppCompatActivity implements View.OnClickListener { private TextView textView1; private Button bd1,bd2,bd3,bd4,bd5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_teacher_welcome); bd1=(Button)findViewById(R.id.button5); bd2=(Button)findViewById(R.id.button6); bd3=(Button)findViewById(R.id.buttonchngpass); bd4=(Button)findViewById(R.id.button7); bd5=(Button)findViewById(R.id.button10); bd1.setOnClickListener(this); bd2.setOnClickListener(this); bd3.setOnClickListener(this); bd4.setOnClickListener(this); bd5.setOnClickListener(this); textView1 = (TextView) findViewById(R.id.textViewteacherName); Intent intent = getIntent(); String username = intent.getStringExtra(Login.USER_NAME); textView1.setText("Welcome User " + username); } @Override public void onClick(View v) { if(v == bd1) { Intent intent12=new Intent(getApplicationContext(),TeacherDetail.class); startActivity(intent12); } if(v== bd3) { Intent intent122=new Intent(getApplicationContext(),Teacher_change_Password.class); startActivity(intent122); } if(v== bd4) { Intent intent13=new Intent(getApplicationContext(),See_studentsEnrolled.class); startActivity(intent13); } if(v== bd5) { Intent intent13=new Intent(getApplicationContext(),Add_Notice.class); startActivity(intent13); } if(v== bd2) { Intent intent112=new Intent(getApplicationContext(),MainActivity.class); startActivity(intent112); finish(); } } }
25.105882
91
0.651359
b6dd1e1688ce48b6c48a03299b1b9b4b42494fba
2,350
/* * 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. */ package javax.mail.internet; import junit.framework.TestCase; /** * @version $Rev: 467553 $ $Date: 2006-10-24 23:01:51 -0500 (Tue, 24 Oct 2006) $ */ public class ParameterListTest extends TestCase { public ParameterListTest(String arg0) { super(arg0); } public void testParameters() throws ParseException { ParameterList list = new ParameterList(";thing=value;thong=vulue;thung=git"); assertEquals("value", list.get("thing")); assertEquals("vulue", list.get("thong")); assertEquals("git", list.get("thung")); } public void testQuotedParameter() throws ParseException { ParameterList list = new ParameterList(";foo=one;bar=\"two\""); assertEquals("one", list.get("foo")); assertEquals("two", list.get("bar")); } public void testEncodeDecode() throws Exception { System.setProperty("mail.mime.encodeparameters", "true"); System.setProperty("mail.mime.decodeparameters", "true"); String value = " '*% abc \u0081\u0082\r\n\t"; String encodedTest = "; one*=UTF-8''%20%27%2A%25%20abc%20%C2%81%C2%82%0D%0A%09"; ParameterList list = new ParameterList(); list.set("one", value, "UTF-8"); assertEquals(value, list.get("one")); String encoded = list.toString(); assertEquals(encoded, encodedTest); ParameterList list2 = new ParameterList(encoded); assertEquals(value, list.get("one")); assertEquals(list2.toString(), encodedTest); } }
34.558824
88
0.671064
ea8570b7c94065f2df84a528cea83bd4b8502ff9
4,384
package dev.zevolution.netflixhexaarch.datasources.services.data.response; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class GithubOwnerResponse { private String login; private Integer id; private String nodeId; private String avatarUrl; private String gravatarId; private String url; private String htmlUrl; private String followersUrl; private String followingUrl; private String gistsUrl; private String starredUrl; private String subscriptionsUrl; private String organizationsUrl; private String reposUrl; private String eventsUrl; private String receivedEventsUrl; private String type; private Boolean siteAdmin; public String getLogin() { return login; } public GithubOwnerResponse setLogin(String login) { this.login = login; return this; } public Integer getId() { return id; } public GithubOwnerResponse setId(Integer id) { this.id = id; return this; } public String getNodeId() { return nodeId; } public GithubOwnerResponse setNodeId(String nodeId) { this.nodeId = nodeId; return this; } public String getAvatarUrl() { return avatarUrl; } public GithubOwnerResponse setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; return this; } public String getGravatarId() { return gravatarId; } public GithubOwnerResponse setGravatarId(String gravatarId) { this.gravatarId = gravatarId; return this; } public String getUrl() { return url; } public GithubOwnerResponse setUrl(String url) { this.url = url; return this; } public String getHtmlUrl() { return htmlUrl; } public GithubOwnerResponse setHtmlUrl(String htmlUrl) { this.htmlUrl = htmlUrl; return this; } public String getFollowersUrl() { return followersUrl; } public GithubOwnerResponse setFollowersUrl(String followersUrl) { this.followersUrl = followersUrl; return this; } public String getFollowingUrl() { return followingUrl; } public GithubOwnerResponse setFollowingUrl(String followingUrl) { this.followingUrl = followingUrl; return this; } public String getGistsUrl() { return gistsUrl; } public GithubOwnerResponse setGistsUrl(String gistsUrl) { this.gistsUrl = gistsUrl; return this; } public String getStarredUrl() { return starredUrl; } public GithubOwnerResponse setStarredUrl(String starredUrl) { this.starredUrl = starredUrl; return this; } public String getSubscriptionsUrl() { return subscriptionsUrl; } public GithubOwnerResponse setSubscriptionsUrl(String subscriptionsUrl) { this.subscriptionsUrl = subscriptionsUrl; return this; } public String getOrganizationsUrl() { return organizationsUrl; } public GithubOwnerResponse setOrganizationsUrl(String organizationsUrl) { this.organizationsUrl = organizationsUrl; return this; } public String getReposUrl() { return reposUrl; } public GithubOwnerResponse setReposUrl(String reposUrl) { this.reposUrl = reposUrl; return this; } public String getEventsUrl() { return eventsUrl; } public GithubOwnerResponse setEventsUrl(String eventsUrl) { this.eventsUrl = eventsUrl; return this; } public String getReceivedEventsUrl() { return receivedEventsUrl; } public GithubOwnerResponse setReceivedEventsUrl(String receivedEventsUrl) { this.receivedEventsUrl = receivedEventsUrl; return this; } public String getType() { return type; } public GithubOwnerResponse setType(String type) { this.type = type; return this; } public Boolean getSiteAdmin() { return siteAdmin; } public GithubOwnerResponse setSiteAdmin(Boolean siteAdmin) { this.siteAdmin = siteAdmin; return this; } }
22.95288
79
0.658075
f69c0d503c6170d2cca315480168addf9c06c7e7
3,322
package apcs.sort; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; public class InsertAndSelecSort { private static ArrayList<Integer> al = new ArrayList<Integer>(); private static Integer[] ai = new Integer[100]; public PrintWriter writer; public static void main(String[] args) { genLists(); new InsertAndSelecSort(); } public InsertAndSelecSort() { try { writer = new PrintWriter("data.txt", "UTF-8"); print(al, ai, "The original BLANK is:"); insertionSort(al); selectionSort(ai); print(al, ai, "The sorted BLANK is:"); writer.close(); } catch (Exception e) { } } /** * Returns the array list converted to a String object * @return */ public String alToString() { String s = ""; for (int x = 0; x < al.size(); x++) { s += al.get(x) + ", "; if (x % 10 == 9) { s += "\n"; } } return s; } /** * Returns the array converted to a String object * @return */ public String aiToString() { String s = ""; for (int x = 0; x < ai.length; x++) { s += ai[x] + ", "; if (x % 10 == 9) { s += "\n"; } } return s; } public static void genLists() { for (int x = 0; x < 100; x++) { al.add((int) (Math.random() * 100)); } for (int x = 0; x < 100; x++) { ai[x] = ((int) (Math.random() * 100)); } } /** * Sorts the given arraylist using the insertionSort algorithm * @param a */ public void insertionSort(ArrayList<Integer> a) { ArrayList<Integer> sorted = new ArrayList<Integer>(); sorted.add(a.get(0)); a.remove(0); for (int x = 0; x < a.size(); x++) { Integer temp = a.get(x); for (int y = 0; y < sorted.size(); y++) { try { if (temp > sorted.get(y) && temp < sorted.get(y + 1)) { sorted.add(y + 1, temp); break; } else if (temp < sorted.get(y)) { sorted.add(y, temp); break; } } catch (Exception e) { if (temp < sorted.get(y)) { sorted.add(y, temp); break; } else { sorted.add(temp); } } } } al = sorted; } /** * Uses the Selection Sort Algorithm to sort the array * * @param a */ public void selectionSort(Comparable<Integer> a[]) { /* * finds the smallest & moves to bottom then second smallest and * moves it to the next one and so on */ // Stores two variables for later use int min; Comparable<Integer> temp; // Runs Selection sort for the entire array for (int index = 0; index < a.length - 1; index++) { // Makes sure that the next minimum is right where it needs to min = index; // Only looks at things it needs to look at for (int scan = index + 1; scan < a.length; scan++) // Finds the smallest value left in the unsorted portion if (a[scan].compareTo((Integer) a[min]) < 0) min = scan; // Swap the values temp = a[min]; a[min] = a[index]; a[index] = temp; } } public void print(ArrayList<Integer> a, Comparable<Integer> b[], String msg) throws Exception { writer.println(msg.replace("BLANK", "array")); writer.println(aiToString()); writer.println(msg.replace("BLANK", "list")); writer.println(alToString()); } }
23.230769
67
0.557194
ad23f33eb3bdd1a2f883dfab40778e2c750878ed
53
package theHeart.cards; public class EnergyLink { }
10.6
25
0.773585
f930bd20e4b8610187a80cc44b13f6e1d1ebd493
6,347
package net.ssehub.easy.reasoning.core.frontend; import net.ssehub.easy.basics.progress.ProgressObserver; import net.ssehub.easy.reasoning.core.reasoner.Message; import net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration; import net.ssehub.easy.reasoning.core.reasoner.ReasoningOperation; import net.ssehub.easy.reasoning.core.reasoner.ReasoningResult; import net.ssehub.easy.varModel.confModel.Configuration; import net.ssehub.easy.varModel.model.Project; /** * Delegate for starting a reasoning. This class can be run as a thread or be used inside a thread, e.g. as * an Eclipse WorkspaceJob. * @author El-Sharkawy * */ public class ReasoningProcess implements Runnable { private static final boolean LOG_RESULT = false; private ReasoningOperation desiredOperation; private ReasoningResult result; private Project project; private Configuration config; private ReasonerConfiguration reasonerConfig; private IReasonerListener listener; private ProgressObserver observer; /** * Sole constructor for this class. * @param desiredOperation Specifies which reasoning operation should be performed. * @param config The configuration, which should be used for reasoning. * @param reasonerConfig the reasoner configuration to be used for reasoning (e.g. taken from the UI, * may be <b>null</b>) * @param listener A listener which will be called after the reasoning has been finished. * Can be <tt>null</tt>, if no action shall be executed after the reasoning is finished. * @param observer a progress observer indicating the progress, use {@link ProgressObserver#NO_OBSERVER} if no * progress shall be indicated */ public ReasoningProcess(ReasoningOperation desiredOperation, Configuration config, ReasonerConfiguration reasonerConfig, IReasonerListener listener, ProgressObserver observer) { this.desiredOperation = desiredOperation; this.project = config.getProject(); this.config = config; this.reasonerConfig = reasonerConfig; this.listener = listener; this.observer = observer; } /** * Constructor for checking the consistency (satisfiability) of a project, without having a configuration. * @param project The origin project which should be used for reasoning * @param reasonerConfig the reasoner configuration to be used for reasoning (e.g. taken from the UI, * may be <b>null</b>) * @param listener A listener which will be called after the reasoning has been finished. * Can be <tt>null</tt>, if no action shall be executed after the reasoning is finished. * @param observer a progress observer indicating the progress, use {@link ProgressObserver#NO_OBSERVER} if no * progress shall be indicated */ public ReasoningProcess(Project project, ReasonerConfiguration reasonerConfig, IReasonerListener listener, ProgressObserver observer) { this.desiredOperation = ReasoningOperation.CONSITENCY_CHECK; this.project = project; this.config = null; this.reasonerConfig = reasonerConfig; this.listener = listener; this.observer = observer; } /** * Executes the reasoning. */ @Override public void run() { ReasonerFrontend reasoner = ReasonerFrontend.getInstance(); if (null == reasoner) { setErrorResult("No reasoner found."); } else if (null == project) { setErrorResult("No project specified for reasoning"); } else { try { switch(desiredOperation) { case CONSITENCY_CHECK: result = reasoner.isConsistent(project, reasonerConfig, observer); logResult(); break; case VALIDATION: if (null == config) { setErrorResult("No configuration specified for reasoning"); } result = reasoner.check(config, reasonerConfig, observer); logResult(); break; case PROPAGATION: if (null == config) { setErrorResult("No configuration specified for reasoning"); } result = reasoner.propagate(config, reasonerConfig, observer); logResult(); break; default: result = new ReasoningResult(); Message msg = new Message("Nothing done.", null, net.ssehub.easy.basics.messages.Status.WARNING); result.addMessage(msg); break; } // checkstyle: stop exception type check } catch (Exception e) { // checkstyle: resume exception type check StringBuffer errorMsg = new StringBuffer("Not expected exception caught:\n"); errorMsg.append(e.getMessage()); setErrorResult(errorMsg.toString()); e.printStackTrace(); } } if (null != listener) { listener.reasoningFinished(result); } } /** * Performs the result logging as it was previously integrated into the reasoner but removed for performance * reasons. */ private void logResult() { if (LOG_RESULT) { result.logInformation(project, reasonerConfig, true); } } /** * Returns the result of the reasoning, i.e. the result of the {@link #run()} method. * This method should be used, if no {@link ReasoningResult} was used. * @return The result of the reasoning. */ public ReasoningResult getReasoningResult() { return result; } /** * Sets a {@link ReasoningResult} denoting that an error occurred during reasoning. * @param errorMsg A description what kind of error occurred. */ private void setErrorResult(String errorMsg) { result = new ReasoningResult(); Message msg = new Message(errorMsg, null, net.ssehub.easy.basics.messages.Status.ERROR); result.addMessage(msg); } }
41.214286
114
0.629904
46a4491fd21e5fa27a091f77007ca6b8ce54a191
13,543
/** * **************************************************************************** * Copyright 2014 Internet2 * * Licensed 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. * **************************************************************************** */ package edu.internet2.middleware.grouper.grouperUi.serviceLogic; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import edu.internet2.middleware.grouper.*; import edu.internet2.middleware.grouper.attr.AttributeDefName; import edu.internet2.middleware.grouper.attr.finder.AttributeDefNameFinder; import edu.internet2.middleware.grouper.grouperUi.beans.json.GuiResponseJs; import edu.internet2.middleware.grouper.grouperUi.beans.json.GuiScreenAction; import edu.internet2.middleware.grouper.grouperUi.beans.json.GuiScreenAction.GuiMessageType; import edu.internet2.middleware.grouper.privs.AccessPrivilege; import edu.internet2.middleware.grouper.privs.AttributeDefPrivilege; import edu.internet2.middleware.grouper.ui.GrouperUiFilter; import edu.internet2.middleware.grouper.ui.util.GrouperUiUserData; import edu.internet2.middleware.grouper.ui.util.GrouperUiConfig; import edu.internet2.middleware.grouper.ui.util.GrouperUiUtils; import edu.internet2.middleware.grouper.userData.GrouperUserDataApi; import org.apache.commons.lang.StringUtils; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; public class UiV2GroupProvisioningTarget { private static final String PROVISIONING_TARGETS_ROOT_FOLDER = "etc:attribute:provisioningTargets"; private static final String PROVISIONING_TARGETS_JSP = "/WEB-INF/grouperUi2/group/groupProvisioningTargetAttributes.jsp"; private static final String MAIN_CONTENT_DIV_ID = "#grouperMainContentDivId"; public static final String GROUPER_PROVISIONING_TARGET_CANDIDATE_ATTRIBUTE_DEF_NAME = "custom.provisioningTargetCandidate.attributeDefName"; /** * Custom attributes handling */ @SuppressWarnings("unchecked") public void groupEditAttributes(final HttpServletRequest request, HttpServletResponse response) { final String provisioningTargetCandidateAttributeDefName = GrouperUiConfig.retrieveConfig().propertyValueStringRequired( GROUPER_PROVISIONING_TARGET_CANDIDATE_ATTRIBUTE_DEF_NAME); withCurrentGroupAndSession(request, new CurrentGroupAndSessionCallback() { @Override public void doWithGroupAndSession(Group group, GrouperSession session) { if (group.getAttributeDelegate().hasAttributeOrAncestorHasAttribute(provisioningTargetCandidateAttributeDefName, false)) { Map<Stem, Set<AttributeDefName>> attributeDefinitionsByFolderName = getAllProvisioningTargetsAttributesGroupedByFolder(session); Map<String, String> assignedGroupAttributes = new HashMap(); //Assigned Group attributes for (AttributeDefName attr : flattenAllAttributeDefNames(attributeDefinitionsByFolderName)) { String val = group.getAttributeValueDelegate().retrieveValueString(attr.getName()); val = (val == null ? "" : val); assignedGroupAttributes.put(attr.getName(), buildUiElement(attr.getName(), val)); } //Send the data to the jsp request.setAttribute("attributeDefinitions", attributeDefinitionsByFolderName); request.setAttribute("assignedGroupAttributes", assignedGroupAttributes); GuiResponseJs.retrieveGuiResponseJs().addAction(GuiScreenAction.newInnerHtmlFromJsp(MAIN_CONTENT_DIV_ID, PROVISIONING_TARGETS_JSP)); } else { //UI dance GuiResponseJs guiResponseJs = GuiResponseJs.retrieveGuiResponseJs(); guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.success, "This group is not authorized for provisioning.")); } } }); } /** * edit and assign attribute values. * * @param request * @param response */ public void groupEditAttributesSubmit(final HttpServletRequest request, HttpServletResponse response) { withCurrentGroupAndSession(request, new CurrentGroupAndSessionCallback() { @Override public void doWithGroupAndSession(Group group, GrouperSession session) { for(AttributeDefName attr: getAllProvisioningTargetsAttributesDefNamesFlattened(session)) { String attrValueReqParam = request.getParameter(attr.getName()); if(StringUtils.isBlank(attrValueReqParam)) { //If incoming (UI) value is blank, just delete the value currently set for this attr String assignedValue = group.getAttributeValueDelegate().retrieveValueString(attr.getName()); if(assignedValue != null) { group.getAttributeValueDelegate().deleteValueString(attr.getName(), assignedValue); } } else { //For non-empty incoming values, just blindly assign them (it should update the current attr value, right?) group.getAttributeValueDelegate().assignValue(attr.getName(), attrValueReqParam); } } //UI dance GuiResponseJs guiResponseJs = GuiResponseJs.retrieveGuiResponseJs(); //go to the view group screen guiResponseJs.addAction( GuiScreenAction.newScript(String.format("guiV2link('operation=UiV2Group.viewGroup&groupId=%s')", group.getId()))); //lets show a success message on the new screen guiResponseJs.addAction(GuiScreenAction.newMessage(GuiMessageType.success, "Data stored.")); GrouperUserDataApi.recentlyUsedGroupAdd(GrouperUiUserData.grouperUiGroupNameForUserData(), GrouperUiFilter.retrieveSubjectLoggedIn(), group); } }); } private Map<Stem, Set<AttributeDefName>> getAllProvisioningTargetsAttributesGroupedByFolder(GrouperSession grouperSession) { //Custom attributes dance Stem rootProvisioningTargetsFolder = StemFinder.findByName(grouperSession, PROVISIONING_TARGETS_ROOT_FOLDER, true); Set<Stem> provisioningTargetsFolders = rootProvisioningTargetsFolder.getChildStems(); final Map<Stem, Set<AttributeDefName>> attributeDefinitions = new HashMap(); for (Stem folder : provisioningTargetsFolders) { Set<AttributeDefName> attrNames = new AttributeDefNameFinder() .assignParentStemId(folder.getId()).assignStemScope(Stem.Scope.ONE) .assignSubject(grouperSession.getSubject()).assignPrivileges(AttributeDefPrivilege.ATTR_READ_PRIVILEGES) .findAttributeNames(); if (attrNames.size() > 0) { attributeDefinitions.put(folder, attrNames); } } return attributeDefinitions; } private Set<AttributeDefName> flattenAllAttributeDefNames(Map<Stem, Set<AttributeDefName>> attributeDefNamesByFolderName) { Set<AttributeDefName> flattenedSetToUse = new HashSet<AttributeDefName>(); Iterator<Set<AttributeDefName>> attrDefsIter = attributeDefNamesByFolderName.values().iterator(); while (attrDefsIter.hasNext()) { flattenedSetToUse.addAll(attrDefsIter.next()); } return flattenedSetToUse; } private Set<AttributeDefName> getAllProvisioningTargetsAttributesDefNamesFlattened(GrouperSession grouperSession) { return flattenAllAttributeDefNames(getAllProvisioningTargetsAttributesGroupedByFolder(grouperSession)); } private CurrentGroupAndSession currentGroupAndSession(HttpServletRequest req) { final GrouperSession grouperSession = GrouperSession.start(GrouperUiFilter.retrieveSubjectLoggedIn()); final Group group = RetrieveGroupHelperResult.retrieveGroupHelper(req, AccessPrivilege.UPDATE).getGroup(); return new CurrentGroupAndSession(group, grouperSession); } /* Oh, java, just give me native tuples or simple structs values! */ private static final class CurrentGroupAndSession { public final Group group; public final GrouperSession session; public CurrentGroupAndSession(Group group, GrouperSession session) { this.group = group; this.session = session; } } private void withCurrentGroupAndSession(HttpServletRequest request, CurrentGroupAndSessionCallback callback) { CurrentGroupAndSession currentGroupAndSession = null; try { currentGroupAndSession = currentGroupAndSession(request); if (currentGroupAndSession.group == null) { return; } callback.doWithGroupAndSession(currentGroupAndSession.group, currentGroupAndSession.session); } finally { if (currentGroupAndSession != null) { GrouperSession.stopQuietly(currentGroupAndSession.session); } } } private interface CurrentGroupAndSessionCallback { void doWithGroupAndSession(Group group, GrouperSession session); } public String escapeHtml(String input) { return GrouperUiUtils.escapeHtml(input, true); } public String getProperty(String name) { return (String) GrouperUiConfig.retrieveConfig().propertyValueString("custom.provisioningTarget." + name); } public String getProperty(String name, String defaultValue) { return (String) GrouperUiConfig.retrieveConfig().propertyValueString("custom.provisioningTarget." + name, defaultValue); } public String buildUiElement(String attributeName, String attributeValue) { final StringBuilder sb = new StringBuilder(); final String escapedAttributeName = escapeHtml(attributeName); final String attributeDefault = getProperty(attributeName.replace(":", "-") + ".default"); String escapedAttributeValue = escapeHtml(attributeValue == null || attributeValue.isEmpty() ? attributeDefault : attributeValue); //Something is cause null to be "null", so fix that. escapedAttributeValue = escapedAttributeValue == null || escapedAttributeValue.equalsIgnoreCase("null") ? null : escapedAttributeValue; final String attributeType = getProperty(attributeName.replace(":", "-") + ".type"); if ("yesNo".equalsIgnoreCase(attributeType)) { sb.append("<select id=\"").append(escapedAttributeName).append("\" name=\"").append(escapedAttributeName).append("\">"); sb.append(" <option value=\"yes\"" + (escapedAttributeValue.equalsIgnoreCase("yes") ? " selected " : "") + ">yes</option>"); sb.append(" <option value=\"no\"" + (escapedAttributeValue.equalsIgnoreCase("no") ? " selected " : "") + ">no</option>"); sb.append("</select>"); } else if ("trueFalse".equalsIgnoreCase(attributeType)) { sb.append("<select id=\"").append(escapedAttributeName).append("\" name=\"").append(escapedAttributeName).append("\">"); sb.append(" <option value=\"true\"" + (escapedAttributeValue.equalsIgnoreCase("true") ? " selected " : "") + ">true</option>"); sb.append(" <option value=\"false\"" + (escapedAttributeValue.equalsIgnoreCase("false") ? " selected " : "") + ">false</option>"); sb.append("</select>"); } else if ("select".equalsIgnoreCase(attributeType)) { String[] lov = getProperty(attributeName.replace(":", "-") + ".lov").split(","); sb.append("<select id=\"").append(escapedAttributeName).append("\" name=\"").append(escapedAttributeName).append("\">"); for (String value : lov) { if (attributeValue.equalsIgnoreCase(value)) { sb.append(" <option value=\"").append(value).append("\" selected>").append(value).append("</option>"); } else { sb.append(" <option value=\"").append(value).append("\">").append(value).append("</option>"); } } sb.append("</select>"); } else { sb.append("<input type=\"text\" id=\"").append(escapedAttributeName) .append("\" name=\"").append(escapedAttributeName).append("\" value=\"").append(escapedAttributeValue).append("\"/>"); } return sb.toString(); } }
51.10566
153
0.658126
00e9b55a5dce2a727563b496e6c2af7271fe4b2d
2,414
package org.kuali.ole.docstore.common.document.content.bib.marc; import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.List; /** * Created with IntelliJ IDEA. * User: sambasivam * Date: 12/13/13 * Time: 3:35 PM * To change this template use File | Settings | File Templates. */ public class BibMarcRecord { public static final String TAG_003 = "003"; private String leader = null; private List<ControlField> controlFields = new ArrayList<ControlField>(); private List<DataField> dataFields = new ArrayList<DataField>(); public String getLeader() { return leader; } public void setLeader(String leader) { this.leader = leader; } public List<ControlField> getControlFields() { if (controlFields == null) controlFields = new ArrayList<ControlField>(); return controlFields; } public void setControlFields(List<ControlField> controlFields) { this.controlFields = controlFields; } public List<DataField> getDataFields() { if (dataFields == null) dataFields = new ArrayList<DataField>(); return dataFields; } public void setDataFields(List<DataField> dataFields) { this.dataFields = dataFields; } public void addMarcDataField(DataField marcDataField) { if (!this.dataFields.contains(marcDataField)) { this.dataFields.add(marcDataField); } } public DataField getDataFieldForTag(String tag) { if (CollectionUtils.isNotEmpty(dataFields)) { for (DataField marcDataField : dataFields) { if (marcDataField.getTag().equalsIgnoreCase(tag)) { return marcDataField; } } } return null; } public void addDataFields(DataField marcDataField) { if (!this.dataFields.contains(marcDataField)) { this.dataFields.add(marcDataField); } } public void addControlFields(ControlField controlField) { if (!this.controlFields.contains(controlField)) { this.controlFields.add(controlField); } } public String getRecordId() { for (ControlField cf : controlFields) { if (cf.getTag().equals("001")) { return cf.getValue(); } } return ""; } }
27.123596
77
0.623861
97162ec8228212d397f7c26440622b0b8a1c8954
2,163
package com.webank.weevent.core.dto; import java.math.BigInteger; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; /** * Entity class of table tb_block. */ @Getter @Setter @NoArgsConstructor public class TbBlock { private String pkHash; private BigInteger blockNumber = BigInteger.ZERO; private String blockTimestamp; private int transCount; private int sealerIndex; private String sealer; private String createTime; private String modifyTime; public TbBlock(String pkHash, BigInteger blockNumber, String blockTimestamp, Integer transCount, int sealerIndex) { this.pkHash = pkHash; this.blockNumber = blockNumber; this.blockTimestamp = blockTimestamp; this.transCount = transCount; this.sealerIndex = sealerIndex; } public String getPkHash() { return pkHash; } public void setPkHash(String pkHash) { this.pkHash = pkHash; } public BigInteger getBlockNumber() { return blockNumber; } public void setBlockNumber(BigInteger blockNumber) { this.blockNumber = blockNumber; } public String getBlockTimestamp() { return blockTimestamp; } public void setBlockTimestamp(String blockTimestamp) { this.blockTimestamp = blockTimestamp; } public int getTransCount() { return transCount; } public void setTransCount(int transCount) { this.transCount = transCount; } public int getSealerIndex() { return sealerIndex; } public void setSealerIndex(int sealerIndex) { this.sealerIndex = sealerIndex; } public String getSealer() { return sealer; } public void setSealer(String sealer) { this.sealer = sealer; } public String getCreateTime() { return createTime; } public void setCreateTime(String createTime) { this.createTime = createTime; } public String getModifyTime() { return modifyTime; } public void setModifyTime(String modifyTime) { this.modifyTime = modifyTime; } }
22.071429
80
0.657883
22bdcaab87e110a4055ade9ee3de41c07a945101
1,507
package jp.co.ogis_ri.nautible.app.order.outbound.cosmosdb; import java.util.List; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import jp.co.ogis_ri.nautible.app.order.config.QuarkusMappingConfig; import jp.co.ogis_ri.nautible.app.order.domain.Delivery; import jp.co.ogis_ri.nautible.app.order.domain.Order; import jp.co.ogis_ri.nautible.app.order.domain.Payment; import jp.co.ogis_ri.nautible.app.order.domain.Product; /** * CosmosdbのEntityとDomainのマッピング定義 */ @Mapper(config = QuarkusMappingConfig.class) public interface CosmosdbOrderMapper { CosmosdbOrderMapper INSTANCE = Mappers.getMapper(CosmosdbOrderMapper.class); @Mapping(target = "id", expression = "java(Integer.parseInt(order.getOrderNo().substring(1)))") CosmosdbOrder orderToCosmosdbOrder(Order order); CosmosdbDelivery deliveryToCosmosdbDelivery(Delivery delivery); CosmosdbPayment paymentToCosmosdbPayment(Payment payment); CosmosdbProduct productToCosmosdbProduct(Product product); List<CosmosdbProduct> productToCosmosdbProduct(List<Product> product); Order cosmosdbOrderToOrder(CosmosdbOrder order); Delivery cosmosdbDeliveryToDelivery(CosmosdbDelivery delivery); Payment cosmosdbPaymentToPayment(CosmosdbPayment payment); Product cosmosdbProductToProduct(CosmosdbProduct product); List<Product> cosmosdbProductToProduct(List<CosmosdbProduct> product); List<Order> cosmosdbOrderToOrder(List<CosmosdbOrder> order); }
32.06383
99
0.806238
8c0164323d4015ee888ba0ab80635aeac92ff1b0
1,025
package com.happy3w.utils.downlod.httpdownload; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import java.net.MalformedURLException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @SpringBootApplication @EnableScheduling public class HttpDownloadApplication { public static void main(String[] args) throws MalformedURLException { new SpringApplicationBuilder(HttpDownloadApplication.class) .headless(false) .web(WebApplicationType.NONE) .run(args); } @Bean(destroyMethod = "shutdownNow") public ExecutorService jobMqThreadPool() { return Executors.newFixedThreadPool(30, new CustomizableThreadFactory("download-worker-")); } }
34.166667
93
0.836098
ac034d5e6f384eb3f7c53920e78c9d17a9420e47
654
package org.rabix.bindings.protocol.draft3.bean; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; public class Draft3WagnerPythonTool extends Draft3JobApp { @JsonProperty("function") private Object function; public Object getFunction() { return function; } @Override @JsonIgnore public Draft3JobAppType getType() { return Draft3JobAppType.WAGNER_PYTHON_TOOL; } @Override public String toString() { return "Draft3WagnerPythonTool [function=" + function + ", id=" + id + ", getInputs()=" + getInputs() + ", getOutputs()=" + getOutputs() + "]"; } }
23.357143
105
0.70948
11daa717cf8f077a87e96ec731997f2dcff9b2f3
17,182
/** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. * * U.S. EXPORT CONTROLLED TECHNICAL DATA * This software product contains export-restricted data whose * export/transfer/disclosure is restricted by U.S. law. Dissemination * to non-U.S. persons whether in the United States or abroad requires * an export license or other authorization. * * Contractor Name: Raytheon Company * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 * * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Spinner; import com.raytheon.uf.viz.monitor.data.RangeData; import com.raytheon.uf.viz.monitor.data.RangesUtil; import com.raytheon.uf.viz.monitor.safeseas.threshold.SSDisplayProductData; import com.raytheon.uf.viz.monitor.ui.dialogs.EditThresholdsDlg; /** * Safeseas Display Product Edit Dialog * * <pre> * * SOFTWARE HISTORY * * Date Ticket# Engineer Description * ------------- -------- --------- -------------------------------------------- * Sep 21, 2016 5901 randerso Remove unused style parameter to super * constructor * * </pre> * * @author ???? */ public class SSDisplayProductEditDlg extends EditThresholdsDlg { private Spinner scaWindSpdRSpnr; private Spinner scaWindSpdYSpnr; private Spinner scaGustSpdRSpnr; private Spinner scaGustSpdYSpnr; private Spinner scaPeakWindRSpnr; private Spinner scaPeakWindYSpnr; private Spinner scaWaveHgtRSpnr; private Spinner scaWaveHgtYSpnr; private Spinner galeWindSpdRSpnr; private Spinner galeWindSpdYSpnr; private Spinner galeGustSpdRSpnr; private Spinner galeGustSpdYSpnr; private Spinner galePeakWindRSpnr; private Spinner galePeakWindYSpnr; private Spinner stormWindSpdRSpnr; private Spinner stormWindSpdYSpnr; private Spinner stormGustSpdRSpnr; private Spinner stormGustSpdYSpnr; private Spinner stormPeakWindRSpnr; private Spinner stormPeakWindYSpnr; private Spinner hfwwWindSpdRSpnr; private Spinner hfwwWindSpdYSpnr; private Spinner hfwwGustSpdRSpnr; private Spinner hfwwGustSpdYSpnr; private Spinner hfwwPeakWindRSpnr; private Spinner hfwwPeakWindYSpnr; private SSDisplayProductData ssdpd; private IUpdateDisplayProduct updateCB; public SSDisplayProductEditDlg(Shell parent, SSDisplayProductData ssdpd, IUpdateDisplayProduct updateCB) { super(parent); this.ssdpd = ssdpd; this.updateCB = updateCB; } /** * Initialize the components on the display. */ @Override protected void initializeComponents() { shell.setText("SAFESEAS: Display Edit Product"); rangeUtil = RangesUtil.getInstance(); createSmallCraftAdvisoryGroup(); createGaleWarningGroup(); createStormWarningGroup(); createHFWWGroup(); } private void createSmallCraftAdvisoryGroup() { RangeData rd; GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridLayout gl = new GridLayout(4, false); gl.verticalSpacing = 10; Group scaGroup = new Group(getDialogShell(), SWT.NONE); scaGroup.setLayout(gl); scaGroup.setLayoutData(gd); scaGroup.setText(" Small Craft Advisory "); createRYRangeLabels(scaGroup); /* * Wind Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label windSpdLbl = new Label(scaGroup, SWT.RIGHT); windSpdLbl.setText("Wind Speed (kt):"); windSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_ScaWind); scaWindSpdRSpnr = new Spinner(scaGroup, SWT.BORDER); scaWindSpdYSpnr = new Spinner(scaGroup, SWT.BORDER); createSpinnerControls(scaGroup, scaWindSpdRSpnr, scaWindSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Gust Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label gustSpdLbl = new Label(scaGroup, SWT.RIGHT); gustSpdLbl.setText("Gust Speed (kt):"); gustSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_ScaGust); scaGustSpdRSpnr = new Spinner(scaGroup, SWT.BORDER); scaGustSpdYSpnr = new Spinner(scaGroup, SWT.BORDER); createSpinnerControls(scaGroup, scaGustSpdRSpnr, scaGustSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Peak Wind */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label peakWindLbl = new Label(scaGroup, SWT.RIGHT); peakWindLbl.setText("Peak Wind (kt):"); peakWindLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_ScaMax); scaPeakWindRSpnr = new Spinner(scaGroup, SWT.BORDER); scaPeakWindYSpnr = new Spinner(scaGroup, SWT.BORDER); createSpinnerControls(scaGroup, scaPeakWindRSpnr, scaPeakWindYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Wave Height */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label waveHgtLbl = new Label(scaGroup, SWT.RIGHT); waveHgtLbl.setText("Wave Height (ft):"); waveHgtLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_Wave); scaWaveHgtRSpnr = new Spinner(scaGroup, SWT.BORDER); scaWaveHgtYSpnr = new Spinner(scaGroup, SWT.BORDER); createSpinnerControls(scaGroup, scaWaveHgtRSpnr, scaWaveHgtYSpnr, rd, true, rangeUtil.RValIsHigher); } private void createGaleWarningGroup() { RangeData rd; GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridLayout gl = new GridLayout(4, false); gl.verticalSpacing = 10; Group galeWarnGroup = new Group(getDialogShell(), SWT.NONE); galeWarnGroup.setLayout(gl); galeWarnGroup.setLayoutData(gd); galeWarnGroup.setText(" Gale Warning "); createRYRangeLabels(galeWarnGroup); /* * Wind Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label windSpdLbl = new Label(galeWarnGroup, SWT.RIGHT); windSpdLbl.setText("Wind Speed (kt):"); windSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_GaleWind); galeWindSpdRSpnr = new Spinner(galeWarnGroup, SWT.BORDER); galeWindSpdYSpnr = new Spinner(galeWarnGroup, SWT.BORDER); createSpinnerControls(galeWarnGroup, galeWindSpdRSpnr, galeWindSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Gust Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label gustSpdLbl = new Label(galeWarnGroup, SWT.RIGHT); gustSpdLbl.setText("Gust Speed (kt):"); gustSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_GaleGust); galeGustSpdRSpnr = new Spinner(galeWarnGroup, SWT.BORDER); galeGustSpdYSpnr = new Spinner(galeWarnGroup, SWT.BORDER); createSpinnerControls(galeWarnGroup, galeGustSpdRSpnr, galeGustSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Peak Wind */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label peakWindLbl = new Label(galeWarnGroup, SWT.RIGHT); peakWindLbl.setText("Peak Wind (kt):"); peakWindLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_GaleMax); galePeakWindRSpnr = new Spinner(galeWarnGroup, SWT.BORDER); galePeakWindYSpnr = new Spinner(galeWarnGroup, SWT.BORDER); createSpinnerControls(galeWarnGroup, galePeakWindRSpnr, galePeakWindYSpnr, rd, true, rangeUtil.RValIsHigher); } private void createStormWarningGroup() { RangeData rd; GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridLayout gl = new GridLayout(4, false); gl.verticalSpacing = 10; Group stormWarnGroup = new Group(getDialogShell(), SWT.NONE); stormWarnGroup.setLayout(gl); stormWarnGroup.setLayoutData(gd); stormWarnGroup.setText(" Storm Warning "); createRYRangeLabels(stormWarnGroup); /* * Wind Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label windSpdLbl = new Label(stormWarnGroup, SWT.RIGHT); windSpdLbl.setText("Wind Speed (kt):"); windSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_StormWind); stormWindSpdRSpnr = new Spinner(stormWarnGroup, SWT.BORDER); stormWindSpdYSpnr = new Spinner(stormWarnGroup, SWT.BORDER); createSpinnerControls(stormWarnGroup, stormWindSpdRSpnr, stormWindSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Gust Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label gustSpdLbl = new Label(stormWarnGroup, SWT.RIGHT); gustSpdLbl.setText("Gust Speed (kt):"); gustSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_StormGust); stormGustSpdRSpnr = new Spinner(stormWarnGroup, SWT.BORDER); stormGustSpdYSpnr = new Spinner(stormWarnGroup, SWT.BORDER); createSpinnerControls(stormWarnGroup, stormGustSpdRSpnr, stormGustSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Peak Wind */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label peakWindLbl = new Label(stormWarnGroup, SWT.RIGHT); peakWindLbl.setText("Peak Wind (kt):"); peakWindLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_StormMax); stormPeakWindRSpnr = new Spinner(stormWarnGroup, SWT.BORDER); stormPeakWindYSpnr = new Spinner(stormWarnGroup, SWT.BORDER); createSpinnerControls(stormWarnGroup, stormPeakWindRSpnr, stormPeakWindYSpnr, rd, true, rangeUtil.RValIsHigher); } private void createHFWWGroup() { RangeData rd; GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridLayout gl = new GridLayout(4, false); gl.verticalSpacing = 10; Group hfwwGroup = new Group(getDialogShell(), SWT.NONE); hfwwGroup.setLayout(gl); hfwwGroup.setLayoutData(gd); hfwwGroup.setText(" HFWW - Hurricane Force Wind Warning "); createRYRangeLabels(hfwwGroup); /* * Wind Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label windSpdLbl = new Label(hfwwGroup, SWT.RIGHT); windSpdLbl.setText("Wind Speed (kt):"); windSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_HfwwWind); hfwwWindSpdRSpnr = new Spinner(hfwwGroup, SWT.BORDER); hfwwWindSpdYSpnr = new Spinner(hfwwGroup, SWT.BORDER); createSpinnerControls(hfwwGroup, hfwwWindSpdRSpnr, hfwwWindSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Gust Speed */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label gustSpdLbl = new Label(hfwwGroup, SWT.RIGHT); gustSpdLbl.setText("Gust Speed (kt):"); gustSpdLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_HfwwGust); hfwwGustSpdRSpnr = new Spinner(hfwwGroup, SWT.BORDER); hfwwGustSpdYSpnr = new Spinner(hfwwGroup, SWT.BORDER); createSpinnerControls(hfwwGroup, hfwwGustSpdRSpnr, hfwwGustSpdYSpnr, rd, true, rangeUtil.RValIsHigher); /* * Peak Wind */ gd = new GridData(SWT.DEFAULT, SWT.CENTER, false, true); Label peakWindLbl = new Label(hfwwGroup, SWT.RIGHT); peakWindLbl.setText("Peak Wind (kt):"); peakWindLbl.setLayoutData(gd); rd = rangeUtil.getRangeData(RangesUtil.RangeType.SS_HfwwMax); hfwwPeakWindRSpnr = new Spinner(hfwwGroup, SWT.BORDER); hfwwPeakWindYSpnr = new Spinner(hfwwGroup, SWT.BORDER); createSpinnerControls(hfwwGroup, hfwwPeakWindRSpnr, hfwwPeakWindYSpnr, rd, true, rangeUtil.RValIsHigher); } @Override protected void updateControlsWithData() { /* * Small Craft Advisory */ scaWindSpdRSpnr.setSelection((int)ssdpd.getScaWindSpeedR()); scaWindSpdYSpnr.setSelection((int)ssdpd.getScaWindSpeedY()); scaGustSpdRSpnr.setSelection((int)ssdpd.getScaGustSpeedR()); scaGustSpdYSpnr.setSelection((int)ssdpd.getScaGustSpeedY()); scaPeakWindRSpnr.setSelection((int)ssdpd.getScaPeakWindR()); scaPeakWindYSpnr.setSelection((int)ssdpd.getScaPeakWindY()); scaWaveHgtRSpnr.setSelection((int)ssdpd.getScaWaveHgtR()); scaWaveHgtYSpnr.setSelection((int)ssdpd.getScaWaveHgtY()); /* * Gale Warning */ galeWindSpdRSpnr.setSelection((int)ssdpd.getGaleWindSpeedR()); galeWindSpdYSpnr.setSelection((int)ssdpd.getGaleWindSpeedY()); galeGustSpdRSpnr.setSelection((int)ssdpd.getGaleGustSpeedR()); galeGustSpdYSpnr.setSelection((int)ssdpd.getGaleGustSpeedY()); galePeakWindRSpnr.setSelection((int)ssdpd.getGalePeakWindR()); galePeakWindYSpnr.setSelection((int)ssdpd.getGalePeakWindY()); /* * Storm Warning */ stormWindSpdRSpnr.setSelection((int)ssdpd.getStormWrnWindSpeedR()); stormWindSpdYSpnr.setSelection((int)ssdpd.getStormWrnWindSpeedY()); stormGustSpdRSpnr.setSelection((int)ssdpd.getStormWrnGustSpeedR()); stormGustSpdYSpnr.setSelection((int)ssdpd.getStormWrnGustSpeedY()); stormPeakWindRSpnr.setSelection((int)ssdpd.getStormWrnPeakWindR()); stormPeakWindYSpnr.setSelection((int)ssdpd.getStormWrnPeakWindY()); /* * HFWW */ hfwwWindSpdRSpnr.setSelection((int)ssdpd.getHfwwWindSpeedR()); hfwwWindSpdYSpnr.setSelection((int)ssdpd.getHfwwWindSpeedY()); hfwwGustSpdRSpnr.setSelection((int)ssdpd.getHfwwGustSpeedR()); hfwwGustSpdYSpnr.setSelection((int)ssdpd.getHfwwGustSpeedY()); hfwwPeakWindRSpnr.setSelection((int)ssdpd.getHfwwPeakWindR()); hfwwPeakWindYSpnr.setSelection((int)ssdpd.getHfwwPeakWindY()); } @Override protected void updateData() { /* * Small Craft Advisory */ ssdpd.setScaWindSpeedR(scaWindSpdRSpnr.getSelection()); ssdpd.setScaWindSpeedY(scaWindSpdYSpnr.getSelection()); ssdpd.setScaGustSpeedR(scaGustSpdRSpnr.getSelection()); ssdpd.setScaGustSpeedY(scaGustSpdYSpnr.getSelection()); ssdpd.setScaPeakWindR(scaPeakWindRSpnr.getSelection()); ssdpd.setScaPeakWindY(scaPeakWindYSpnr.getSelection()); ssdpd.setScaWaveHgtR(scaWaveHgtRSpnr.getSelection()); ssdpd.setScaWaveHgtY(scaWaveHgtYSpnr.getSelection()); /* * Gale Warning */ ssdpd.setGaleWindSpeedR(galeWindSpdRSpnr.getSelection()); ssdpd.setGaleWindSpeedY(galeWindSpdYSpnr.getSelection()); ssdpd.setGaleGustSpeedR(galeGustSpdRSpnr.getSelection()); ssdpd.setGaleGustSpeedY(galeGustSpdYSpnr.getSelection()); ssdpd.setGalePeakWindR(galePeakWindRSpnr.getSelection()); ssdpd.setGalePeakWindY(galePeakWindYSpnr.getSelection()); /* * Storm Warning */ ssdpd.setStormWrnWindSpeedR(stormWindSpdRSpnr.getSelection()); ssdpd.setStormWrnWindSpeedY(stormWindSpdYSpnr.getSelection()); ssdpd.setStormWrnGustSpeedR(stormGustSpdRSpnr.getSelection()); ssdpd.setStormWrnGustSpeedY(stormGustSpdYSpnr.getSelection()); ssdpd.setStormWrnPeakWindR(stormPeakWindRSpnr.getSelection()); ssdpd.setStormWrnPeakWindY(stormPeakWindYSpnr.getSelection()); /* * HFWW */ ssdpd.setHfwwWindSpeedR(hfwwWindSpdRSpnr.getSelection()); ssdpd.setHfwwWindSpeedY(hfwwWindSpdYSpnr.getSelection()); ssdpd.setHfwwGustSpeedR(hfwwGustSpdRSpnr.getSelection()); ssdpd.setHfwwGustSpeedY(hfwwGustSpdYSpnr.getSelection()); ssdpd.setHfwwPeakWindR(hfwwPeakWindRSpnr.getSelection()); ssdpd.setHfwwPeakWindY(hfwwPeakWindYSpnr.getSelection()); } @Override protected void applyAction() { updateData(); this.updateCB.updateThresholdData(ssdpd); } }
36.402542
115
0.669712
03f17d6db3994e950055ca6b94dd7b463114fc89
460
package ru.job4j.multitreading.wordCount; public class CharCount extends Thread { String line = new String(); public CharCount(String line) { this.line = line; } @Override public void run() { int j = 0; for (int i = 0; i < line.length(); i++) { if (line.charAt(i) != ' ') { j++; } } System.out.println(j); Thread.currentThread().interrupt(); } }
21.904762
49
0.5
411aeb2def45d3cf140add08f8a4e1ff8941ae78
6,997
// ------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. // ------------------------------------------------------------------------------ package com.microsoft.graph.requests.extensions; import com.microsoft.graph.http.IRequestBuilder; import com.microsoft.graph.core.ClientException; import com.microsoft.graph.concurrency.ICallback; import com.microsoft.graph.models.extensions.MobileAppTroubleshootingEvent; import com.microsoft.graph.requests.extensions.IAppLogCollectionRequestCollectionRequestBuilder; import com.microsoft.graph.requests.extensions.IAppLogCollectionRequestRequestBuilder; import com.microsoft.graph.requests.extensions.AppLogCollectionRequestCollectionRequestBuilder; import com.microsoft.graph.requests.extensions.AppLogCollectionRequestRequestBuilder; import java.util.Arrays; import java.util.EnumSet; import com.microsoft.graph.core.IBaseClient; import com.microsoft.graph.http.BaseRequest; import com.microsoft.graph.http.HttpMethod; // **NOTE** This file was generated by a tool and any changes will be overwritten. /** * The class for the Mobile App Troubleshooting Event Request. */ public class MobileAppTroubleshootingEventRequest extends BaseRequest implements IMobileAppTroubleshootingEventRequest { /** * The request for the MobileAppTroubleshootingEvent * * @param requestUrl the request URL * @param client the service client * @param requestOptions the options for this request */ public MobileAppTroubleshootingEventRequest(final String requestUrl, final IBaseClient client, final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) { super(requestUrl, client, requestOptions, MobileAppTroubleshootingEvent.class); } /** * Gets the MobileAppTroubleshootingEvent from the service * * @param callback the callback to be called after success or failure */ public void get(final ICallback<? super MobileAppTroubleshootingEvent> callback) { send(HttpMethod.GET, callback, null); } /** * Gets the MobileAppTroubleshootingEvent from the service * * @return the MobileAppTroubleshootingEvent from the request * @throws ClientException this exception occurs if the request was unable to complete for any reason */ public MobileAppTroubleshootingEvent get() throws ClientException { return send(HttpMethod.GET, null); } /** * Delete this item from the service * * @param callback the callback when the deletion action has completed */ public void delete(final ICallback<? super MobileAppTroubleshootingEvent> callback) { send(HttpMethod.DELETE, callback, null); } /** * Delete this item from the service * * @throws ClientException if there was an exception during the delete operation */ public void delete() throws ClientException { send(HttpMethod.DELETE, null); } /** * Patches this MobileAppTroubleshootingEvent with a source * * @param sourceMobileAppTroubleshootingEvent the source object with updates * @param callback the callback to be called after success or failure */ public void patch(final MobileAppTroubleshootingEvent sourceMobileAppTroubleshootingEvent, final ICallback<? super MobileAppTroubleshootingEvent> callback) { send(HttpMethod.PATCH, callback, sourceMobileAppTroubleshootingEvent); } /** * Patches this MobileAppTroubleshootingEvent with a source * * @param sourceMobileAppTroubleshootingEvent the source object with updates * @return the updated MobileAppTroubleshootingEvent * @throws ClientException this exception occurs if the request was unable to complete for any reason */ public MobileAppTroubleshootingEvent patch(final MobileAppTroubleshootingEvent sourceMobileAppTroubleshootingEvent) throws ClientException { return send(HttpMethod.PATCH, sourceMobileAppTroubleshootingEvent); } /** * Creates a MobileAppTroubleshootingEvent with a new object * * @param newMobileAppTroubleshootingEvent the new object to create * @param callback the callback to be called after success or failure */ public void post(final MobileAppTroubleshootingEvent newMobileAppTroubleshootingEvent, final ICallback<? super MobileAppTroubleshootingEvent> callback) { send(HttpMethod.POST, callback, newMobileAppTroubleshootingEvent); } /** * Creates a MobileAppTroubleshootingEvent with a new object * * @param newMobileAppTroubleshootingEvent the new object to create * @return the created MobileAppTroubleshootingEvent * @throws ClientException this exception occurs if the request was unable to complete for any reason */ public MobileAppTroubleshootingEvent post(final MobileAppTroubleshootingEvent newMobileAppTroubleshootingEvent) throws ClientException { return send(HttpMethod.POST, newMobileAppTroubleshootingEvent); } /** * Creates a MobileAppTroubleshootingEvent with a new object * * @param newMobileAppTroubleshootingEvent the object to create/update * @param callback the callback to be called after success or failure */ public void put(final MobileAppTroubleshootingEvent newMobileAppTroubleshootingEvent, final ICallback<? super MobileAppTroubleshootingEvent> callback) { send(HttpMethod.PUT, callback, newMobileAppTroubleshootingEvent); } /** * Creates a MobileAppTroubleshootingEvent with a new object * * @param newMobileAppTroubleshootingEvent the object to create/update * @return the created MobileAppTroubleshootingEvent * @throws ClientException this exception occurs if the request was unable to complete for any reason */ public MobileAppTroubleshootingEvent put(final MobileAppTroubleshootingEvent newMobileAppTroubleshootingEvent) throws ClientException { return send(HttpMethod.PUT, newMobileAppTroubleshootingEvent); } /** * Sets the select clause for the request * * @param value the select clause * @return the updated request */ public IMobileAppTroubleshootingEventRequest select(final String value) { getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$select", value)); return (MobileAppTroubleshootingEventRequest)this; } /** * Sets the expand clause for the request * * @param value the expand clause * @return the updated request */ public IMobileAppTroubleshootingEventRequest expand(final String value) { getQueryOptions().add(new com.microsoft.graph.options.QueryOption("$expand", value)); return (MobileAppTroubleshootingEventRequest)this; } }
42.92638
183
0.732886
25857cdf90b21bd3cbe5ef3eefcbde1e032e2867
18,077
package com.telenordigital.nbiot; import java.io.IOException; import java.net.URI; import java.time.Instant; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Stream; import org.apache.http.HttpStatus; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.ObjectMapper; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.WebSocketClient; /** * This is the client for the Telenor NB-IoT REST API. */ public class Client { private static final Logger logger = Logger.getLogger(Client.class.getName()); private static final String TOKEN_HEADER = "X-API-Token"; private final String endpoint; private final String token; /** * Default data search parameters. * * Used if no search parameters is provided in {@link #data(String, String)} and {@link #data(String)} */ public final DataSearchParameters DEFAULT_DATA_SEARCH_PARAMS = new ImmutableDataSearchParameters.Builder() .limit(255) .since(null) .until(null) .build(); static { Unirest.setObjectMapper(new ObjectMapper() { private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .setSerializationInclusion(Include.NON_NULL); public <T> T readValue(String value, Class<T> valueType) { try { return jacksonObjectMapper.readValue(value, valueType); } catch (IOException e) { throw new RuntimeException(e); } } public String writeValue(Object value) { try { return jacksonObjectMapper.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }); } /** * Create a new Telenor NB-IoT client using the configuration. The configuration * can either be set by adding a ${HOME}/.telenor-nbiot file or by setting the * environment variables TELENOR_NBIOT_ADDRESS and TELENOR_NBIOT_TOKEN. The environment * variables override the configuration file. */ public Client() throws ClientException { final Config cfg = new Config(); this.token = cfg.token(); this.endpoint = cfg.endpoint(); ping(); } /** * Create a new Telenor NB-IoT client with the specified endpoint and token. */ public Client(final String endpoint, final String token) { this.endpoint = endpoint; this.token = token; } /** * Ping the backend to ensure it is reachable */ private void ping() throws ClientException { try { final HttpResponse<String> resp = Unirest .get(endpoint + "/") .header(TOKEN_HEADER, token) .asString(); if (resp.getStatus() == HttpStatus.SC_FORBIDDEN) { throw new ClientException(resp); } } catch (UnirestException ex) { throw new ClientException(ex); } } /** * generic GET on a resource */ private <T> T get(final String path, final Class<T> cls) throws ClientException { try { final HttpResponse<T> resp = Unirest .get(endpoint + path) .header(TOKEN_HEADER, token) .asObject(cls); if (resp.getStatus() >= 300) { throw new ClientException(resp); } return resp.getBody(); } catch (final UnirestException ue) { throw new ClientException(ue); } } private OutputDataMessageInternal.OutputDataMessageListInternal getData(final String path, DataSearchParameters parameters) throws ClientException { try { Instant since = parameters.since(); Instant until = parameters.until(); final HttpResponse<OutputDataMessageInternal.OutputDataMessageListInternal> resp = Unirest .get(endpoint + path) .header(TOKEN_HEADER, token) .queryString("limit", parameters.limit()) .queryString("since", since != null ? since.toEpochMilli() : null) .queryString("until", until != null ? until.toEpochMilli() : null) .asObject(OutputDataMessageInternal.OutputDataMessageListInternal.class); if (resp.getStatus() >= 300) { throw new ClientException(resp); } return resp.getBody(); } catch (final UnirestException ue) { throw new ClientException(ue); } } /** * generic POST on a resource */ private <T, U> U create(final String path, final T template, final Class<U> cls) throws ClientException { try { final HttpResponse<U> resp = Unirest .post(endpoint + path) .header(TOKEN_HEADER, token) .body(template) .asObject(cls); if (resp.getStatus() >= 300) { throw new ClientException(resp); } return resp.getBody(); } catch (final UnirestException ue) { throw new ClientException(ue); } } /** * generic PATCH on a resource */ private <T> T update(final String path, T updated, final Class<T> cls) throws ClientException { try { final HttpResponse<T> resp = Unirest .patch(endpoint + path) .header(TOKEN_HEADER, token) .body(updated) .asObject(cls); if (resp.getStatus() >= 300) { throw new ClientException(resp); } return resp.getBody(); } catch (final UnirestException ue) { throw new ClientException(ue); } } /** * generic DELETE on a resource */ private void delete(final String path) throws ClientException { try { final HttpResponse<String> resp = Unirest .delete(endpoint + path) .header(TOKEN_HEADER, token) .asString(); if (resp.getStatus() >= 300) { throw new ClientException(resp); } } catch (final UnirestException ue) { throw new ClientException(ue); } } /** * Retrieve the system configuration */ public SystemDefaults systemDefaults() throws ClientException { return get("/system", SystemDefaults.class); } /** * Retrieve a team. */ public Team team(final String teamID) throws ClientException { return get("/teams/" + teamID, Team.class); } /** * Retrieve all teams the user has access to. */ public Team[] teams() throws ClientException { return get("/teams", Team.TeamList.class).teams(); } /** * Create a new team. */ public Team createTeam(final Team team) throws ClientException { return create("/teams", team, Team.class); } /** * Update a team member role. */ public Member updateTeamMemberRole(final String teamID, final String userID, final String role) throws ClientException { Member member = new ImmutableMember.Builder().userID(userID).build(); return update(String.format("/teams/%s/members/%s", teamID, userID), member, Member.class); } /** * Delete a team member. */ public void deleteTeamMember(final String teamID, final String userID) throws ClientException { delete(String.format("/teams/%s/members/%s", teamID, userID)); } /** * Delete a team tag. */ public void deleteTeamTag(final String teamID, final String key) throws ClientException { delete(String.format("/teams/%s/tags/%s", teamID, key)); } /** * Update a team. * No tags are deleted, only added or updated. */ public Team updateTeam(final Team team) throws ClientException { return update("/teams/" + team.id(), team, Team.class); } /** * Delete a team. */ public void deleteTeam(final String teamID) throws ClientException { delete("/teams/" + teamID); } /** * Retrieve an invite. */ public Invite invite(final String teamID, final String code) throws ClientException { return get(String.format("/teams/%s/invites/%s", teamID, code), Invite.class); } /** * Retrieve all invites to a team. */ public Invite[] invites(final String teamID) throws ClientException { return get(String.format("/teams/%s/invites", teamID), Invite.InviteList.class).invites(); } /** * Create a new invite. */ public Invite createInvite(final String teamID) throws ClientException { return create(String.format("/teams/%s/invites", teamID), null, Invite.class); } /** * Accept an invite. */ public Team acceptInvite(final String code) throws ClientException { Invite invite = new ImmutableInvite.Builder().code(code).createdAt(0).build(); return create("/teams/accept", invite, Team.class); } /** * Delete an invite. */ public void deleteInvite(final String teamID, final String code) throws ClientException { delete(String.format("/teams/%s/invites/%s", teamID, code)); } /** * Retrieve a collection. */ public Collection collection(final String collectionID) throws ClientException { return get("/collections/" + collectionID, Collection.class); } /** * Retrieve all collections the user has access to. */ public Collection[] collections() throws ClientException { return get("/collections", Collection.CollectionList.class).collections(); } /** * Create a new collection. */ public Collection createCollection(final Collection collection) throws ClientException { return create("/collections", collection, Collection.class); } /** * Update a collection. * No tags are deleted, only added or updated. */ public Collection updateCollection(final Collection collection) throws ClientException { return update("/collections/" + collection.id(), collection, Collection.class); } /** * Delete a collection tag. */ public void deleteCollectionTag(final String collectionID, final String key) throws ClientException { delete(String.format("/collections/%s/tags/%s", collectionID, key)); } /** * Delete a collection. */ public void deleteCollection(final String collectionID) throws ClientException { delete("/collections/" + collectionID); } /** * Fetch data for a collection * * @param collectionID Collection id as string * @return A list of OutputDataMessage * @throws ClientException */ public OutputDataMessage[] data(final String collectionID) throws ClientException { OutputDataMessageInternal[] internalDataMessageList = getData( "/collections/" + collectionID + "/data", DEFAULT_DATA_SEARCH_PARAMS ).messages(); return mapDataMessagesFromInternal(internalDataMessageList); } /** * Fetch data for a collection * * @param collectionID Collection id as string * @param parameters Map of DataSearchParameters * @return A list of OutputDataMessage * @throws ClientException */ public OutputDataMessage[] data(final String collectionID, DataSearchParameters parameters) throws ClientException { OutputDataMessageInternal[] internalDataMessageList = getData( "/collections/" + collectionID + "/data", parameters ).messages(); return mapDataMessagesFromInternal(internalDataMessageList); } /** * Broadcast a messsage to all devices in a collection. */ public BroadcastResult broadcast(final String collectionID, final DownstreamMessage msg) throws ClientException { return create(String.format("/collections/%s/to", collectionID), msg, BroadcastResult.class); } /** * Retrieve a device. */ public Device device(final String collectionID, final String deviceID) throws ClientException { return get("/collections/" + collectionID + "/devices/" + deviceID, Device.class); } /** * Retrieve all devices in a collection. */ public Device[] devices(final String collectionID) throws ClientException { return get("/collections/" + collectionID + "/devices", Device.DeviceList.class).devices(); } /** * Create a device. */ public Device createDevice(final String collectionID, final Device device) throws ClientException { return create("/collections/" + collectionID + "/devices", device, Device.class); } /** * Update a device. * No tags are deleted, only added or updated. */ public Device updateDevice(final String collectionID, final Device device) throws ClientException { return update("/collections/" + collectionID + "/devices/" + device.id(), device, Device.class); } /** * Delete a device tag. */ public void deleteDeviceTag(final String collectionID, final String deviceID, final String key) throws ClientException { delete(String.format("/collections/%s/devices/%s/tags/%s", collectionID, deviceID, key)); } /** * Delete a device. */ public void deleteDevice(final String collectionID, final String deviceID) throws ClientException { delete("/collections/" + collectionID + "/devices/" + deviceID); } /** * Fetch data for a device * * @param collectionID Collection id as string * @param deviceId Device id as string * @return A list of OutputDataMessage * @throws ClientException */ public OutputDataMessage[] data(final String collectionID, final String deviceId) throws ClientException { OutputDataMessageInternal[] internalDataMessageList = getData( "/collections/" + collectionID + "/devices/" + deviceId + "/data", DEFAULT_DATA_SEARCH_PARAMS ).messages(); return mapDataMessagesFromInternal(internalDataMessageList); } /** * Fetch data for a device * * @param collectionID Collection id as string * @param deviceId Device id as string * @param parameters Map of DataSearchParameters * @return A list of OutputDataMessage * @throws ClientException */ public OutputDataMessage[] data(final String collectionID, final String deviceId, DataSearchParameters parameters) throws ClientException { OutputDataMessageInternal[] internalDataMessageList = getData( "/collections/" + collectionID + "/devices/" + deviceId + "/data", parameters ).messages(); return mapDataMessagesFromInternal(internalDataMessageList); } /** * Send a messsage to a device. */ public void send(final String collectionID, final String deviceID, final DownstreamMessage msg) throws ClientException { create(String.format("/collections/%s/devices/%s/to", collectionID, deviceID), msg, Object.class); } /** * Retrieve an output. */ public Output output(final String collectionID, final String outputID) throws ClientException { return get("/collections/" + collectionID + "/outputs/" + outputID, OutputInternal.class).toOutput(); } /** * Retrieve all outputs in a collection. */ public Output[] outputs(final String collectionID) throws ClientException { OutputInternal[] outputs = get("/collections/" + collectionID + "/outputs", OutputInternal.OutputList.class).outputs(); return Stream.of(outputs).map(o -> o.toOutput()).toArray(Output[]::new); } /** * Create an output. */ public Output createOutput(final String collectionID, final Output output) throws ClientException { return create("/collections/" + collectionID + "/outputs", output.toInternal(), OutputInternal.class).toOutput(); } /** * Update an output. * No tags are deleted, only added or updated. */ public Output updateOutput(final String collectionID, final Output output) throws ClientException { return update(String.format("/collections/%s/outputs/%s", collectionID, output.id()), output.toInternal(), OutputInternal.class).toOutput(); } /** * Retrieve output logs. */ public OutputLogEntry[] outputLogs(final String collectionID, final String outputID) throws ClientException { return get(String.format("/collections/%s/outputs/%s/logs", collectionID, outputID), OutputLogEntry.OutputLog.class).logs(); } /** * Retrieve output status. */ public OutputStatus outputStatus(final String collectionID, final String outputID) throws ClientException { return get(String.format("/collections/%s/outputs/%s/status", collectionID, outputID), OutputStatus.class); } /** * Delete a output tag. */ public void deleteOutputTag(final String collectionID, final String outputID, final String key) throws ClientException { delete(String.format("/collections/%s/outputs/%s/tags/%s", collectionID, outputID, key)); } /** * Delete an output. */ public void deleteOutput(final String collectionID, final String outputID) throws ClientException { delete("/collections/" + collectionID + "/outputs/" + outputID); } /** * Receive data messages sent by all devices in a collection. */ public WebSocketClient outputStream(final String collectionID, Consumer<OutputStreamHandler> handler) { return initiateDataMessageStream("/collections/" + collectionID, handler); } /** * Receive data messages sent by a device. */ public WebSocketClient outputStream(final String collectionID, final String deviceID, Consumer<OutputStreamHandler> handler) { return initiateDataMessageStream("/collections/" + collectionID + "/devices/" + deviceID, handler); } private WebSocketClient initiateDataMessageStream(final String path, Consumer<OutputStreamHandler> handler) { WebSocketClient client = new WebSocketClient(); client.getSslContextFactory().setEndpointIdentificationAlgorithm("HTTPS"); OutputStreamHandler outputStreamHandler = new OutputStreamHandler(); try { client.start(); URI endpointURI = new URI(endpoint); String scheme = "wss"; if (endpointURI.getScheme().equals("http")) { scheme = "ws"; } URI uri = new URI( scheme, null, endpointURI.getHost(), endpointURI.getPort(), path + "/from", null, null ); ClientUpgradeRequest request = new ClientUpgradeRequest(); request.setHeader(TOKEN_HEADER, token); handler.accept(outputStreamHandler); client.connect(new WebSocketHandler(outputStreamHandler), uri, request); } catch (Exception e) { logger.log(Level.WARNING, "Failed to set up websocket.", e); } return client; } private OutputDataMessage[] mapDataMessagesFromInternal(OutputDataMessageInternal[] internalMessages) { return Stream.of(internalMessages).map(internalDataMessage -> new ImmutableOutputDataMessage.Builder() .device(internalDataMessage.device()) .payload(internalDataMessage.payload()) .received(java.time.Instant.ofEpochMilli(internalDataMessage.received())) .build() ).toArray(OutputDataMessage[]::new); } }
30.078203
142
0.716657
e7cd6eeea53f91c5827e7333a6087227e3c0d3b8
2,771
package de.evoila.cf.backup.controller; import de.evoila.cf.backup.controller.exception.BackupException; import de.evoila.cf.backup.service.BackupPlanService; import de.evoila.cf.model.api.BackupPlan; import org.bson.types.ObjectId; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; /** * @author Yannic Remmet, Johannes Hiemer. */ @Controller public class BackupPlanController { BackupPlanService backupPlanService; public BackupPlanController(BackupPlanService backupPlanService) { this.backupPlanService = backupPlanService; } @RequestMapping(value = "/backupPlans/byInstance/{instanceId}", method = RequestMethod.GET) public ResponseEntity<Page<BackupPlan>> all(@PathVariable() String instanceId, @PageableDefault(size = 50, page = 0) Pageable pageable) { Page<BackupPlan> response = backupPlanService.getPlans(instanceId, pageable); return new ResponseEntity<>(response, HttpStatus.OK); } @RequestMapping(value = "/backupPlans", method = RequestMethod.POST) public ResponseEntity<BackupPlan> create(@RequestBody BackupPlan plan) throws BackupException { BackupPlan response = backupPlanService.createPlan(plan); return new ResponseEntity<>(response, HttpStatus.CREATED); } @RequestMapping(value = "/backupPlans/{planId}", method = RequestMethod.GET) public ResponseEntity<BackupPlan> get(@PathVariable() ObjectId planId) { BackupPlan response = backupPlanService.getPlan(planId); return new ResponseEntity<>(response, HttpStatus.OK); } @RequestMapping(value = "/backupPlans/{planId}", method = RequestMethod.DELETE) public ResponseEntity<BackupPlan> delete(@PathVariable() ObjectId planId) { BackupPlan response = backupPlanService.deletePlan(planId); return new ResponseEntity<>(response, HttpStatus.OK); } @RequestMapping(value = "/backupPlans/{planId}", method = RequestMethod.PATCH) public ResponseEntity<BackupPlan> update(@PathVariable() ObjectId planId, @RequestBody BackupPlan plan) throws BackupException { BackupPlan response = backupPlanService.updatePlan(planId, plan); return new ResponseEntity<>(response, HttpStatus.OK); } }
40.75
112
0.748466
52ca705e8f9f425f8c46dcdf6ae466d217d7b7ba
17,841
package im.heart.common.web; import com.alibaba.fastjson.JSON; import com.google.common.collect.Maps; import im.heart.common.EmailTplEnum; import im.heart.common.SmsTplEnum; import im.heart.common.utils.CacheUtils; import im.heart.core.CommonConst; import im.heart.core.CommonConst.RequestResult; import im.heart.core.plugins.captcha.ImageCaptchaExService; import im.heart.core.plugins.email.SendEmailService; import im.heart.core.plugins.sms.SmsSendService; import im.heart.core.utils.BaseUtils; import im.heart.core.utils.StringUtilsEx; import im.heart.core.web.AbstractController; import im.heart.core.web.ResponseError; import im.heart.core.web.enums.WebError; import im.heart.core.web.utils.WebUtilsEx; import im.heart.usercore.entity.FrameUser; import im.heart.usercore.service.FrameUserService; import im.heart.usercore.vo.FrameUserVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Map; /** * * @author gg * @desc 用户找回密码控制器 */ @Controller public class FindPwdController extends AbstractController { protected static final String apiVer = "/findPwd"; @Autowired private FrameUserService frameUserService; @Autowired private SmsSendService smsSendService; @Autowired private SendEmailService sendEmailService; @Autowired private ImageCaptchaExService imageCaptchaService; /** * 找回密码方式 */ public enum FindPwdTypeEnum { email("email",2), phone("phone",1); /** * code */ public String code; /** * intVal */ public int intVal; FindPwdTypeEnum(String code, int intVal) { this.code = code; this.intVal = intVal; } public static FindPwdTypeEnum fromCode(String code){ for(FindPwdTypeEnum refer : FindPwdTypeEnum.values()) { if (refer.code.equals(code)) { return refer; } } return null; } } /** * @Desc:忘记密码页面 * @param request * @param response * @param key * @param model * @return */ @RequestMapping(value={apiVer,apiVer+"/",apiVer+"/index"},method = RequestMethod.GET) public ModelAndView findPwdIndex(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "k", required = false) String key, ModelMap model) { model.put("k",key); this.success(model); return new ModelAndView("findpwd/index"); } @RequestMapping(value=apiVer+"/findpwd",method = RequestMethod.GET) public ModelAndView findPwd(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "k", required = false) String key, ModelMap model) { if(StringUtilsEx.isNotBlank(key)){ Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; FrameUserVO userVo=new FrameUserVO(user); this.success(model, userVo); model.put("k", key); return new ModelAndView("findpwd/findPwd"); } } ResponseError responseError=new ResponseError(WebError.INVALID_REQUEST); this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } /** * @Desc:检测帐号信息是否存在、(邮箱,电话号码。帐号 )step_1 * @param jsoncallback * @param account * @param request * @param response * @param model * @return * @throws Exception */ @RequestMapping(value = apiVer + "/checkUserAccount", method = RequestMethod.GET) protected ModelAndView checkUserPhone( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, @RequestParam(value = "account", required = false) String account, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { if(StringUtilsEx.isNotBlank(account)&&account.length() >=FrameUser.minAccountLength&& account.length() <= FrameUser.maxAccountLength){ FrameUser user = this.frameUserService.findFrameUser(account); if (user != null) { this.success(model); return new ModelAndView(RESULT_PAGE); } } this.fail(model); return new ModelAndView(RESULT_PAGE); } /** * @Desc:忘记密码页面 step_1 验证账号信息 * @param request * @param response * @param account * @param key * @param format * @param validateCode * @param model * @return */ @RequestMapping(value=apiVer+"/subGeneral") public ModelAndView subGeneral(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "account", required = false ) String account, @RequestParam(value = "k", required = false) String key, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "validateCode", required = false ) String validateCode, ModelMap model) { if(StringUtilsEx.isNotBlank(account)&& StringUtilsEx.isNotBlank(validateCode)){ String sessionId = request.getRequestedSessionId(); if(!this.imageCaptchaService.validateResponseForID(sessionId, validateCode).booleanValue()){ ResponseError responseError=new ResponseError(WebError.AUTH_CAPTCHA_INCORRECT); this.fail(model,responseError); return new ModelAndView("findpwd/index"); } FrameUser user=this.frameUserService.findFrameUser(account); if(user!=null){ this.success(model,user); String uuid= StringUtilsEx.getUUID2(); CacheUtils.generatCache(CacheUtils.CacheConfig.FIND_PWD.keyPrefix,uuid, user); if(StringUtilsEx.isBlank(format)){ format="jhtml"; } return new ModelAndView(redirectToUrl(apiVer+"/findpwd."+format+"?k="+uuid)); } } this.fail(model,new ResponseError(WebError.REQUEST_PARAMETER_MISSING)); return new ModelAndView("findpwd/index"); } /** * * @Desc:通过手机号码校验成功 * @param jsoncallback * @param request * @param response * @param format * @param key * @param model * @return */ @RequestMapping(value = apiVer + "/checkSuccess") protected ModelAndView checkSuccess(@RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "k2", required = false) String key, ModelMap model){ ResponseError responseError=new ResponseError(WebError.REQUEST_PARAMETER_MISSING); if(StringUtilsEx.isBlank(key)){ this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } model.put("k2", key); Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ this.success(model); return new ModelAndView("findpwd/resetPwd"); } this.fail(model,new ResponseError(WebError.INVALID_REQUEST)); return new ModelAndView("findpwd/resetPwd"); } /** * * @Desc:邮件发送成功 * @param jsoncallback * @param request * @param response * @param format * @param key * @param model * @return */ @RequestMapping(value = apiVer + "/sendEmailSuccess") protected ModelAndView sendEmailSuccess( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "k", required = false) String key, ModelMap model){ ResponseError responseError=new ResponseError(WebError.REQUEST_PARAMETER_MISSING); if(StringUtilsEx.isBlank(key)){ this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; String userEmail=user.getUserEmail(); if(StringUtilsEx.isNotBlank(userEmail)){ String emailServer = StringUtilsEx.substringAfterLast(userEmail, "@"); this.success(model); model.put("emailServer", emailServer); return new ModelAndView("findpwd/sendEmailSuccess"); } } this.fail(model,new ResponseError(WebError.INVALID_REQUEST)); return new ModelAndView("findpwd/sendEmailSuccess"); } /** * * @Desc 修改密码 * @param jsoncallback * @param request * @param response * @param format * @param key * @param passWord * @param retryPassWord * @param model * @return * @throws Exception */ @RequestMapping(value = apiVer + "/resetPwd") protected ModelAndView resetPwd( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "k2", required = false) String key, @RequestParam(value = "passWord", required = false) String passWord, @RequestParam(value = "retryPassWord", required = false) String retryPassWord, ModelMap model) throws Exception { logger.info(WebUtilsEx.getParametersJson(request)); if(StringUtilsEx.isBlank(key)){ this.fail(model,new ResponseError(WebError.REQUEST_PARAMETER_MISSING)); return new ModelAndView(RESULT_PAGE); } Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); logger.info(JSON.toJSONString(obj)); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; logger.info(WebUtilsEx.getParametersJson(request)); this.frameUserService.resetPassword(user.getUserId(), retryPassWord); CacheUtils.evictCache(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(StringUtilsEx.isBlank(format)){ format="jhtml"; } return new ModelAndView(redirectToUrl(apiVer+"/resetPwdSuccess."+format+"?k="+key)); } this.fail(model,new ResponseError(WebError.INVALID_REQUEST)); return new ModelAndView(RESULT_PAGE); } @RequestMapping(value = apiVer + "/checkEmailCode") protected ModelAndView checkEmailCode( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "emailCode", required = false) String emailCode, @RequestParam(value = "k", required = false) String key, ModelMap model) throws Exception { if(StringUtilsEx.isBlank(key)){ this.fail(model,new ResponseError(WebError.REQUEST_PARAMETER_MISSING)); return new ModelAndView(RESULT_PAGE); } Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser) { FrameUser user = (FrameUser) obj; String userEmail=user.getUserEmail(); if (StringUtilsEx.isBlank(format)) { format = "jhtml"; } Boolean isResponseCorrect = Boolean.FALSE; isResponseCorrect=CacheUtils.checkEmailCode(userEmail, emailCode); CacheUtils.evictCache(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(isResponseCorrect){ String key2=generatCache(user); return new ModelAndView(redirectToUrl(apiVer+"/checkSuccess."+format+"?k2="+key2)); } } this.fail(model,new ResponseError(WebError.INVALID_REQUEST)); return new ModelAndView(RESULT_PAGE); } private String generatCache(Object val){ String key=StringUtilsEx.getUUID2(); CacheUtils.generatCache(CacheUtils.CacheConfig.FIND_PWD.keyPrefix,key, val); return key; } /** * @Desc:密码修改成功页面 step_4 * @param jsoncallback * @param request * @param response * @param model * @return * @throws Exception */ @RequestMapping(value = apiVer + "/resetPwdSuccess") protected ModelAndView resetPwdSuccess( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { this.success(model); return new ModelAndView("findpwd/resetPwdSuccess"); } @RequestMapping(value = apiVer + "/sendFindPwd") protected ModelAndView sendFindPwd( @RequestParam(value = CommonConst.RequestResult.JSON_CALLBACK, required = false) String jsoncallback, HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "format", required = false) String format, @RequestParam(value = "k", required = false) String key, @RequestParam(value = "phoneCode", required = false) String phoneCode, @RequestParam(value = "type", required = false) String type, ModelMap model) throws Exception { ResponseError responseError=new ResponseError(WebError.REQUEST_PARAMETER_MISSING); if(StringUtilsEx.isBlank(key)){ this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; if(StringUtilsEx.isBlank(format)){ format="jhtml"; } if(StringUtilsEx.isNotBlank(type)&&type.equals(FindPwdTypeEnum.email.intVal+"")){ int emailCode = (int) ((Math.random() * 9 + 1) * 100000); Map<String, Object> modelTemp = Maps.newHashMap(); String userEmail=user.getUserEmail(); CacheUtils.generatEmailCodeCache(userEmail,emailCode); modelTemp.put("k", key); modelTemp.put("emailCode", emailCode); modelTemp.put(RequestResult.RESULT, user); EmailTplEnum tpl=EmailTplEnum.FIND_PWD; this.sendEmailService.sendEmail(modelTemp, tpl.description, tpl.templatePath, new String[] { userEmail }, new String[] {}); return new ModelAndView(redirectToUrl(apiVer+"/sendEmailSuccess."+format+"?k="+key)); } String mobile=user.getUserPhone(); Boolean isResponseCorrect = Boolean.FALSE; isResponseCorrect=CacheUtils.checkMobileCode(mobile, phoneCode); if(isResponseCorrect){ //移除key CacheUtils.evictCache(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); String key2=generatCache(user); return new ModelAndView(redirectToUrl(apiVer+"/checkSuccess."+format+"?k2="+key2)); } responseError=new ResponseError(WebError.AUTH_PHONECODE_INCORRECT); } this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } /** * @Desc: 发送短信验证码 * @param request * @param response * @param model */ @RequestMapping(value = apiVer + "/passMobileCode") public ModelAndView passMobileCode(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "k", required = false ) String key, @RequestParam(value = "type", required = false ,defaultValue="1") String type, ModelMap model) { ResponseError responseError=new ResponseError(WebError.REQUEST_PARAMETER_MISSING); if(StringUtilsEx.isBlank(key)){ this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; int mobileCode = (int)((Math.random()*9+1)*10000); Map<String,Object> modelTemp = Maps.newHashMap(); modelTemp.put("mobileCode", mobileCode); String mobile=user.getUserPhone(); logger.info("mobileCode-host:[{}],mobile:[{}] mobileCode:[{}] type:[{}]", BaseUtils.getIpAddr(request),mobile,mobileCode,type); CacheUtils.generateMobileCache(mobile, mobileCode); SmsTplEnum tpl= SmsTplEnum.FIND_PWD; responseError=this.smsSendService.sendSms(modelTemp, tpl.templatePath, new String[]{mobile}); if(responseError==null){ this.success(model); }else{ this.fail(model,responseError); } } return new ModelAndView(RESULT_PAGE); } /** * @Desc:验证码校验接口 * @param request * @param response * @param key * @param phoneCode * @param model * @return */ @RequestMapping(value = apiVer + "/checkMobileCode") public ModelAndView checkMobileCode(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "k", required = false ) String key, @RequestParam(value = "phoneCode", required = false) String phoneCode, ModelMap model){ ResponseError responseError=new ResponseError(WebError.REQUEST_PARAMETER_MISSING); if(StringUtilsEx.isBlank(key)){ this.fail(model,responseError); return new ModelAndView(RESULT_PAGE); } logger.info("passcode-host:"+request.getLocalAddr()); Object obj= CacheUtils.getCacheObject(CacheUtils.CacheConfig.FIND_PWD.keyPrefix, key); if(obj!=null&&obj instanceof FrameUser){ FrameUser user =(FrameUser)obj; String mobile=user.getUserPhone(); Boolean isResponseCorrect = Boolean.FALSE; isResponseCorrect=CacheUtils.checkMobileCode(mobile, phoneCode); if(isResponseCorrect){ this.success(model); return new ModelAndView(RESULT_PAGE); } } this.fail(model); return new ModelAndView(RESULT_PAGE); } }
37.56
148
0.708705
aa8233d2b4f2296f3cbc0a37535076edf05d25e9
255
package com.darian.multiplethread3; public class Demo { static volatile int a = 0; public static void main(String[] args) throws InterruptedException { Thread thread = new Thread(); thread.start(); thread.join(); } }
21.25
72
0.639216
9390e1413efbbfc074ac44afd5729a2bd10de56a
831
package com.cskaoyan.mapper; import com.cskaoyan.bean.Device; import com.cskaoyan.bean.DeviceExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface DeviceMapper { long countByExample(DeviceExample example); int deleteByExample(DeviceExample example); int deleteByPrimaryKey(String deviceId); int insert(Device record); int insertSelective(Device record); List<Device> selectByExample(DeviceExample example); Device selectByPrimaryKey(String deviceId); int updateByExampleSelective(@Param("record") Device record, @Param("example") DeviceExample example); int updateByExample(@Param("record") Device record, @Param("example") DeviceExample example); int updateByPrimaryKeySelective(Device record); int updateByPrimaryKey(Device record); }
27.7
106
0.772563
98e6cbd32999c5dbc82f387d20c66d5407908672
11,199
/** * Copyright 2017 Linagora, Université Joseph Fourier, Floralis * * The present code is developed in the scope of the joint LINAGORA - * Université Joseph Fourier - Floralis research program and is designated * as a "Result" pursuant to the terms and conditions of the LINAGORA * - Université Joseph Fourier - Floralis research program. Each copyright * holder of Results enumerated here above fully & independently holds complete * ownership of the complete Intellectual Property rights applicable to the whole * of said Results, and may freely exploit it in any manner which does not infringe * the moral rights of the other copyright holders. * * Licensed 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. */ package net.roboconf.core.errors; import java.io.File; import java.util.Objects; import net.roboconf.core.model.beans.Application; import net.roboconf.core.model.beans.ApplicationTemplate; import net.roboconf.core.model.beans.Component; import net.roboconf.core.model.beans.Facet; import net.roboconf.core.model.beans.Instance; import net.roboconf.core.utils.Utils; /** * Contextual information for {@link ErrorCode}s. * <p> * Previously, error details were passed as string. The problem is * that these strings were not translatable. This class solves this issue, * as such errors may be used in both documentation generators and web tools. * </p> * * @author Vincent Zurczak - Linagora */ public class ErrorDetails { /** * A translatable (i18n) enumeration of error kinds. * @author Vincent Zurczak - Linagora */ public enum ErrorDetailsKind { INSTANCE, VARIABLE, COMPONENT, FACET, INSTRUCTION, FILE, LINE, CYCLE, APPLICATION, APPLICATION_TEMPLATE, DIRECTORY, UNRECOGNIZED, EXPECTED, UNEXPECTED, ALREADY_DEFINED, CONFLICTING, MALFORMED, EXCEPTION, EXCEPTION_NAME, LOG_REFERENCE, NAME, VALUE; } private final String elementName; private final ErrorDetailsKind errorDetailsKind; /** * Constructor. * @param elementName * @param errorDetailsKind */ protected ErrorDetails( String elementName, ErrorDetailsKind errorDetailsKind ) { Objects.requireNonNull( errorDetailsKind ); this.elementName = elementName; this.errorDetailsKind = errorDetailsKind; } /** * @return the elementName */ public String getElementName() { return this.elementName; } /** * @return the errorDetailsKind */ public ErrorDetailsKind getErrorDetailsKind() { return this.errorDetailsKind; } /** * Used in {@link RoboconfErrorComparator}. * @see java.lang.Object#toString() */ @Override public String toString() { return this.errorDetailsKind.name() + " " + this.elementName; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals( Object obj ) { return obj != null && obj.getClass().equals( getClass()) && ((ErrorDetails) obj).errorDetailsKind == this.errorDetailsKind && Objects.equals(((ErrorDetails) obj).elementName, this.elementName ); } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return this.elementName == null ? 43 : this.elementName.hashCode(); } // Static methods to shorten the creation of details /** * Details for an instance. * @param instanceName the instance name * @return an object with error details */ public static ErrorDetails instance( String instanceName ) { return new ErrorDetails( instanceName, ErrorDetailsKind.INSTANCE ); } /** * Details for an instance. * @param instance the instance * @return an object with error details */ public static ErrorDetails instance( Instance instance ) { return new ErrorDetails( instance.getName(), ErrorDetailsKind.INSTANCE ); } /** * Details for a facet. * @param facetName the facet name * @return an object with error details */ public static ErrorDetails facet( String facetName ) { return new ErrorDetails( facetName, ErrorDetailsKind.FACET ); } /** * Details for a facet. * @param facet the facet * @return an object with error details */ public static ErrorDetails facet( Facet facet ) { return facet( facet.getName()); } /** * Details for a component. * @param componentName the component name * @return an object with error details */ public static ErrorDetails component( String componentName ) { return new ErrorDetails( componentName, ErrorDetailsKind.COMPONENT ); } /** * Details for a component. * @param component the component * @return an object with error details */ public static ErrorDetails component( Component component ) { return new ErrorDetails( component.getName(), ErrorDetailsKind.COMPONENT ); } /** * Details for an application. * @param app the application * @return an object with error details */ public static ErrorDetails application( Application app ) { return new ErrorDetails( app.getName(), ErrorDetailsKind.APPLICATION ); } /** * Details for an application. * @param appName the application's name * @return an object with error details */ public static ErrorDetails application( String appName ) { return new ErrorDetails( appName, ErrorDetailsKind.APPLICATION ); } /** * Details for an application template. * @param tpl the application template * @return an object with error details */ public static ErrorDetails applicationTpl( ApplicationTemplate tpl ) { return applicationTpl( tpl.getName(), tpl.getVersion()); } /** * Details for an application. * @param tplName the template's name * @param tplVersion the template's version * @return an object with error details */ public static ErrorDetails applicationTpl( String tplName, String tplVersion ) { return new ErrorDetails( tplName + " (" + tplVersion + ")", ErrorDetailsKind.APPLICATION_TEMPLATE ); } /** * Details for a variable. * @param variableName the variable name * @return an object with error details */ public static ErrorDetails variable( String variableName ) { return new ErrorDetails( variableName, ErrorDetailsKind.VARIABLE ); } /** * Details for a file. * @param file the file * @return an object with error details */ public static ErrorDetails file( File file ) { return file( file.getAbsolutePath()); } /** * Details for a file. * @param filePath the file path * @return an object with error details */ public static ErrorDetails file( String filePath ) { return new ErrorDetails( filePath, ErrorDetailsKind.FILE ); } /** * Details for a directory. * @param file the directory * @return an object with error details */ public static ErrorDetails directory( File directory ) { return directory( directory.getAbsolutePath()); } /** * Details for a directory. * @param filePath the directory path * @return an object with error details */ public static ErrorDetails directory( String filePath ) { return new ErrorDetails( filePath, ErrorDetailsKind.DIRECTORY ); } /** * Details for an unrecognized element. * @param unrecognizedName the element that was not recognized * @return an object with error details */ public static ErrorDetails unrecognized( String unrecognizedName ) { return new ErrorDetails( unrecognizedName, ErrorDetailsKind.UNRECOGNIZED ); } /** * Details for something that was expected. * @param expectedName the expected value * @return an object with error details */ public static ErrorDetails expected( String expectedName ) { return new ErrorDetails( expectedName, ErrorDetailsKind.EXPECTED ); } /** * Details for something that was unexpected. * @param unexpectedName the unexpectedName value * @return an object with error details */ public static ErrorDetails unexpected( String unexpectedName ) { return new ErrorDetails( unexpectedName, ErrorDetailsKind.UNEXPECTED ); } /** * Details for something that was malformed. * @param malformedName the malformed item * @return an object with error details */ public static ErrorDetails malformed( String malformedName ) { return new ErrorDetails( malformedName, ErrorDetailsKind.MALFORMED ); } /** * Details for an element name. * @param name a name * @return an object with error details */ public static ErrorDetails name( String name ) { return new ErrorDetails( name, ErrorDetailsKind.NAME ); } /** * Details for an instruction. * @param instruction an instruction * @return an object with error details */ public static ErrorDetails instruction( String instruction ) { return new ErrorDetails( instruction, ErrorDetailsKind.INSTRUCTION ); } /** * Details for a cycle. * @param cycle a cycle's description * @return an object with error details */ public static ErrorDetails cycle( String cycle ) { return new ErrorDetails( cycle, ErrorDetailsKind.CYCLE ); } /** * Details for an exception. * @param t a throwable * @return an object with error details */ public static ErrorDetails exception( Throwable t ) { return new ErrorDetails( Utils.writeExceptionButDoNotUseItForLogging( t ), ErrorDetailsKind.EXCEPTION ); } /** * Details for an exception name. * @param t a throwable * @return an object with error details */ public static ErrorDetails exceptionName( Throwable t ) { return new ErrorDetails( t.getClass().getName(), ErrorDetailsKind.EXCEPTION_NAME ); } /** * Details for a reference in the logs. * @param logReference something to search for in the logs (e.g. UUID) * @return an object with error details */ public static ErrorDetails logReference( String logReference ) { return new ErrorDetails( logReference, ErrorDetailsKind.LOG_REFERENCE ); } /** * Details for an element that is already defined. * @param name a name * @return an object with error details */ public static ErrorDetails alreadyDefined( String name ) { return new ErrorDetails( name, ErrorDetailsKind.ALREADY_DEFINED ); } /** * Details for a conflicting element. * @param name a name * @return an object with error details */ public static ErrorDetails conflicting( String name ) { return new ErrorDetails( name, ErrorDetailsKind.CONFLICTING ); } /** * Details for a value. * @param value a value * @return an object with error details */ public static ErrorDetails value( String value ) { return new ErrorDetails( value, ErrorDetailsKind.VALUE ); } /** * Details for a line number. * @param line a line number * @return an object with error details */ public static ErrorDetails line( int line ) { return new ErrorDetails( String.valueOf( line ), ErrorDetailsKind.LINE ); } }
25.627002
106
0.722118
3c9b623ead4149a626848b74d4cc4547e688aca5
9,792
/** * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * * Copyright (c) 2012 - SCAPI (http://crypto.biu.ac.il/scapi) * This file is part of the SCAPI project. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * We request that any publication and/or code referring to and/or based on SCAPI contain an appropriate citation to SCAPI, including a reference to * http://crypto.biu.ac.il/SCAPI. * * SCAPI uses Crypto++, Miracl, NTL and Bouncy Castle. Please see these projects for any further licensing issues. * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% * */ package edu.biu.scapi.interactiveMidProtocols.ot.otBatch.otExtension; import edu.biu.scapi.comm.Channel; import edu.biu.scapi.comm.Party; import edu.biu.scapi.interactiveMidProtocols.ot.otBatch.OTBatchSInput; import edu.biu.scapi.interactiveMidProtocols.ot.otBatch.OTBatchSOutput; import edu.biu.scapi.interactiveMidProtocols.ot.otBatch.OTBatchSender; import edu.biu.scapi.securityLevel.Malicious; /** * A concrete class for Malicious OT extension sender. <P> * * The base OT is done once in the construction time. After that, the transfer function will be always optimized and fast, no matter how much OT's there are. * * There are three versions of OT extension: General, Correlated and Random. The difference between them is the way of getting the inputs: <p> * In general OT extension both x0 and x1 are given by the user.<p> * In Correlated OT extension the user gives a delta array and x0, x1 arrays are chosen such that x0 = delta^x1.<p> * In random OT extension both x0 and x1 are chosen randomly.<p> * To allow the user decide which OT extension's version he wants, each option has a corresponding input class. <p> * The particular OT extension version is executed according to the given input instance; * For example, if the user gave as input an instance of OTExtensionRandomSInput than the random OT Extension will be execute.<p> * * NOTE: Unlike a regular implementation the connection is done via the native code and thus the channel provided in the transfer function is ignored. * * @author Cryptography and Computer Security Research Group Department of Computer Science Bar-Ilan University (Meital Levy, Asaf Cohen) * */ public class OTExtensionMaliciousSender implements Malicious, OTBatchSender{ private static final String OT_EXTENSION_TYPE_GENERAL = "general"; private static final String OT_EXTENSION_TYPE_CORRELATED = "correlated"; private static final String OT_EXTENSION_TYPE_RANDOM = "random"; private long senderPtr; //Pointer that holds the sender pointer in the c++ code. // This function initializes the sender. It creates sockets to communicate with the sender and attaches these sockets to the receiver object. // It outputs the receiver object with communication abilities built in. private native long initOtSender(String ipAddress, int port, int numOfThreads, int numBaseOts, int numOts); /* * The native code that runs the OT extension as the sender. * @param senderPtr The pointer initialized via the function initOtSender. * @param x0 An array that holds all the x0 values for each of the OT's serially (concatenated). * @param x1 An array that holds all the x1 values for each of the OT's serially (concatenated). * @param delta * @param numOfOts The number of OTs that the protocol runs (how many strings are inside x0?) * @param bitLength The length (in bits) of each item in the OT. can be derived from |x0|, |x1|, numOfOts * @param version the OT extension version the user wants to use. */ private native void runOtAsSender(long senderPtr, byte[] x0, byte[]x1, byte[] delta, int numOfOts, int bitLength, String version); //Deletes the native sender. private native void deleteSender(long senderPtr); /** * A constructor that creates the native sender with communication abilities. It uses the ip address and port given in the party object.<p> * The construction runs the base OT phase. Further calls to transfer function will be optimized and fast, no matter how much OTs there are. * THE SENDER ACTS AS THE SERVER!!! * @param party An object that holds the ip address and port. * @param koblitzOrZpSize An integer that determines whether the OT extension uses Zp or ECC koblitz. The optional parameters are the following. * 163,233,283 for ECC koblitz and 1024, 2048, 3072 for Zp. * @param numOfThreads */ public OTExtensionMaliciousSender(String bindAddress, int listeningPort, int numOfThreads, int numBaseOts, int numOts){ // Create the sender by passing the local host address. senderPtr = initOtSender(bindAddress, listeningPort, numOfThreads, numBaseOts, numOts); } /** * Default constructor. Initializes the sender by passing the ip address and uses koblitz 163 as a default dlog group.<P> * The construction runs the base OT phase. Further calls to transfer function will be optimized and fast, no matter how much OTs there are. * @param party An object that holds the ip address and port. */ public OTExtensionMaliciousSender(String bindAddress, int listeningPort, int numOts){ // Create the sender by passing the local host address. senderPtr = initOtSender(bindAddress, listeningPort, 1, 190, numOts); } /** * The overloaded function that runs the protocol.<p> * After the base OT was done by the constructor, call to this function will be optimized and fast, no matter how much OTs there are. * @param channel Disregarded. This is ignored since the connection is done in the c++ code. * @param input The input for the sender specifying the version of the OT extension to run. * Every call to the transfer function can run a different OT extension version. */ public OTBatchSOutput transfer(Channel channel, OTBatchSInput input) { assert (senderPtr != 0) : "sender pointer was released!"; int numOfOts; // In case the given input is general input. if (input instanceof OTExtensionGeneralSInput){ //Retrieve the values from the input object. byte[] x0 = ((OTExtensionGeneralSInput) input).getX0Arr(); byte[] x1 = ((OTExtensionGeneralSInput) input).getX1Arr(); numOfOts = ((OTExtensionGeneralSInput) input).getNumOfOts(); //Call the native function. int bitLength = (x0.length/numOfOts)*8; runOtAsSender(senderPtr, x0, x1, null, numOfOts, bitLength, OT_EXTENSION_TYPE_GENERAL); //This version has no output. Return null. return null; //In case the given input is correlated input. } else if(input instanceof OTExtensionCorrelatedSInput){ byte[] delta = ((OTExtensionCorrelatedSInput) input).getDelta(); // Prepare empty x0 and x1 for the output. byte[] x0 = new byte[delta.length]; byte[] x1 = new byte[delta.length]; numOfOts = ((OTExtensionCorrelatedSInput) input).getNumOfOts(); //Call the native function. It will fill x0 and x1. runOtAsSender(senderPtr, x0, x1, delta, numOfOts, delta.length/numOfOts*8, OT_EXTENSION_TYPE_CORRELATED); //Return output contains x0, x1. return new OTExtensionSOutput(x0,x1); //In case the given input is random input. } else if(input instanceof OTExtensionRandomSInput){ numOfOts = ((OTExtensionRandomSInput) input).getNumOfOts(); int bitLength = ((OTExtensionRandomSInput) input).getBitLength(); //Prepare empty x0 and x1 for the output. byte[] x0 = new byte[numOfOts * bitLength/8]; byte[] x1 = new byte[numOfOts * bitLength/8]; //Call the native function. It will fill x0 and x1. runOtAsSender(senderPtr, x0, x1, null, numOfOts, bitLength, OT_EXTENSION_TYPE_RANDOM); //Return output contains x0, x1. return new OTExtensionSOutput(x0,x1); //If input is not instance of the above inputs, throw Exception. } else { throw new IllegalArgumentException("input should be an instance of OTExtensionGeneralSInput or OTExtensionCorrelatedSInput or OTExtensionRandomSInput."); } } /** * Deletes the native OT object. * This function MUST be called after the OT is finished!!! * The user of this class SHOULD NOT wait for the finalize() function, * since we don't know when the garbage collector will collect this class. */ public void releaseResources() { //Delete from the dll the dynamic allocation of the receiver. if (0 != senderPtr) { deleteSender(senderPtr); senderPtr = 0; } } /** * Deletes the native OT object, ideally the resources were already released explicitly. */ public void finalize() throws Throwable { releaseResources(); } static { // Loads the MaliciousOtExtensionJavaInterface jni dll. System.loadLibrary("MaliciousOtExtensionJavaInterface"); } }
49.959184
157
0.738358
de7537ccd6df4d3a80349f4b7d9d66de0331ac04
2,837
package com.microsoft.appcenter.assets; import com.microsoft.appcenter.utils.AppCenterLog; import com.microsoft.appcenter.assets.exceptions.AssetsIllegalArgumentException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import static org.junit.Assert.assertEquals; import static org.powermock.api.mockito.PowerMockito.mockStatic; @RunWith(PowerMockRunner.class) @PrepareForTest({AppCenterLog.class}) public class ConfigurationUnitTests { private final static String CLIENT_UNIQUE_ID = "YHFv65"; private final static String DEPLOYMENT_KEY = "ABC123"; private final static String APP_VERSION = "2.2.1"; private final static String PACKAGE_HASH = "HASH"; private final static String SERVER_URL = "https"; @Before public void setUp() { mockStatic(AppCenterLog.class); } @Test public void correctConfigurationTest() throws Exception { AssetsConfiguration correctConfig = new AssetsConfiguration(); correctConfig.setAppVersion(APP_VERSION) .setClientUniqueId(CLIENT_UNIQUE_ID) .setDeploymentKey(DEPLOYMENT_KEY) .setPackageHash(PACKAGE_HASH) .setServerUrl(SERVER_URL); assertEquals(APP_VERSION, correctConfig.getAppVersion()); assertEquals(CLIENT_UNIQUE_ID, correctConfig.getClientUniqueId()); assertEquals(DEPLOYMENT_KEY, correctConfig.getDeploymentKey()); assertEquals(PACKAGE_HASH, correctConfig.getPackageHash()); assertEquals(SERVER_URL, correctConfig.getServerUrl()); /* Package hash can be null. */ correctConfig.setPackageHash(null); assertEquals(null, correctConfig.getPackageHash()); } @Test(expected = AssetsIllegalArgumentException.class) public void wrongConfigurationAppVersionNull() throws Exception { AssetsConfiguration wrongConfig = new AssetsConfiguration(); wrongConfig.setAppVersion(null); } @Test(expected = AssetsIllegalArgumentException.class) public void wrongConfigurationClientIdNull() throws Exception { AssetsConfiguration wrongConfig = new AssetsConfiguration(); wrongConfig.setClientUniqueId(null); } @Test(expected = AssetsIllegalArgumentException.class) public void wrongConfigurationDeploymentKeyNull() throws Exception { AssetsConfiguration wrongConfig = new AssetsConfiguration(); wrongConfig.setDeploymentKey(null); } @Test(expected = AssetsIllegalArgumentException.class) public void wrongConfigurationServerUrlNull() throws Exception { AssetsConfiguration wrongConfig = new AssetsConfiguration(); wrongConfig.setServerUrl(null); } }
38.863014
80
0.744096
63258c3213501bf79f8a4e62b3713c6ffb878f7b
1,471
package no.nav.data.polly.legalbasis.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.FieldNameConstants; import no.nav.data.common.validator.FieldValidator; import no.nav.data.common.validator.Validated; import no.nav.data.polly.codelist.domain.ListName; import no.nav.data.polly.legalbasis.domain.LegalBasis; import static no.nav.data.common.utils.StringUtils.toUpperCaseAndTrim; @Data @Builder @FieldNameConstants @NoArgsConstructor @AllArgsConstructor public class LegalBasisRequest implements Validated { @Schema(description = "Codelist GDPR") private String gdpr; @Schema(description = "Codelist NATIONAL_LAW") private String nationalLaw; private String description; public LegalBasis convertToDomain() { return LegalBasis.builder() .gdpr(gdpr) .nationalLaw(nationalLaw) .description(description) .build(); } @Override public void format() { setGdpr(toUpperCaseAndTrim(getGdpr())); setNationalLaw(toUpperCaseAndTrim(getNationalLaw())); } @Override public void validate(FieldValidator validator) { validator.checkRequiredCodelist(Fields.gdpr, gdpr, ListName.GDPR_ARTICLE); validator.checkCodelist(Fields.nationalLaw, nationalLaw, ListName.NATIONAL_LAW); } }
29.42
88
0.735554
fe8f6ec0177f9edeb577bd6a1dde29032806f270
1,589
package com.hp.up.core.web.page; import org.apache.commons.lang3.StringUtils; import java.io.Serializable; /** * @Author haopeng * @Date 2017/9/8 16:16 */ public class PageOrder implements Serializable{ public static final String ASC = "asc"; public static final String DESC = "desc"; private String name = ""; private boolean asc = true; public PageOrder() { } public PageOrder(String name, boolean direction) { this.name = name; this.asc = direction; } public boolean isEmpty() { return StringUtils.isBlank(this.name); } public String getName() { return this.name; } public boolean isAsc() { return this.asc; } public void setName(String name) { this.name = name; } public void setAsc(boolean asc) { this.asc = asc; } public void parser(String expressions) { String[] array = expressions.split("=="); this.name = array[0]; if(StringUtils.equalsIgnoreCase("asc", array[1])) { this.asc = true; } else { this.asc = false; } } public String getOrderExpressions() { return this.getName() + "==" + (this.isAsc()?"asc":"desc"); } public void setOrder(String expressions) { this.parser(expressions); } public String getOrder() { return this.getName() + " " + (this.isAsc()?"asc":"desc"); } public void setDefault(String expressions) { if(this.isEmpty()) { this.parser(expressions); } } }
20.371795
67
0.573946
18bc5e827227d28db620db8410abcf663aa774d8
457
package com.github.jochenw.ispm.core.data; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; public class StringList extends ArrayList<String> implements Serializable { private static final long serialVersionUID = -5729312034254940815L; public StringList() { super(); } public StringList(Collection<? extends String> c) { super(c); } public StringList(int initialCapacity) { super(initialCapacity); } }
20.772727
75
0.765864
23d7578d8ad7aa7e2e0b19520faa7ddb2e266749
1,281
import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.util.Collections; import java.util.Enumeration; import java.util.Map; import java.util.ResourceBundle; public class SystemLoggerDemo { public static void main(String[] args) { ResourceBundle bundle = ResourceBundle.getBundle("SystemLoggerDemo$ResourceBundleImpl"); { Logger logger = System.getLogger("demo"); if (logger.isLoggable(Level.INFO)) { logger.log(Level.INFO, "Hello World"); } logger.log(Level.INFO, () -> "Supplier"); logger.log(Level.INFO, "{0} + {1} = {2}", 1, 2, 3); logger.log(Level.INFO, bundle, "hello"); } { Logger logger = System.getLogger("demo-with-bundle", bundle); if (logger.isLoggable(Level.INFO)) { logger.log(Level.INFO, "Hello World"); } logger.log(Level.INFO, "hello"); logger.log(Level.INFO, "bind", 12345); } } public static class ResourceBundleImpl extends ResourceBundle { private final Map<String, String> map = Map.of( "hello", "Hello, ResourceBundle!", "bind", "{0} is bound parameter"); @Override protected Object handleGetObject(String key) { return map.get(key); } @Override public Enumeration<String> getKeys() { return Collections.enumeration(map.keySet()); } } }
24.169811
90
0.683841
0528fdba292287be9a9ea70bb1deedf6b24a4597
2,524
package dev.benjaminc.chef_simulator; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import dev.benjaminc.chef_simulator.control.EventHandler; import dev.benjaminc.chef_simulator.data.DataLoader; import dev.benjaminc.chef_simulator.events.EventDestination; import dev.benjaminc.chef_simulator.events.SpecialActionEvent; import dev.benjaminc.chef_simulator.events.SpecialActionEvent.SpecialActionEventTypes; /** * @author Benjamin-C * */ public class ChefSimulatorControl { /** * Starts a new Chief Simulator Game * @param sc the int number of pixels for the width and height of each gamespace * @param fs the int number of target frames per second / ticks per second * @param lm the boolean to show the lagometer by default */ public static void run(int sc, int fs, boolean lm, String ipAndPort) { try { int c = ipAndPort.indexOf(':'); String ip = ipAndPort.substring(0, c); System.out.println(ip); System.out.println(ipAndPort.substring(c+1)); int port = Integer.parseInt(ipAndPort.substring(c+1)); Game.connectToServer(ip, port); Game.setupGame(sc, fs, lm, true); Game.setDataLoader(new DataLoader() { @Override public void processData(String data) { Game.setDataLoader(null); Game.playJSONMap(data); } }); EventHandler.fireEvent(new SpecialActionEvent(SpecialActionEventTypes.GET_MAP, ""), EventDestination.SERVER); System.out.println("Waiting for data ..."); System.out.println(Thread.currentThread().getName()); } catch(NumberFormatException e) { System.out.println("A number broke me"); } } /** * Starts a new Chief Simulator Game * @param sc the int number of pixels for the width and height of each gamespace * @param fs the int number of target frames per second / ticks per second * @param lm the boolean to show the lagometer by default */ public static void run(int sc, int fs, boolean lm, File savefile) { if(savefile != null && savefile.exists() && savefile.isFile()) { try { Scanner scan = new Scanner(savefile); String s = ""; while(scan.hasNextLine()) { s = s + scan.nextLine(); } scan.close(); Game.setupGame(sc, fs, lm, true); Game.playJSONMap(s); } catch (FileNotFoundException e) { System.out.println("There is no file there or something went bad"); } } else { Game.setupGame(sc, fs, lm, true); Game.playDefaultGame(); } } }
33.653333
113
0.686609
2ebeff55f40536f13f64e758f0ac6d677bb08fbb
332
package com.yh.jcartadministrationback.service; import com.yh.jcartadministrationback.po.OrderHistory; import java.util.List; /** * @Description * @Author Yh * @Date 2020-03-06 11:03 */ public interface OrderHistoryService { List<OrderHistory> getByOrderId(Long orderId); Long create(OrderHistory orderHistory); }
17.473684
54
0.753012
f0df60f4710fd856b8dd79bcaa3c41f451437e9e
300
package com.ewolff.circuitbreaker; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface CircuitBreaker { }
23.076923
44
0.833333
eabdd50cd8f868b64f2b43db2b24d33b7d13b854
1,232
package com.qinweizhao; /** * 儿子买烟线程 */ class SonThread implements Runnable { @Override public void run() { System.out.println("儿子出门买烟"); System.out.println("儿子买烟需要10分钟"); for (int i = 0; i < 10; i++) { System.out.println("第" + i + "分钟"); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("儿子买烟回来了"); } } /** * 爸爸抽烟线程 */ class FatherThread implements Runnable { @Override public void run() { System.out.println("爸爸想抽烟,发现烟抽完了"); System.out.println("爸爸让儿子去买一包红塔山"); Thread t = new Thread(new SonThread()); t.start(); System.out.println("等待儿子买烟回来"); try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); System.out.println("爸爸出门找儿子"); System.exit(1); } System.out.println("爸爸高兴的接过烟,并把零钱给了儿子"); } } public class JoinDemo { public static void main(String[] args) { System.out.println("爸爸和儿子买烟的故事"); Thread t = new Thread(new FatherThread()); t.start(); } }
22
50
0.523539
421d98802c6aa9d6ac5f85264d32c673d9e922a2
267
package ion.offline.net; public class SyncError { public String user; public String message; public String objectId; public SyncError(String user, String object, String message){ this.user = user; this.objectId = object; this.message = message; } }
16.6875
62
0.722846
01728fb0133de8f4afef24a0c90d204979ea4b32
11,893
package de.metas.procurement.base.event.impl; import java.math.BigDecimal; import java.sql.Timestamp; import java.util.concurrent.atomic.AtomicInteger; import org.adempiere.ad.trx.processor.spi.TrxItemProcessorAdapter; import org.adempiere.exceptions.AdempiereException; import org.adempiere.model.InterfaceWrapperHelper; import org.slf4j.Logger; import com.google.common.annotations.VisibleForTesting; import de.metas.contracts.model.I_C_Flatrate_Term; import de.metas.error.AdIssueId; import de.metas.error.IErrorManager; import de.metas.lock.api.ILockManager; import de.metas.logging.LogManager; import de.metas.procurement.base.IPMMContractsBL; import de.metas.procurement.base.IPMMContractsDAO; import de.metas.procurement.base.IPMMPricingAware; import de.metas.procurement.base.IPMMPricingBL; import de.metas.procurement.base.balance.IPMMBalanceChangeEventProcessor; import de.metas.procurement.base.balance.PMMBalanceChangeEvent; import de.metas.procurement.base.model.I_C_Flatrate_DataEntry; import de.metas.procurement.base.model.I_PMM_PurchaseCandidate; import de.metas.procurement.base.model.I_PMM_QtyReport_Event; import de.metas.procurement.base.order.IPMMPurchaseCandidateBL; import de.metas.procurement.base.order.IPMMPurchaseCandidateDAO; import de.metas.procurement.base.order.PMMPurchaseCandidateSegment; import de.metas.util.Check; import de.metas.util.Loggables; import de.metas.util.Services; import de.metas.common.util.CoalesceUtil; /* * #%L * de.metas.procurement.base * %% * Copyright (C) 2016 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ /** * Processes {@link I_PMM_QtyReport_Event}s and creates/updates {@link I_PMM_PurchaseCandidate}s. * * @author metas-dev <dev@metasfresh.com> * */ class PMMQtyReportEventTrxItemProcessor extends TrxItemProcessorAdapter<I_PMM_QtyReport_Event, Void> { // services private static final Logger logger = LogManager.getLogger(PMMQtyReportEventTrxItemProcessor.class); private final transient ILockManager lockManager = Services.get(ILockManager.class); private final transient IPMMPurchaseCandidateDAO purchaseCandidateDAO = Services.get(IPMMPurchaseCandidateDAO.class); private final transient IPMMPurchaseCandidateBL purchaseCandidateBL = Services.get(IPMMPurchaseCandidateBL.class); private final transient IPMMBalanceChangeEventProcessor pmmBalanceEventProcessor = Services.get(IPMMBalanceChangeEventProcessor.class); private final transient IPMMPricingBL pmmPricingBL = Services.get(IPMMPricingBL.class); private final transient IPMMContractsDAO pmmContractsDAO = Services.get(IPMMContractsDAO.class); private final transient IPMMContractsBL pmmContractsBL = Services.get(IPMMContractsBL.class); private final AtomicInteger countProcessed = new AtomicInteger(0); private final AtomicInteger countErrors = new AtomicInteger(0); private final AtomicInteger countSkipped = new AtomicInteger(0); /** * Creates/Updates a {@link I_PMM_PurchaseCandidate} for the given <code>event</code> <b>and also</b> updates the given <code>event</code>'s pricing. */ @Override public void process(final I_PMM_QtyReport_Event event) { updateC_Flatrate_DataEntry(event); // // Create the aggregation segment final PMMPurchaseCandidateSegment pmmSegment = PMMPurchaseCandidateSegment.builder() .setC_BPartner_ID(event.getC_BPartner_ID()) .setM_Product_ID(event.getM_Product_ID()) .setM_HU_PI_Item_Product_ID(event.getM_HU_PI_Item_Product_ID()) .setM_AttributeSetInstance_ID(event.getM_AttributeSetInstance_ID()) .setC_Flatrate_DataEntry_ID(event.getC_Flatrate_DataEntry_ID()) .build(); final Timestamp datePromised = event.getDatePromised(); I_PMM_PurchaseCandidate candidate; // // Weekly planning if (event.isPlanning()) { candidate = null; if (purchaseCandidateDAO.hasRecordsForWeek(pmmSegment, datePromised)) { markProcessed(event, candidate); return; } } // // Concrete QtyReport else { candidate = purchaseCandidateDAO.retrieveFor(pmmSegment, datePromised); } // // If candidate is currently locked, skip processing this event for now if (candidate != null && lockManager.isLocked(candidate)) { final String errorMsg = "Skip processing event because candidate is currently locked: " + candidate; markSkipped(event, candidate, errorMsg); return; } if (candidate != null && isProcessedByFutureEvent(candidate, event)) { final String errorMsg = "Skipped because candidate " + candidate + " was already processed by future event: " + candidate.getLast_QtyReport_Event_ID(); markProcessed(event, candidate, errorMsg); return; } try { // // If no candidate found, create a new candidate if (candidate == null) { candidate = InterfaceWrapperHelper.newInstance(I_PMM_PurchaseCandidate.class); // Segment values candidate.setC_BPartner_ID(pmmSegment.getC_BPartner_ID()); candidate.setM_Product_ID(pmmSegment.getM_Product_ID()); if (pmmSegment.getM_AttributeSetInstance_ID() > 0) { candidate.setM_AttributeSetInstance_ID(pmmSegment.getM_AttributeSetInstance_ID()); } candidate.setM_HU_PI_Item_Product_ID(pmmSegment.getM_HU_PI_Item_Product_ID()); if (pmmSegment.getC_Flatrate_DataEntry_ID() > 0) { candidate.setC_Flatrate_DataEntry_ID(pmmSegment.getC_Flatrate_DataEntry_ID()); } candidate.setC_UOM_ID(event.getC_UOM_ID()); candidate.setDatePromised(datePromised); candidate.setAD_Org_ID(event.getAD_Org_ID()); if (event.getM_Warehouse_ID() > 0) { candidate.setM_Warehouse_ID(event.getM_Warehouse_ID()); } // // Pricing updatePricing(event); candidate.setM_PricingSystem_ID(event.getM_PricingSystem_ID()); candidate.setM_PriceList_ID(event.getM_PriceList_ID()); candidate.setC_Currency_ID(event.getC_Currency_ID()); candidate.setPrice(event.getPrice()); } // // Update event and capture the old candidate values // NOTE: these fields are critical for PMM_Balance final BigDecimal candidate_QtyPromised = candidate.getQtyPromised(); final BigDecimal candidate_QtyPromisedTU = candidate.getQtyPromised_TU(); event.setQtyPromised_Old(candidate_QtyPromised); event.setQtyPromised_TU_Old(candidate_QtyPromisedTU); // // Update the candidate with the values from event purchaseCandidateBL.setQtyPromised(candidate, event.getQtyPromised(), event.getQtyPromised_TU()); // NOTE: as per FRESH-141 we shall not touch the QtyToOrder fields InterfaceWrapperHelper.save(candidate); // // Update PMM_Balance pmmBalanceEventProcessor.addEvent(createPMMBalanceChangeEvent(event)); // // Mark the event as processed markProcessed(event, candidate); } catch (final Exception e) { markError(event, e); } } private final void updatePricing(final I_PMM_QtyReport_Event qtyReportEvent) { // Non-contract product: fetch price from pricing system final IPMMPricingAware pricingAware = PMMPricingAware_QtyReportEvent.of(qtyReportEvent); pmmPricingBL.updatePricing(pricingAware); } private void updateC_Flatrate_DataEntry(final I_PMM_QtyReport_Event qtyReportEvent) { final I_C_Flatrate_Term flatrateTerm = qtyReportEvent.getC_Flatrate_Term(); if (flatrateTerm == null) { // we are called, because qtyReportEvent has a contractLine_uuid. So if there is no term then something is wrong return; } final Timestamp datePromised = qtyReportEvent.getDatePromised(); final I_C_Flatrate_DataEntry dataEntryForProduct = pmmContractsDAO.retrieveFlatrateDataEntry(flatrateTerm, datePromised); if (dataEntryForProduct == null) { return; } // Skip setting the data entry if it does not have the price or the qty set (FRESH-568) if (!pmmContractsBL.hasPriceOrQty(dataEntryForProduct)) { logger.debug("Skip setting {} to {} because the data entry does not have a price or qty set", dataEntryForProduct, qtyReportEvent); return; } qtyReportEvent.setC_Flatrate_DataEntry(dataEntryForProduct); } private final void markProcessed(final I_PMM_QtyReport_Event event, final I_PMM_PurchaseCandidate candidate) { final String errorMsg = null; // no error message markProcessed(event, candidate, errorMsg); } private final void markProcessed(final I_PMM_QtyReport_Event event, final I_PMM_PurchaseCandidate candidate, final String errorMsg) { event.setPMM_PurchaseCandidate(candidate); event.setProcessed(true); event.setIsError(!Check.isEmpty(errorMsg, true)); event.setErrorMsg(errorMsg); InterfaceWrapperHelper.save(event); countProcessed.incrementAndGet(); } private final void markError(final I_PMM_QtyReport_Event event, final Throwable ex) { InterfaceWrapperHelper.refresh(event, true); event.setIsError(true); event.setProcessed(true); final AdempiereException metasfreshException = AdempiereException.wrapIfNeeded(ex); final String errorMsg = CoalesceUtil.firstNotEmptyTrimmed(metasfreshException.getLocalizedMessage(), metasfreshException.getMessage()); final AdIssueId issueId = Services.get(IErrorManager.class).createIssue(metasfreshException); event.setErrorMsg(errorMsg); event.setAD_Issue_ID(issueId.getRepoId()); InterfaceWrapperHelper.save(event); Loggables.addLog("Event marked as isError='Y' with message: {}; event={}", errorMsg, event); countErrors.incrementAndGet(); } private final void markSkipped(final I_PMM_QtyReport_Event event, final I_PMM_PurchaseCandidate candidate, final String errorMsg) { event.setErrorMsg(errorMsg); InterfaceWrapperHelper.save(event); if (errorMsg != null) { Loggables.addLog("Event " + event + " skipped: " + errorMsg); } countSkipped.incrementAndGet(); } private boolean isProcessedByFutureEvent(final I_PMM_PurchaseCandidate candidate, final I_PMM_QtyReport_Event currentEvent) { if (candidate == null) { return false; } final int lastQtyReportEventId = candidate.getLast_QtyReport_Event_ID(); if (lastQtyReportEventId > currentEvent.getPMM_QtyReport_Event_ID()) { return true; } return false; } public String getProcessSummary() { return "@Processed@ #" + countProcessed.get() + ", @IsError@ #" + countErrors.get() + ", @Skipped@ #" + countSkipped.get(); } @VisibleForTesting static PMMBalanceChangeEvent createPMMBalanceChangeEvent(final I_PMM_QtyReport_Event qtyReportEvent) { final BigDecimal qtyPromisedDiff = qtyReportEvent.getQtyPromised().subtract(qtyReportEvent.getQtyPromised_Old()); final BigDecimal qtyPromisedTUDiff = qtyReportEvent.getQtyPromised_TU().subtract(qtyReportEvent.getQtyPromised_TU_Old()); final PMMBalanceChangeEvent event = PMMBalanceChangeEvent.builder() .setC_BPartner_ID(qtyReportEvent.getC_BPartner_ID()) .setM_Product_ID(qtyReportEvent.getM_Product_ID()) .setM_AttributeSetInstance_ID(qtyReportEvent.getM_AttributeSetInstance_ID()) .setM_HU_PI_Item_Product_ID(qtyReportEvent.getM_HU_PI_Item_Product_ID()) .setC_Flatrate_DataEntry_ID(qtyReportEvent.getC_Flatrate_DataEntry_ID()) // .setDate(qtyReportEvent.getDatePromised()) // .setQtyPromised(qtyPromisedDiff, qtyPromisedTUDiff) // .build(); logger.trace("Created event {} from {}", event, qtyReportEvent); return event; } }
35.822289
154
0.7776
dd662c5e20fa9b39b23c4ab2945b1506110fa469
392
package io.ankburov.retrofit.httpclient; import java.io.IOException; import java.net.http.HttpRequest; import java.time.Duration; import org.jetbrains.annotations.Nullable; import okhttp3.Request; /** * Convert Retrofit request to Http Client request */ public interface HttpRequestFactory { HttpRequest build(Request request, @Nullable Duration timeout) throws IOException; }
21.777778
86
0.788265
72505716363f473ecbeac995f51174730b7777e9
4,278
package practicaltest02.eim.systems.cs.pub.ro.practicaltest02; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class PracticalTest02MainActivity extends AppCompatActivity { Button setButton, resetButton, pollButton, startServerButton; EditText clientAddressEditText, clientPortEditText, oraEditText, minutEditText; TextView responseTextView; private ServerThread serverThread = null; private ClientThread clientThread = null; private StartServerButtonClickListener startServerButtonListener = new StartServerButtonClickListener(); private class StartServerButtonClickListener implements Button.OnClickListener { @Override public void onClick(View view) { String serverPort = clientPortEditText.getText().toString(); if (serverPort == null || serverPort.isEmpty()) { Toast.makeText(getApplicationContext(), "[MAIN ACTIVITY] Server port should be filled!", Toast.LENGTH_SHORT).show(); return; } serverThread = new ServerThread(Integer.parseInt(serverPort)); if (serverThread.getServerSocket() == null) { Log.e(Constants.TAG, "[MAIN ACTIVITY] Could not create server thread!"); return; } serverThread.start(); } } private PollAlarmButtonClickListener pollAlarmButtonClickListener = new PollAlarmButtonClickListener(); private class PollAlarmButtonClickListener implements Button.OnClickListener { @Override public void onClick(View view) { String clientAddress = clientAddressEditText.getText().toString(); String clientPort = clientPortEditText.getText().toString(); if (clientAddress == null || clientAddress.isEmpty() || clientPort == null || clientPort.isEmpty()) { Toast.makeText(getApplicationContext(), "[MAIN ACTIVITY] Client connection parameters should be filled!", Toast.LENGTH_SHORT).show(); return; } if (serverThread == null || !serverThread.isAlive()) { Toast.makeText(getApplicationContext(), "[MAIN ACTIVITY] There is no server to connect to!", Toast.LENGTH_SHORT).show(); return; } Integer ora = Integer.parseInt(oraEditText.getText().toString()); Integer minut = Integer.parseInt(minutEditText.getText().toString()); if (ora == null || minut == null) { Toast.makeText(getApplicationContext(), "[MAIN ACTIVITY] Parameters from client (city / information type) should be filled", Toast.LENGTH_SHORT).show(); return; } clientThread = new ClientThread( clientAddress, Integer.parseInt(clientPort), responseTextView ); clientThread.start(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_practical_test02_main); setButton = findViewById(R.id.set_timer_button); resetButton = findViewById(R.id.reset_timer_button); pollButton = findViewById(R.id.poll_timer_button); pollButton.setOnClickListener(pollAlarmButtonClickListener); startServerButton = findViewById(R.id.start_server_button); startServerButton.setOnClickListener(startServerButtonListener); clientAddressEditText = findViewById(R.id.client_address_edit_text); clientPortEditText = findViewById(R.id.client_port_edit_text); oraEditText = findViewById(R.id.ora_edit_text); minutEditText = findViewById(R.id.minut_edit_text); responseTextView = findViewById(R.id.response_text_view); } @Override protected void onDestroy() { Log.i(Constants.TAG, "[MAIN ACTIVITY] onDestroy() callback method has been invoked"); if (serverThread != null) { serverThread.stopThread(); } super.onDestroy(); } }
41.533981
168
0.671809
783e77b816c1d6e98717cb0bcac0dee9f15e2c1a
2,576
package com.aoeai.spin.accelerator.themes.customize.xy.dashang; import com.aoeai.spin.accelerator.generate.IPoFactory; import com.aoeai.spin.accelerator.themes.customize.xy.dashang.factory.*; import com.aoeai.spin.accelerator.themes.frame.AbstractThemeRegister; import com.aoeai.spin.accelerator.themes.frame.bean.Module; import com.aoeai.spin.accelerator.themes.frame.bean.ThemeType; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Arrays; import java.util.List; /** * 星芽-达赏模板注册 * @author aoe * @date 2020/8/24 */ @Component public class XyDashangThemeRegister extends AbstractThemeRegister { @Resource(name = "xyDsPoFactory") private IPoFactory poFactory; /** * 获得模板类型 * * @return */ @Override protected ThemeType getThemeType() { var themeType = new ThemeType(); themeType.setCode("xy-dashang-video"); themeType.setName("星芽-达赏-视频"); var mapperFactory = new XyDsMapperFactory(poFactory); var voFactory = new XyDsVoFactory(poFactory); var pageListQoFactory = new XyDsPageListQoFactory(poFactory); var serviceFactory = new XyDsServiceFactory(poFactory, mapperFactory, voFactory, pageListQoFactory); var formCreateFactory = new XyDsFormCreateFactory(poFactory); var formUpdateFactory = new XyDsFormUpdateFactory(poFactory); var controllerApiFactory = new XyDsControllerApiFactory(poFactory, serviceFactory, formCreateFactory, formUpdateFactory, pageListQoFactory); var controllerAppFactory = new XyDsControllerAppFactory(poFactory, serviceFactory, formCreateFactory, formUpdateFactory, pageListQoFactory); List<Module> modules = Arrays.asList( new Module("PO", "持久化对象", poFactory), new Module("MapperClass", "Mybatis Mapper", mapperFactory), new Module("MapperXml", "Mybatis Mapper MXL", new XyDsMapperXmlFactory(mapperFactory)), new Module("VO", "Web层返回对象", voFactory), new Module("PageListQO", "分页查询对象", pageListQoFactory), new Module("Service", "服务实现", serviceFactory), new Module("FormCreate", "创建表单", formCreateFactory), new Module("FormUpdate", "更新表单", formUpdateFactory), new Module("ControllerApi", "Api控制器", controllerApiFactory), new Module("ControllerApp", "App控制器", controllerAppFactory) ); themeType.setModules(modules); return themeType; } }
39.630769
109
0.689441
bb39d38147bd51a9bdad233a77b072ebb376ae6d
4,064
/* */ package org.apache.batik.svggen; /* */ /* */ import java.awt.Rectangle; /* */ import java.awt.image.BufferedImageOp; /* */ import java.awt.image.ConvolveOp; /* */ import java.awt.image.Kernel; /* */ import org.w3c.dom.Document; /* */ import org.w3c.dom.Element; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class SVGConvolveOp /* */ extends AbstractSVGFilterConverter /* */ { /* */ public SVGConvolveOp(SVGGeneratorContext generatorContext) { /* 42 */ super(generatorContext); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public SVGFilterDescriptor toSVG(BufferedImageOp filter, Rectangle filterRect) { /* 59 */ if (filter instanceof ConvolveOp) { /* 60 */ return toSVG((ConvolveOp)filter); /* */ } /* 62 */ return null; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public SVGFilterDescriptor toSVG(ConvolveOp convolveOp) { /* 73 */ SVGFilterDescriptor filterDesc = (SVGFilterDescriptor)this.descMap.get(convolveOp); /* */ /* 75 */ Document domFactory = this.generatorContext.domFactory; /* */ /* 77 */ if (filterDesc == null) { /* */ /* */ /* */ /* */ /* 82 */ Kernel kernel = convolveOp.getKernel(); /* 83 */ Element filterDef = domFactory.createElementNS("http://www.w3.org/2000/svg", "filter"); /* */ /* 85 */ Element feConvolveMatrixDef = domFactory.createElementNS("http://www.w3.org/2000/svg", "feConvolveMatrix"); /* */ /* */ /* */ /* */ /* 90 */ feConvolveMatrixDef.setAttributeNS((String)null, "order", kernel.getWidth() + " " + kernel.getHeight()); /* */ /* */ /* */ /* */ /* 95 */ float[] data = kernel.getKernelData(null); /* 96 */ StringBuffer kernelMatrixBuf = new StringBuffer(data.length * 8); /* 97 */ for (float aData : data) { /* 98 */ kernelMatrixBuf.append(doubleString(aData)); /* 99 */ kernelMatrixBuf.append(" "); /* */ } /* */ /* 102 */ feConvolveMatrixDef.setAttributeNS((String)null, "kernelMatrix", kernelMatrixBuf.toString().trim()); /* */ /* */ /* */ /* 106 */ filterDef.appendChild(feConvolveMatrixDef); /* */ /* 108 */ filterDef.setAttributeNS((String)null, "id", this.generatorContext.idGenerator.generateID("convolve")); /* */ /* */ /* */ /* */ /* 113 */ if (convolveOp.getEdgeCondition() == 1) { /* 114 */ feConvolveMatrixDef.setAttributeNS((String)null, "edgeMode", "duplicate"); /* */ } else { /* */ /* 117 */ feConvolveMatrixDef.setAttributeNS((String)null, "edgeMode", "none"); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* 125 */ StringBuffer filterAttrBuf = new StringBuffer("url("); /* 126 */ filterAttrBuf.append("#"); /* 127 */ filterAttrBuf.append(filterDef.getAttributeNS((String)null, "id")); /* 128 */ filterAttrBuf.append(")"); /* */ /* 130 */ filterDesc = new SVGFilterDescriptor(filterAttrBuf.toString(), filterDef); /* */ /* */ /* 133 */ this.defSet.add(filterDef); /* 134 */ this.descMap.put(convolveOp, filterDesc); /* */ } /* */ /* 137 */ return filterDesc; /* */ } /* */ } /* Location: /mnt/r/ConTenDoViewer.jar!/org/apache/batik/svggen/SVGConvolveOp.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
28.027586
123
0.456447
dd70419399451ba50928abfc2f724d6add003457
1,130
/* Copyright 2019 The OpenTracing Authors * * Licensed 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. */ package io.opentracing.contrib.specialagent.rule.akka.actor; import io.opentracing.Scope; import io.opentracing.Span; public final class TracedMessage<T> { public final T message; public final Span span; private Scope scope; public TracedMessage(final T message, final Span span, final Scope scope) { this.message = message; this.span = span; this.scope = scope; } public void closeScopeAndSpan() { if (scope != null) { scope.close(); scope = null; span.finish(); } } }
28.974359
77
0.712389
1e0f630b54c4123e5f38b056964ecd21488d7a77
5,901
package extension.view.base; import java.awt.Component; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.dnd.DragSource; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Vector; import java.util.stream.Collectors; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.TransferHandler; import javax.swing.table.DefaultTableModel; // https://docs.oracle.com/javase/tutorial/uiswing/dnd/basicdemo.html) // Demo - DropDemo (The Java™ Tutorials > Creating a GUI With JFC/Swing > Drag and Drop and Data Transfer) // https://docs.oracle.com/javase/tutorial/uiswing/dnd/dropmodedemo.html // @see https://docs.oracle.com/javase/tutorial/uiswing/examples/dnd/DropDemoProject/src/dnd/ListTransferHandler.java public class TableRowTransferHandler extends TransferHandler { protected final DataFlavor localObjectFlavor; protected int[] indices; protected int addIndex = -1; // Location where items were added protected int addCount; // Number of items added. public TableRowTransferHandler() { super(); localObjectFlavor = new DataFlavor(List.class, "List of items"); } @Override protected Transferable createTransferable(JComponent c) { c.getRootPane().getGlassPane().setVisible(true); JTable table = (JTable) c; DefaultTableModel model = (DefaultTableModel) table.getModel(); // List<Object> list = new ArrayList<>(); // indices = table.getSelectedRows(); // for (int i: indices) { // list.add(model.getDataVector().get(i)); // } // Object[] transferedObjects = list.toArray(); indices = table.getSelectedRows(); @SuppressWarnings("JdkObsolete") List<?> transferedObjects = Arrays.stream(indices).mapToObj(model.getDataVector()::get).collect(Collectors.toList()); // return new DataHandler(transferedObjects, localObjectFlavor.getMimeType()); return new Transferable() { @Override public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[]{localObjectFlavor}; } @Override public boolean isDataFlavorSupported(DataFlavor flavor) { return Objects.equals(localObjectFlavor, flavor); } @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (isDataFlavorSupported(flavor)) { return transferedObjects; } else { throw new UnsupportedFlavorException(flavor); } } }; } @Override public boolean canImport(TransferHandler.TransferSupport info) { boolean isDroppable = info.isDrop() && info.isDataFlavorSupported(localObjectFlavor); // XXX bug? The cursor flickering problem with JTableHeader: // info.getComponent().setCursor(isDroppable ? DragSource.DefaultMoveDrop : DragSource.DefaultMoveNoDrop); Component glassPane = ((JComponent) info.getComponent()).getRootPane().getGlassPane(); glassPane.setCursor(isDroppable ? DragSource.DefaultMoveDrop : DragSource.DefaultMoveNoDrop); return isDroppable; } @Override public int getSourceActions(JComponent c) { return TransferHandler.MOVE; // TransferHandler.COPY_OR_MOVE; } @SuppressWarnings("PMD.ReplaceVectorWithList") @Override public boolean importData(TransferHandler.TransferSupport info) { if (!canImport(info)) { return false; } TransferHandler.DropLocation tdl = info.getDropLocation(); if (!(tdl instanceof JTable.DropLocation)) { return false; } JTable.DropLocation dl = (JTable.DropLocation) tdl; JTable target = (JTable) info.getComponent(); DefaultTableModel model = (DefaultTableModel) target.getModel(); // boolean insert = dl.isInsert(); int max = model.getRowCount(); int index = dl.getRow(); index = index < 0 ? max : index; // If it is out of range, it is appended to the end index = Math.min(index, max); addIndex = index; // target.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); try { List<?> values = (List<?>) info.getTransferable().getTransferData(localObjectFlavor); addCount = values.size(); for (Object o : values) { int i = index++; model.insertRow(i, (Vector<?>) o); target.getSelectionModel().addSelectionInterval(i, i); } return true; } catch (UnsupportedFlavorException | IOException ex) { ex.printStackTrace(); } return false; } @Override protected void exportDone(JComponent c, Transferable data, int action) { cleanup(c, action == TransferHandler.MOVE); } private void cleanup(JComponent c, boolean remove) { c.getRootPane().getGlassPane().setVisible(false); // c.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); if (remove && Objects.nonNull(indices)) { DefaultTableModel model = (DefaultTableModel) ((JTable) c).getModel(); if (addCount > 0) { for (int i = 0; i < indices.length; i++) { if (indices[i] >= addIndex) { indices[i] += addCount; } } } for (int i = indices.length - 1; i >= 0; i--) { model.removeRow(indices[i]); } } indices = null; addCount = 0; addIndex = -1; } }
39.604027
125
0.632435
5513bb4d91198f40a97b841a43cac59b5e904de8
1,728
package org.seasar.doma.jdbc.entity; import java.lang.reflect.Method; import org.seasar.doma.DomaNullPointerException; import org.seasar.doma.OriginalStates; import org.seasar.doma.Update; import org.seasar.doma.jdbc.Config; /** * A context for a pre process of an update. * * @param <E> the entity type */ public interface PreUpdateContext<E> { /** * Whether the entity is changed. * * <p>This method always returns {@code true}, when {@link Update#sqlFile()} returns {@code true}. * * @return {@code true} if the entity is changed */ boolean isEntityChanged(); /** * Whether the entity property is changed. * * <p>This method always returns {@code true}, when {@link Update#sqlFile()} returns {@code true}. * * @param propertyName the name of property * @return {@code true} if the property is changed * @exception EntityPropertyNotDefinedException if the property is not defined in the entity * @see OriginalStates */ boolean isPropertyChanged(String propertyName); /** * Returns the entity description. * * @return the entity description */ EntityType<?> getEntityType(); /** * The method that is annotated with {@link Update}. * * @return the method */ Method getMethod(); /** * Returns the configuration. * * @return the configuration */ Config getConfig(); /** * Returns the new entity. * * @return the new entity */ E getNewEntity(); /** * Sets the new entity. * * <p>This method is available, when the entity is immutable. * * @param newEntity the entity * @throws DomaNullPointerException if {@code newEntity} is {@code null} */ void setNewEntity(E newEntity); }
23.04
100
0.663773
ba18fe4f44501496a2834082064354d94b470506
955
package org.mbari.m3.annosync.services.varsjdbc; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import io.reactivex.subjects.PublishSubject; import io.reactivex.subjects.Subject; import org.junit.Test; import static org.junit.Assert.*; import org.mbari.m3.annosync.util.ConfigUtilities; import java.io.File; import java.util.List; /** * @author Brian Schlining * @since 2018-03-20T10:04:00 */ public class AnnotationServiceFactoryTest { @Test public void testLoad() { final Subject<Object> rxSubject = PublishSubject.create().toSerialized(); final File configFile = ConfigUtilities.toFile(getClass().getResource("/test.conf")); final Config config = ConfigFactory.parseFile(configFile).resolve(); List<AnnotationServiceImpl> services = AnnotationServiceFactory.load(rxSubject, config); assertTrue("Whoops ... we expected 3 services", services.size() == 3); } }
28.939394
96
0.73822
f8c34c5fab694130a1a82db3ac98b1e2bbcbebdb
2,925
// ============================================================================ // // Copyright (C) 2006-2018 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.salesforce.oauth; /** * created by bchen on Aug 28, 2013 Detailled comment * */ public class Token { private String access_token; private String refresh_token; private String instance_url; private String id; private long issued_at; private String signature; /** * Getter for access_token. * * @return the access_token */ public String getAccess_token() { return this.access_token; } /** * Sets the access_token. * * @param access_token the access_token to set */ public void setAccess_token(String access_token) { this.access_token = access_token; } /** * Getter for refresh_token. * * @return the refresh_token */ public String getRefresh_token() { return this.refresh_token; } /** * Sets the refresh_token. * * @param refresh_token the refresh_token to set */ public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } /** * Getter for instance_url. * * @return the instance_url */ public String getInstance_url() { return this.instance_url; } /** * Sets the instance_url. * * @param instance_url the instance_url to set */ public void setInstance_url(String instance_url) { this.instance_url = instance_url; } /** * Getter for id. * * @return the id */ public String getId() { return this.id; } /** * Sets the id. * * @param id the id to set */ public void setId(String id) { this.id = id; } /** * Getter for issued_at. * * @return the issued_at */ public long getIssued_at() { return this.issued_at; } /** * Sets the issued_at. * * @param issued_at the issued_at to set */ public void setIssued_at(long issued_at) { this.issued_at = issued_at; } /** * Getter for signature. * * @return the signature */ public String getSignature() { return this.signature; } /** * Sets the signature. * * @param signature the signature to set */ public void setSignature(String signature) { this.signature = signature; } }
20.598592
87
0.556239
efcc385d7acbae1bc0727eff1dcc3f59221f269e
1,136
package mksgroup.demo.swt.spring; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GUI { protected Shell shell; private Text txtXinCho; /** * Launch the application. * @param args */ public static void main(String[] args) { try { GUI window = new GUI(); window.open(); } catch (Exception e) { e.printStackTrace(); } } /** * Open the window. */ public void open() { Display display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } /** * Create contents of the window. */ protected void createContents() { shell = new Shell(); shell.setSize(450, 300); shell.setText("SWT Application"); txtXinCho = new Text(shell, SWT.BORDER); txtXinCho.setText("Xin chào, đây là bước đầu làm quen ứng dụng với SWT."); txtXinCho.setBounds(10, 10, 376, 21); } }
19.929825
77
0.675176
2647942cbf6d6e9dc56ff304cf9656edbc644671
119
package SevenZip; public interface ICompressGetInStreamProcessedSize { public long GetInStreamProcessedSize(); }
17
52
0.815126
a662be8839692d653114d938fc1b8b4a86bd7f81
4,606
package uva.tomo101; //Uva 10171. import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.Locale; import java.util.StringTokenizer; public class MeetingProfMiguel { static BufferedReader input; static StringTokenizer _stk; static String readln() throws IOException { String l = input.readLine(); if (l != null) _stk = new StringTokenizer(l, " "); return l; } static String next() { return _stk.nextToken(); } static int nextInt() { return Integer.parseInt(next()); } static void dbg(Object... o) { output.println(Arrays.deepToString(o)); } static PrintWriter output = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out))); public static void main(String[] args) throws IOException { Locale.setDefault(Locale.US); input = new BufferedReader(new InputStreamReader(System.in)); input = new BufferedReader(new FileReader("MeetingProfMiguel")); String age, dire; while (true) { readln(); N = nextInt(); if (N == 0) { break; } if (N < 0) { output.println("You will never meet."); continue; } for (int i = 0; i < places - 2; i++) { for (int j = 0; j < places - 2; j++) { AdjMatrixO[i][j] = INF; AdjMatrixY[i][j] = INF; } AdjMatrixO[i][i] = 0; AdjMatrixY[i][i] = 0; } map.clear(); invMap.clear(); for (int i = 0; i < N; i++) { readln(); age = next(); dire = next(); from = mappear(next().charAt(0)); to = mappear(next().charAt(0)); w = nextInt(); if (age.equals("Y")) { if (dire.equals("B")) { AdjMatrixY[from][to] = min(w, AdjMatrixY[from][to]); AdjMatrixY[to][from] = min(w, AdjMatrixY[to][from]); } else { AdjMatrixY[from][to] = min(w, AdjMatrixY[from][to]); } } else { if (dire.equals("B")) { AdjMatrixO[to][from] = min(w, AdjMatrixO[to][from]); AdjMatrixO[from][to] = min(w, AdjMatrixO[from][to]); } else { AdjMatrixO[from][to] = min(w, AdjMatrixO[from][to]); } } } readln(); me = mappear(next().charAt(0)); miguel = mappear(next().charAt(0)); V = map.size(); floydWarshall(); min = INF; placesMeet.clear(); for (int i = 0; i < map.size(); i++) { if (AdjMatrixO[miguel][i] + AdjMatrixY[me][i] < min) { min = AdjMatrixO[miguel][i] + AdjMatrixY[me][i]; placesMeet.clear(); placesMeet.add(invMap.get(i)); } else if (AdjMatrixO[miguel][i] + AdjMatrixY[me][i] == min) { min = AdjMatrixO[miguel][i] + AdjMatrixY[me][i]; placesMeet.add(invMap.get(i)); } } if (min < INF) { output.printf("%d", min); Collections.sort(placesMeet); for (Character c : placesMeet) { output.printf(" %s", c); } output.println(); } else { output.println("You will never meet."); } } output.close(); } // FLOYD WARSHALL static int places = ('Z' - 'A' + 7); static HashMap<Character, Integer> map = new HashMap<Character, Integer>( places); static HashMap<Integer, Character> invMap = new HashMap<Integer, Character>( places); static int INF = 1000000000; static int V, N, from, to, w, me, miguel, min;// no necesariamente tienen // que ser globales // porque // todo se puede meter en el main static int AdjMatrixY[][] = new int[places][places]; static int AdjMatrixO[][] = new int[places][places];; static LinkedList<Character> placesMeet = new LinkedList<Character>(); static int min(int i, int j) { return Math.min(i, j); } private static int mappear(Character next) { Integer idx = map.get(next); if (idx == null) { idx = map.size(); map.put(next, idx); invMap.put(idx, next); } return idx; } private static void floydWarshall() { // Floyd Warshall for (int k = 0; k < V; k++) { // common error: remember that loop order is k->i->j for (int i = 0; i < V; i++) { for (int j = 0; j < V; j++) { AdjMatrixY[i][j] = min(AdjMatrixY[i][j], AdjMatrixY[i][k] + AdjMatrixY[k][j]); AdjMatrixO[i][j] = min(AdjMatrixO[i][j], AdjMatrixO[i][k] + AdjMatrixO[k][j]); } } } // // Mostrando: // for (int i = 0; i < V; i++) { // for (int j = 0; j < V; j++) { // System.out.printf("APSP(%d, %d) = %d\n", i, j, AdjMatrixY[i][j]); // } // } } // FLOYD WARSHALL END }
24.897297
77
0.602258
30de8fd60448418657390d4715b2e86a6ccb771d
802
package es.ual.vsuarez.isros.sugar; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Properties; public class SugarConector { Properties properties; public SugarConector() { properties= loadProperties(); } private Properties loadProperties(){ Properties p = new Properties(); try{ InputStream im = SugarConector.class.getResourceAsStream("/sugar.properties"); p.load(im); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return p; } public Boolean deleteClient(String ref){ return Boolean.TRUE; } public void createClient(String ref, String name, String nif, String phone, String email){ } public List listClients(){ return new ArrayList(); } }
20.05
91
0.730673
a7ee6d93b29ccf7e94f3e51a6649dd2fbac99432
383
package io.simplesource.saga.saga.app; import lombok.Value; import org.apache.kafka.common.serialization.Serde; import java.util.UUID; @Value public final class DistributorSerdes<V> { public final Serde<UUID> uuid; public final Serde<V> value; public DistributorSerdes(Serde<UUID> uuid, Serde<V> value) { this.uuid = uuid; this.value = value; } }
21.277778
64
0.70235
271d90e9e879dc39c98d59ae63d131c8e5c3d816
1,155
package com.panly.urm.auth.log.thread; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.panly.urm.auth.dao.AuthLogDao; import com.panly.urm.auth.model.AuthLog; @Component public class AuthLogThreadContext { private static Logger logger = LoggerFactory.getLogger(AuthLogThreadContext.class); private static BlockingQueue<AuthLog> logQueue = new LinkedBlockingQueue<>(1000); @Autowired private AuthLogDao authLogDao; @PostConstruct private void init(){ for (int i = 0; i < 2; i++) { AuthLogThread l = new AuthLogThread(logQueue,authLogDao); l.setDaemon(true); l.setName("LogThread"+i); l.start(); logger.info(l.getName()+"线程启动"); } } public static void addLog(AuthLog log ){ try { logQueue.offer(log, 500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { logger.error("添加日志失败",e); } } }
23.571429
84
0.752381
40ff66e0199dca5501d90277afbd41daca71f917
1,092
package com.trendyol.recomengine.webservice.controller; import com.trendyol.recomengine.webservice.model.Recommendation; import com.trendyol.recomengine.webservice.repository.RecommendationRepository; import com.trendyol.recomengine.webservice.service.RecommendationService; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; public class RecommendationControllerIntegrationTests extends BaseMongoIntegrationTest { @Autowired private RecommendationRepository recommendationRepository; @Autowired private RecommendationService recommendationService; @Test public void getRecommendationShouldReturnTheRelevantUsersRecommendation() { String userId = "3"; String[] recommendations = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; Recommendation recommendation = new Recommendation(userId, recommendations); recommendationRepository.save(recommendation); Assert.assertEquals(recommendationService.getRecommendations(userId).get_id(), userId); } }
42
99
0.779304
206ff10515d9d0dee414b1d550f191c4dd810132
782
package com.open.capacity.answer.dao; import com.open.capacity.answer.entity.UserInfo; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; @Mapper public interface UserInfoDao { @Insert("insert into consumer_info(third_type,union_id,nick_name,sex,mobile,country,province,city,head_img_url,privilege,address,create_time,update_time) " + "values( #{thirdType},#{unionId},#{nickName},#{sex},#{mobile},#{country},#{province},#{city},#{headImgUrl},#{privilege},#{address},#{createTime},#{updateTime})") int insert(UserInfo userInfo); @Select("select * from consumer_info t where t.union_id = #{unionId} and t.org_id = #{orgId}") UserInfo getClient(UserInfo userInfo); }
39.1
175
0.741688
5f4e0c4f8dc9f84bd2ef64f71cb78fbb09b05f08
98
package fr.parisnanterre.miage.poa.universite.implem; public class Biatoss extends Personnel { }
19.6
53
0.816327
9b29cc9c3831355164b7a6a24f976e90438a6117
7,196
/* * Copyright 2020 Zetyun * * Licensed 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. */ package com.zetyun.streamtau.core.pea; import lombok.RequiredArgsConstructor; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.function.Consumer; import java.util.function.UnaryOperator; import javax.annotation.Nonnull; public final class PeaUtils { private PeaUtils() { } @SuppressWarnings("unchecked") public static <I> void traversePeaIds(Object obj, PeaIdManipulateMethods<I> methods) { if (obj == null) { return; } try { for (Class<?> clazz = obj.getClass(); clazz != null; clazz = clazz.getSuperclass()) { Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { if (field.isAnnotationPresent(PeaId.class)) { field.setAccessible(true); Object value = field.get(obj); if (value == null) { continue; } Class<?> fieldType = field.getType(); if (fieldType.isArray()) { methods.doWithArray((I[]) value); } else if (List.class.isAssignableFrom(fieldType)) { methods.doWithList((List<I>) value); } else if (Collection.class.isAssignableFrom(fieldType)) { methods.doWithCollection((Collection<I>) value); } else if (Map.class.isAssignableFrom(fieldType)) { methods.doWithMap((Map<Object, I>) value); } else { methods.doWithScalar(obj, field); } } else if (field.isAnnotationPresent(PeaId.InIt.class)) { field.setAccessible(true); Object value = field.get(obj); if (value == null) { continue; } Class<?> fieldType = field.getType(); if (fieldType.isArray()) { for (int i = 0; i < Array.getLength(value); i++) { traversePeaIds(Array.get(value, i), methods); } } else if (Collection.class.isAssignableFrom(fieldType)) { for (Object o : (Collection<Object>) value) { traversePeaIds(o, methods); } } else if (Map.class.isAssignableFrom(fieldType)) { for (Object o : ((Map<?, Object>) value).values()) { traversePeaIds(o, methods); } } else { traversePeaIds(value, methods); } } } } } catch (IllegalAccessException e) { throw new RuntimeException("PANIC in PeaUtils::replacePeaIds."); } } public static <I> void replacePeaIds(Object obj, UnaryOperator<I> replaceFun) { traversePeaIds(obj, new ReplaceMethods<>(replaceFun)); } public static <I> void visitPeaIds(Object obj, Consumer<I> visitFun) { traversePeaIds(obj, new VisitOnlyMethods<>(visitFun)); } public interface PeaIdManipulateMethods<I> { void doWithScalar(@Nonnull Object obj, @Nonnull Field field) throws IllegalAccessException; void doWithArray(@Nonnull I[] value); void doWithList(@Nonnull List<I> value); void doWithCollection(@Nonnull Collection<I> value); void doWithMap(@Nonnull Map<Object, I> value); } @RequiredArgsConstructor private static class ReplaceMethods<I> implements PeaIdManipulateMethods<I> { private final UnaryOperator<I> replaceFun; @SuppressWarnings("unchecked") @Override public void doWithScalar(@Nonnull Object obj, @Nonnull Field field) throws IllegalAccessException { I oldValue = (I) field.get(obj); I newValue = replaceFun.apply(oldValue); if (newValue != oldValue) { field.set(obj, newValue); } } @Override public void doWithArray(@Nonnull I[] value) { for (int i = 0; i < value.length; i++) { I oldValue = value[i]; I newValue = replaceFun.apply(oldValue); if (newValue != oldValue) { value[i] = newValue; } } } @Override public void doWithList(@Nonnull List<I> value) { value.replaceAll(replaceFun); } @Override public void doWithCollection(@Nonnull Collection<I> value) { for (I oldValue : value) { I newValue = replaceFun.apply(oldValue); if (newValue != oldValue) { value.remove(oldValue); value.add(newValue); } } } @Override public void doWithMap(@Nonnull Map<Object, I> value) { for (Map.Entry<Object, I> entry : value.entrySet()) { I oldValue = entry.getValue(); I newValue = replaceFun.apply(oldValue); if (newValue != oldValue) { value.put(entry.getKey(), newValue); } } } } @RequiredArgsConstructor private static class VisitOnlyMethods<I> implements PeaIdManipulateMethods<I> { private final Consumer<I> visitFun; @SuppressWarnings("unchecked") @Override public void doWithScalar(@Nonnull Object obj, @Nonnull Field field) throws IllegalAccessException { visitFun.accept((I) field.get(obj)); } @Override public void doWithArray(@Nonnull I[] value) { for (I id : value) { visitFun.accept(id); } } @Override public void doWithList(@Nonnull List<I> value) { doWithCollection(value); } @Override public void doWithCollection(@Nonnull Collection<I> value) { value.forEach(visitFun); } @Override public void doWithMap(@Nonnull Map<Object, I> value) { doWithCollection(value.values()); } } }
36.527919
107
0.527237
d0d8803a1577efbd8979357d7c994afafeb8364f
53,952
begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1 begin_comment comment|/* * 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. */ end_comment begin_package DECL|package|org.apache.camel.management.mbean package|package name|org operator|. name|apache operator|. name|camel operator|. name|management operator|. name|mbean package|; end_package begin_import import|import name|java operator|. name|util operator|. name|ArrayList import|; end_import begin_import import|import name|java operator|. name|util operator|. name|Collections import|; end_import begin_import import|import name|java operator|. name|util operator|. name|Comparator import|; end_import begin_import import|import name|java operator|. name|util operator|. name|HashMap import|; end_import begin_import import|import name|java operator|. name|util operator|. name|List import|; end_import begin_import import|import name|java operator|. name|util operator|. name|Map import|; end_import begin_import import|import name|java operator|. name|util operator|. name|Set import|; end_import begin_import import|import name|java operator|. name|util operator|. name|concurrent operator|. name|TimeUnit import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|AttributeValueExp import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|MBeanServer import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|ObjectName import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|Query import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|QueryExp import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|StringValueExp import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|openmbean operator|. name|CompositeData import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|openmbean operator|. name|CompositeDataSupport import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|openmbean operator|. name|CompositeType import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|openmbean operator|. name|TabularData import|; end_import begin_import import|import name|javax operator|. name|management operator|. name|openmbean operator|. name|TabularDataSupport import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|CamelContext import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|ManagementStatisticsLevel import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|Route import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|RuntimeCamelException import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|ServiceStatus import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|TimerListener import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|ManagedResource import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|mbean operator|. name|CamelOpenMBeanTypes import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|mbean operator|. name|ManagedProcessorMBean import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|mbean operator|. name|ManagedRouteMBean import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|mbean operator|. name|ManagedStepMBean import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|api operator|. name|management operator|. name|mbean operator|. name|RouteError import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|model operator|. name|Model import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|model operator|. name|ModelHelper import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|model operator|. name|RouteDefinition import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|spi operator|. name|InflightRepository import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|spi operator|. name|ManagementStrategy import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|spi operator|. name|RoutePolicy import|; end_import begin_import import|import name|org operator|. name|apache operator|. name|camel operator|. name|util operator|. name|ObjectHelper import|; end_import begin_import import|import name|org operator|. name|slf4j operator|. name|Logger import|; end_import begin_import import|import name|org operator|. name|slf4j operator|. name|LoggerFactory import|; end_import begin_class annotation|@ name|ManagedResource argument_list|( name|description operator|= literal|"Managed Route" argument_list|) DECL|class|ManagedRoute specifier|public class|class name|ManagedRoute extends|extends name|ManagedPerformanceCounter implements|implements name|TimerListener implements|, name|ManagedRouteMBean block|{ DECL|field|VALUE_UNKNOWN specifier|public specifier|static specifier|final name|String name|VALUE_UNKNOWN init|= literal|"Unknown" decl_stmt|; DECL|field|LOG specifier|private specifier|static specifier|final name|Logger name|LOG init|= name|LoggerFactory operator|. name|getLogger argument_list|( name|ManagedRoute operator|. name|class argument_list|) decl_stmt|; DECL|field|route specifier|protected specifier|final name|Route name|route decl_stmt|; DECL|field|description specifier|protected specifier|final name|String name|description decl_stmt|; DECL|field|context specifier|protected specifier|final name|CamelContext name|context decl_stmt|; DECL|field|load specifier|private specifier|final name|LoadTriplet name|load init|= operator|new name|LoadTriplet argument_list|() decl_stmt|; DECL|field|jmxDomain specifier|private specifier|final name|String name|jmxDomain decl_stmt|; DECL|method|ManagedRoute (CamelContext context, Route route) specifier|public name|ManagedRoute parameter_list|( name|CamelContext name|context parameter_list|, name|Route name|route parameter_list|) block|{ name|this operator|. name|route operator|= name|route expr_stmt|; name|this operator|. name|context operator|= name|context expr_stmt|; name|this operator|. name|description operator|= name|route operator|. name|getDescription argument_list|() expr_stmt|; name|this operator|. name|jmxDomain operator|= name|context operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getMBeanObjectDomainName argument_list|() expr_stmt|; block|} annotation|@ name|Override DECL|method|init (ManagementStrategy strategy) specifier|public name|void name|init parameter_list|( name|ManagementStrategy name|strategy parameter_list|) block|{ name|super operator|. name|init argument_list|( name|strategy argument_list|) expr_stmt|; name|boolean name|enabled init|= name|context operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getStatisticsLevel argument_list|() operator|!= name|ManagementStatisticsLevel operator|. name|Off decl_stmt|; name|setStatisticsEnabled argument_list|( name|enabled argument_list|) expr_stmt|; block|} DECL|method|getRoute () specifier|public name|Route name|getRoute parameter_list|() block|{ return|return name|route return|; block|} DECL|method|getContext () specifier|public name|CamelContext name|getContext parameter_list|() block|{ return|return name|context return|; block|} annotation|@ name|Override DECL|method|getRouteId () specifier|public name|String name|getRouteId parameter_list|() block|{ name|String name|id init|= name|route operator|. name|getId argument_list|() decl_stmt|; if|if condition|( name|id operator|== literal|null condition|) block|{ name|id operator|= name|VALUE_UNKNOWN expr_stmt|; block|} return|return name|id return|; block|} annotation|@ name|Override DECL|method|getRouteGroup () specifier|public name|String name|getRouteGroup parameter_list|() block|{ return|return name|route operator|. name|getGroup argument_list|() return|; block|} annotation|@ name|Override DECL|method|getRouteProperties () specifier|public name|TabularData name|getRouteProperties parameter_list|() block|{ try|try block|{ specifier|final name|Map argument_list|< name|String argument_list|, name|Object argument_list|> name|properties init|= name|route operator|. name|getProperties argument_list|() decl_stmt|; specifier|final name|TabularData name|answer init|= operator|new name|TabularDataSupport argument_list|( name|CamelOpenMBeanTypes operator|. name|camelRoutePropertiesTabularType argument_list|() argument_list|) decl_stmt|; specifier|final name|CompositeType name|ct init|= name|CamelOpenMBeanTypes operator|. name|camelRoutePropertiesCompositeType argument_list|() decl_stmt|; comment|// gather route properties for|for control|( name|Map operator|. name|Entry argument_list|< name|String argument_list|, name|Object argument_list|> name|entry range|: name|properties operator|. name|entrySet argument_list|() control|) block|{ specifier|final name|String name|key init|= name|entry operator|. name|getKey argument_list|() decl_stmt|; specifier|final name|String name|val init|= name|context operator|. name|getTypeConverter argument_list|() operator|. name|convertTo argument_list|( name|String operator|. name|class argument_list|, name|entry operator|. name|getValue argument_list|() argument_list|) decl_stmt|; name|CompositeData name|data init|= operator|new name|CompositeDataSupport argument_list|( name|ct argument_list|, operator|new name|String index|[] block|{ literal|"key" block|, literal|"value" block|} argument_list|, operator|new name|Object index|[] block|{ name|key block|, name|val block|} argument_list|) decl_stmt|; name|answer operator|. name|put argument_list|( name|data argument_list|) expr_stmt|; block|} return|return name|answer return|; block|} catch|catch parameter_list|( name|Exception name|e parameter_list|) block|{ throw|throw name|RuntimeCamelException operator|. name|wrapRuntimeCamelException argument_list|( name|e argument_list|) throw|; block|} block|} annotation|@ name|Override DECL|method|getDescription () specifier|public name|String name|getDescription parameter_list|() block|{ return|return name|description return|; block|} annotation|@ name|Override DECL|method|getEndpointUri () specifier|public name|String name|getEndpointUri parameter_list|() block|{ if|if condition|( name|route operator|. name|getEndpoint argument_list|() operator|!= literal|null condition|) block|{ return|return name|route operator|. name|getEndpoint argument_list|() operator|. name|getEndpointUri argument_list|() return|; block|} return|return name|VALUE_UNKNOWN return|; block|} annotation|@ name|Override DECL|method|getState () specifier|public name|String name|getState parameter_list|() block|{ comment|// must use String type to be sure remote JMX can read the attribute without requiring Camel classes. name|ServiceStatus name|status init|= name|context operator|. name|getRouteController argument_list|() operator|. name|getRouteStatus argument_list|( name|route operator|. name|getId argument_list|() argument_list|) decl_stmt|; comment|// if no status exists then its stopped if|if condition|( name|status operator|== literal|null condition|) block|{ name|status operator|= name|ServiceStatus operator|. name|Stopped expr_stmt|; block|} return|return name|status operator|. name|name argument_list|() return|; block|} annotation|@ name|Override DECL|method|getUptime () specifier|public name|String name|getUptime parameter_list|() block|{ return|return name|route operator|. name|getUptime argument_list|() return|; block|} annotation|@ name|Override DECL|method|getUptimeMillis () specifier|public name|long name|getUptimeMillis parameter_list|() block|{ return|return name|route operator|. name|getUptimeMillis argument_list|() return|; block|} DECL|method|getInflightExchanges () specifier|public name|Integer name|getInflightExchanges parameter_list|() block|{ return|return operator|( name|int operator|) name|super operator|. name|getExchangesInflight argument_list|() return|; block|} annotation|@ name|Override DECL|method|getCamelId () specifier|public name|String name|getCamelId parameter_list|() block|{ return|return name|context operator|. name|getName argument_list|() return|; block|} annotation|@ name|Override DECL|method|getCamelManagementName () specifier|public name|String name|getCamelManagementName parameter_list|() block|{ return|return name|context operator|. name|getManagementName argument_list|() return|; block|} annotation|@ name|Override DECL|method|getTracing () specifier|public name|Boolean name|getTracing parameter_list|() block|{ return|return name|route operator|. name|getRouteContext argument_list|() operator|. name|isTracing argument_list|() return|; block|} annotation|@ name|Override DECL|method|setTracing (Boolean tracing) specifier|public name|void name|setTracing parameter_list|( name|Boolean name|tracing parameter_list|) block|{ name|route operator|. name|getRouteContext argument_list|() operator|. name|setTracing argument_list|( name|tracing argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|getMessageHistory () specifier|public name|Boolean name|getMessageHistory parameter_list|() block|{ return|return name|route operator|. name|getRouteContext argument_list|() operator|. name|isMessageHistory argument_list|() return|; block|} annotation|@ name|Override DECL|method|getLogMask () specifier|public name|Boolean name|getLogMask parameter_list|() block|{ return|return name|route operator|. name|getRouteContext argument_list|() operator|. name|isLogMask argument_list|() return|; block|} annotation|@ name|Override DECL|method|getRoutePolicyList () specifier|public name|String name|getRoutePolicyList parameter_list|() block|{ name|List argument_list|< name|RoutePolicy argument_list|> name|policyList init|= name|route operator|. name|getRouteContext argument_list|() operator|. name|getRoutePolicyList argument_list|() decl_stmt|; if|if condition|( name|policyList operator|== literal|null operator||| name|policyList operator|. name|isEmpty argument_list|() condition|) block|{ comment|// return an empty string to have it displayed nicely in JMX consoles return|return literal|"" return|; block|} name|StringBuilder name|sb init|= operator|new name|StringBuilder argument_list|() decl_stmt|; for|for control|( name|int name|i init|= literal|0 init|; name|i operator|< name|policyList operator|. name|size argument_list|() condition|; name|i operator|++ control|) block|{ name|RoutePolicy name|policy init|= name|policyList operator|. name|get argument_list|( name|i argument_list|) decl_stmt|; name|sb operator|. name|append argument_list|( name|policy operator|. name|getClass argument_list|() operator|. name|getSimpleName argument_list|() argument_list|) expr_stmt|; name|sb operator|. name|append argument_list|( literal|"(" argument_list|) operator|. name|append argument_list|( name|ObjectHelper operator|. name|getIdentityHashCode argument_list|( name|policy argument_list|) argument_list|) operator|. name|append argument_list|( literal|")" argument_list|) expr_stmt|; if|if condition|( name|i operator|< name|policyList operator|. name|size argument_list|() operator|- literal|1 condition|) block|{ name|sb operator|. name|append argument_list|( literal|", " argument_list|) expr_stmt|; block|} block|} return|return name|sb operator|. name|toString argument_list|() return|; block|} annotation|@ name|Override DECL|method|getLoad01 () specifier|public name|String name|getLoad01 parameter_list|() block|{ name|double name|load1 init|= name|load operator|. name|getLoad1 argument_list|() decl_stmt|; if|if condition|( name|Double operator|. name|isNaN argument_list|( name|load1 argument_list|) condition|) block|{ comment|// empty string if load statistics is disabled return|return literal|"" return|; block|} else|else block|{ return|return name|String operator|. name|format argument_list|( literal|"%.2f" argument_list|, name|load1 argument_list|) return|; block|} block|} annotation|@ name|Override DECL|method|getLoad05 () specifier|public name|String name|getLoad05 parameter_list|() block|{ name|double name|load5 init|= name|load operator|. name|getLoad5 argument_list|() decl_stmt|; if|if condition|( name|Double operator|. name|isNaN argument_list|( name|load5 argument_list|) condition|) block|{ comment|// empty string if load statistics is disabled return|return literal|"" return|; block|} else|else block|{ return|return name|String operator|. name|format argument_list|( literal|"%.2f" argument_list|, name|load5 argument_list|) return|; block|} block|} annotation|@ name|Override DECL|method|getLoad15 () specifier|public name|String name|getLoad15 parameter_list|() block|{ name|double name|load15 init|= name|load operator|. name|getLoad15 argument_list|() decl_stmt|; if|if condition|( name|Double operator|. name|isNaN argument_list|( name|load15 argument_list|) condition|) block|{ comment|// empty string if load statistics is disabled return|return literal|"" return|; block|} else|else block|{ return|return name|String operator|. name|format argument_list|( literal|"%.2f" argument_list|, name|load15 argument_list|) return|; block|} block|} annotation|@ name|Override DECL|method|onTimer () specifier|public name|void name|onTimer parameter_list|() block|{ name|load operator|. name|update argument_list|( name|getInflightExchanges argument_list|() argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|start () specifier|public name|void name|start parameter_list|() throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} name|context operator|. name|getRouteController argument_list|() operator|. name|startRoute argument_list|( name|getRouteId argument_list|() argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|stop () specifier|public name|void name|stop parameter_list|() throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} name|context operator|. name|getRouteController argument_list|() operator|. name|stopRoute argument_list|( name|getRouteId argument_list|() argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|stop (long timeout) specifier|public name|void name|stop parameter_list|( name|long name|timeout parameter_list|) throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} name|context operator|. name|getRouteController argument_list|() operator|. name|stopRoute argument_list|( name|getRouteId argument_list|() argument_list|, name|timeout argument_list|, name|TimeUnit operator|. name|SECONDS argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|stop (Long timeout, Boolean abortAfterTimeout) specifier|public name|boolean name|stop parameter_list|( name|Long name|timeout parameter_list|, name|Boolean name|abortAfterTimeout parameter_list|) throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} return|return name|context operator|. name|getRouteController argument_list|() operator|. name|stopRoute argument_list|( name|getRouteId argument_list|() argument_list|, name|timeout argument_list|, name|TimeUnit operator|. name|SECONDS argument_list|, name|abortAfterTimeout argument_list|) return|; block|} DECL|method|shutdown () specifier|public name|void name|shutdown parameter_list|() throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} name|String name|routeId init|= name|getRouteId argument_list|() decl_stmt|; name|context operator|. name|getRouteController argument_list|() operator|. name|stopRoute argument_list|( name|routeId argument_list|) expr_stmt|; name|context operator|. name|removeRoute argument_list|( name|routeId argument_list|) expr_stmt|; block|} DECL|method|shutdown (long timeout) specifier|public name|void name|shutdown parameter_list|( name|long name|timeout parameter_list|) throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} name|String name|routeId init|= name|getRouteId argument_list|() decl_stmt|; name|context operator|. name|getRouteController argument_list|() operator|. name|stopRoute argument_list|( name|routeId argument_list|, name|timeout argument_list|, name|TimeUnit operator|. name|SECONDS argument_list|) expr_stmt|; name|context operator|. name|removeRoute argument_list|( name|routeId argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|remove () specifier|public name|boolean name|remove parameter_list|() throws|throws name|Exception block|{ if|if condition|( operator|! name|context operator|. name|getStatus argument_list|() operator|. name|isStarted argument_list|() condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"CamelContext is not started" argument_list|) throw|; block|} return|return name|context operator|. name|removeRoute argument_list|( name|getRouteId argument_list|() argument_list|) return|; block|} annotation|@ name|Override DECL|method|restart () specifier|public name|void name|restart parameter_list|() throws|throws name|Exception block|{ name|restart argument_list|( literal|1 argument_list|) expr_stmt|; block|} annotation|@ name|Override DECL|method|restart (long delay) specifier|public name|void name|restart parameter_list|( name|long name|delay parameter_list|) throws|throws name|Exception block|{ name|stop argument_list|() expr_stmt|; if|if condition|( name|delay operator|> literal|0 condition|) block|{ try|try block|{ name|LOG operator|. name|debug argument_list|( literal|"Sleeping {} seconds before starting route: {}" argument_list|, name|delay argument_list|, name|getRouteId argument_list|() argument_list|) expr_stmt|; name|Thread operator|. name|sleep argument_list|( name|delay operator|* literal|1000 argument_list|) expr_stmt|; block|} catch|catch parameter_list|( name|InterruptedException name|e parameter_list|) block|{ comment|// ignore block|} block|} name|start argument_list|() expr_stmt|; block|} annotation|@ name|Override DECL|method|dumpRouteAsXml () specifier|public name|String name|dumpRouteAsXml parameter_list|() throws|throws name|Exception block|{ return|return name|dumpRouteAsXml argument_list|( literal|false argument_list|, literal|false argument_list|) return|; block|} annotation|@ name|Override DECL|method|dumpRouteAsXml (boolean resolvePlaceholders) specifier|public name|String name|dumpRouteAsXml parameter_list|( name|boolean name|resolvePlaceholders parameter_list|) throws|throws name|Exception block|{ return|return name|dumpRouteAsXml argument_list|( name|resolvePlaceholders argument_list|, literal|false argument_list|) return|; block|} annotation|@ name|Override DECL|method|dumpRouteAsXml (boolean resolvePlaceholders, boolean resolveDelegateEndpoints) specifier|public name|String name|dumpRouteAsXml parameter_list|( name|boolean name|resolvePlaceholders parameter_list|, name|boolean name|resolveDelegateEndpoints parameter_list|) throws|throws name|Exception block|{ name|String name|id init|= name|route operator|. name|getId argument_list|() decl_stmt|; name|RouteDefinition name|def init|= name|context operator|. name|getExtension argument_list|( name|Model operator|. name|class argument_list|) operator|. name|getRouteDefinition argument_list|( name|id argument_list|) decl_stmt|; if|if condition|( name|def operator|!= literal|null condition|) block|{ return|return name|ModelHelper operator|. name|dumpModelAsXml argument_list|( name|context argument_list|, name|def argument_list|, name|resolvePlaceholders argument_list|, name|resolveDelegateEndpoints argument_list|) return|; block|} return|return literal|null return|; block|} annotation|@ name|Override DECL|method|updateRouteFromXml (String xml) specifier|public name|void name|updateRouteFromXml parameter_list|( name|String name|xml parameter_list|) throws|throws name|Exception block|{ comment|// convert to model from xml name|RouteDefinition name|def init|= name|ModelHelper operator|. name|createModelFromXml argument_list|( name|context argument_list|, name|xml argument_list|, name|RouteDefinition operator|. name|class argument_list|) decl_stmt|; if|if condition|( name|def operator|== literal|null condition|) block|{ return|return; block|} comment|// if the xml does not contain the route-id then we fix this by adding the actual route id comment|// this may be needed if the route-id was auto-generated, as the intend is to update this route comment|// and not add a new route, adding a new route, use the MBean operation on ManagedCamelContext instead. if|if condition|( name|ObjectHelper operator|. name|isEmpty argument_list|( name|def operator|. name|getId argument_list|() argument_list|) condition|) block|{ name|def operator|. name|setId argument_list|( name|getRouteId argument_list|() argument_list|) expr_stmt|; block|} elseif|else if|if condition|( operator|! name|def operator|. name|getId argument_list|() operator|. name|equals argument_list|( name|getRouteId argument_list|() argument_list|) condition|) block|{ throw|throw operator|new name|IllegalArgumentException argument_list|( literal|"Cannot update route from XML as routeIds does not match. routeId: " operator|+ name|getRouteId argument_list|() operator|+ literal|", routeId from XML: " operator|+ name|def operator|. name|getId argument_list|() argument_list|) throw|; block|} name|LOG operator|. name|debug argument_list|( literal|"Updating route: {} from xml: {}" argument_list|, name|def operator|. name|getId argument_list|() argument_list|, name|xml argument_list|) expr_stmt|; try|try block|{ comment|// add will remove existing route first name|context operator|. name|getExtension argument_list|( name|Model operator|. name|class argument_list|) operator|. name|addRouteDefinition argument_list|( name|def argument_list|) expr_stmt|; block|} catch|catch parameter_list|( name|Exception name|e parameter_list|) block|{ comment|// log the error as warn as the management api may be invoked remotely over JMX which does not propagate such exception name|String name|msg init|= literal|"Error updating route: " operator|+ name|def operator|. name|getId argument_list|() operator|+ literal|" from xml: " operator|+ name|xml operator|+ literal|" due: " operator|+ name|e operator|. name|getMessage argument_list|() decl_stmt|; name|LOG operator|. name|warn argument_list|( name|msg argument_list|, name|e argument_list|) expr_stmt|; throw|throw name|e throw|; block|} block|} annotation|@ name|Override DECL|method|dumpRouteStatsAsXml (boolean fullStats, boolean includeProcessors) specifier|public name|String name|dumpRouteStatsAsXml parameter_list|( name|boolean name|fullStats parameter_list|, name|boolean name|includeProcessors parameter_list|) throws|throws name|Exception block|{ comment|// in this logic we need to calculate the accumulated processing time for the processor in the route comment|// and hence why the logic is a bit more complicated to do this, as we need to calculate that from comment|// the bottom -> top of the route but this information is valuable for profiling routes name|StringBuilder name|sb init|= operator|new name|StringBuilder argument_list|() decl_stmt|; comment|// need to calculate this value first, as we need that value for the route stat name|Long name|processorAccumulatedTime init|= literal|0L decl_stmt|; comment|// gather all the processors for this route, which requires JMX if|if condition|( name|includeProcessors condition|) block|{ name|sb operator|. name|append argument_list|( literal|"<processorStats>\n" argument_list|) expr_stmt|; name|MBeanServer name|server init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getMBeanServer argument_list|() decl_stmt|; if|if condition|( name|server operator|!= literal|null condition|) block|{ comment|// get all the processor mbeans and sort them accordingly to their index name|String name|prefix init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getIncludeHostName argument_list|() condition|? literal|"*/" else|: literal|"" decl_stmt|; name|ObjectName name|query init|= name|ObjectName operator|. name|getInstance argument_list|( name|jmxDomain operator|+ literal|":context=" operator|+ name|prefix operator|+ name|getContext argument_list|() operator|. name|getManagementName argument_list|() operator|+ literal|",type=processors,*" argument_list|) decl_stmt|; name|Set argument_list|< name|ObjectName argument_list|> name|names init|= name|server operator|. name|queryNames argument_list|( name|query argument_list|, literal|null argument_list|) decl_stmt|; name|List argument_list|< name|ManagedProcessorMBean argument_list|> name|mps init|= operator|new name|ArrayList argument_list|<> argument_list|() decl_stmt|; for|for control|( name|ObjectName name|on range|: name|names control|) block|{ name|ManagedProcessorMBean name|processor init|= name|context operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|newProxyClient argument_list|( name|on argument_list|, name|ManagedProcessorMBean operator|. name|class argument_list|) decl_stmt|; comment|// the processor must belong to this route if|if condition|( name|getRouteId argument_list|() operator|. name|equals argument_list|( name|processor operator|. name|getRouteId argument_list|() argument_list|) condition|) block|{ name|mps operator|. name|add argument_list|( name|processor argument_list|) expr_stmt|; block|} block|} name|mps operator|. name|sort argument_list|( operator|new name|OrderProcessorMBeans argument_list|() argument_list|) expr_stmt|; comment|// walk the processors in reverse order, and calculate the accumulated total time name|Map argument_list|< name|String argument_list|, name|Long argument_list|> name|accumulatedTimes init|= operator|new name|HashMap argument_list|<> argument_list|() decl_stmt|; name|Collections operator|. name|reverse argument_list|( name|mps argument_list|) expr_stmt|; for|for control|( name|ManagedProcessorMBean name|processor range|: name|mps control|) block|{ name|processorAccumulatedTime operator|+= name|processor operator|. name|getTotalProcessingTime argument_list|() expr_stmt|; name|accumulatedTimes operator|. name|put argument_list|( name|processor operator|. name|getProcessorId argument_list|() argument_list|, name|processorAccumulatedTime argument_list|) expr_stmt|; block|} comment|// and reverse back again name|Collections operator|. name|reverse argument_list|( name|mps argument_list|) expr_stmt|; comment|// and now add the sorted list of processors to the xml output for|for control|( name|ManagedProcessorMBean name|processor range|: name|mps control|) block|{ name|sb operator|. name|append argument_list|( literal|"<processorStat" argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" id=\"%s\" index=\"%s\" state=\"%s\"" argument_list|, name|processor operator|. name|getProcessorId argument_list|() argument_list|, name|processor operator|. name|getIndex argument_list|() argument_list|, name|processor operator|. name|getState argument_list|() argument_list|) argument_list|) expr_stmt|; comment|// do we have an accumulated time then append that name|Long name|accTime init|= name|accumulatedTimes operator|. name|get argument_list|( name|processor operator|. name|getProcessorId argument_list|() argument_list|) decl_stmt|; if|if condition|( name|accTime operator|!= literal|null condition|) block|{ name|sb operator|. name|append argument_list|( literal|" accumulatedProcessingTime=\"" argument_list|) operator|. name|append argument_list|( name|accTime argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; block|} comment|// use substring as we only want the attributes name|sb operator|. name|append argument_list|( literal|" " argument_list|) operator|. name|append argument_list|( name|processor operator|. name|dumpStatsAsXml argument_list|( name|fullStats argument_list|) operator|. name|substring argument_list|( literal|7 argument_list|) argument_list|) operator|. name|append argument_list|( literal|"\n" argument_list|) expr_stmt|; block|} block|} name|sb operator|. name|append argument_list|( literal|"</processorStats>\n" argument_list|) expr_stmt|; block|} comment|// route self time is route total - processor accumulated total) name|long name|routeSelfTime init|= name|getTotalProcessingTime argument_list|() operator|- name|processorAccumulatedTime decl_stmt|; if|if condition|( name|routeSelfTime operator|< literal|0 condition|) block|{ comment|// ensure we don't calculate that as negative name|routeSelfTime operator|= literal|0 expr_stmt|; block|} name|StringBuilder name|answer init|= operator|new name|StringBuilder argument_list|() decl_stmt|; name|answer operator|. name|append argument_list|( literal|"<routeStat" argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" id=\"%s\"" argument_list|, name|route operator|. name|getId argument_list|() argument_list|) argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" state=\"%s\"" argument_list|, name|getState argument_list|() argument_list|) argument_list|) expr_stmt|; comment|// use substring as we only want the attributes name|String name|stat init|= name|dumpStatsAsXml argument_list|( name|fullStats argument_list|) decl_stmt|; name|answer operator|. name|append argument_list|( literal|" exchangesInflight=\"" argument_list|) operator|. name|append argument_list|( name|getInflightExchanges argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|" selfProcessingTime=\"" argument_list|) operator|. name|append argument_list|( name|routeSelfTime argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; name|InflightRepository operator|. name|InflightExchange name|oldest init|= name|getOldestInflightEntry argument_list|() decl_stmt|; if|if condition|( name|oldest operator|== literal|null condition|) block|{ name|answer operator|. name|append argument_list|( literal|" oldestInflightExchangeId=\"\"" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|" oldestInflightDuration=\"\"" argument_list|) expr_stmt|; block|} else|else block|{ name|answer operator|. name|append argument_list|( literal|" oldestInflightExchangeId=\"" argument_list|) operator|. name|append argument_list|( name|oldest operator|. name|getExchange argument_list|() operator|. name|getExchangeId argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|" oldestInflightDuration=\"" argument_list|) operator|. name|append argument_list|( name|oldest operator|. name|getDuration argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; block|} name|answer operator|. name|append argument_list|( literal|" " argument_list|) operator|. name|append argument_list|( name|stat operator|. name|substring argument_list|( literal|7 argument_list|, name|stat operator|. name|length argument_list|() operator|- literal|2 argument_list|) argument_list|) operator|. name|append argument_list|( literal|">\n" argument_list|) expr_stmt|; if|if condition|( name|includeProcessors condition|) block|{ name|answer operator|. name|append argument_list|( name|sb argument_list|) expr_stmt|; block|} name|answer operator|. name|append argument_list|( literal|"</routeStat>" argument_list|) expr_stmt|; return|return name|answer operator|. name|toString argument_list|() return|; block|} annotation|@ name|Override DECL|method|dumpStepStatsAsXml (boolean fullStats) specifier|public name|String name|dumpStepStatsAsXml parameter_list|( name|boolean name|fullStats parameter_list|) throws|throws name|Exception block|{ comment|// in this logic we need to calculate the accumulated processing time for the processor in the route comment|// and hence why the logic is a bit more complicated to do this, as we need to calculate that from comment|// the bottom -> top of the route but this information is valuable for profiling routes name|StringBuilder name|sb init|= operator|new name|StringBuilder argument_list|() decl_stmt|; comment|// gather all the steps for this route, which requires JMX name|sb operator|. name|append argument_list|( literal|"<stepStats>\n" argument_list|) expr_stmt|; name|MBeanServer name|server init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getMBeanServer argument_list|() decl_stmt|; if|if condition|( name|server operator|!= literal|null condition|) block|{ comment|// get all the processor mbeans and sort them accordingly to their index name|String name|prefix init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getIncludeHostName argument_list|() condition|? literal|"*/" else|: literal|"" decl_stmt|; name|ObjectName name|query init|= name|ObjectName operator|. name|getInstance argument_list|( name|jmxDomain operator|+ literal|":context=" operator|+ name|prefix operator|+ name|getContext argument_list|() operator|. name|getManagementName argument_list|() operator|+ literal|",type=steps,*" argument_list|) decl_stmt|; name|Set argument_list|< name|ObjectName argument_list|> name|names init|= name|server operator|. name|queryNames argument_list|( name|query argument_list|, literal|null argument_list|) decl_stmt|; name|List argument_list|< name|ManagedStepMBean argument_list|> name|mps init|= operator|new name|ArrayList argument_list|<> argument_list|() decl_stmt|; for|for control|( name|ObjectName name|on range|: name|names control|) block|{ name|ManagedStepMBean name|step init|= name|context operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|newProxyClient argument_list|( name|on argument_list|, name|ManagedStepMBean operator|. name|class argument_list|) decl_stmt|; comment|// the step must belong to this route if|if condition|( name|getRouteId argument_list|() operator|. name|equals argument_list|( name|step operator|. name|getRouteId argument_list|() argument_list|) condition|) block|{ name|mps operator|. name|add argument_list|( name|step argument_list|) expr_stmt|; block|} block|} name|mps operator|. name|sort argument_list|( operator|new name|OrderProcessorMBeans argument_list|() argument_list|) expr_stmt|; comment|// and now add the sorted list of steps to the xml output for|for control|( name|ManagedStepMBean name|step range|: name|mps control|) block|{ name|sb operator|. name|append argument_list|( literal|"<stepStat" argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" id=\"%s\" index=\"%s\" state=\"%s\"" argument_list|, name|step operator|. name|getProcessorId argument_list|() argument_list|, name|step operator|. name|getIndex argument_list|() argument_list|, name|step operator|. name|getState argument_list|() argument_list|) argument_list|) expr_stmt|; comment|// use substring as we only want the attributes name|sb operator|. name|append argument_list|( literal|" " argument_list|) operator|. name|append argument_list|( name|step operator|. name|dumpStatsAsXml argument_list|( name|fullStats argument_list|) operator|. name|substring argument_list|( literal|7 argument_list|) argument_list|) operator|. name|append argument_list|( literal|"\n" argument_list|) expr_stmt|; block|} block|} name|sb operator|. name|append argument_list|( literal|"</stepStats>\n" argument_list|) expr_stmt|; name|StringBuilder name|answer init|= operator|new name|StringBuilder argument_list|() decl_stmt|; name|answer operator|. name|append argument_list|( literal|"<routeStat" argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" id=\"%s\"" argument_list|, name|route operator|. name|getId argument_list|() argument_list|) argument_list|) operator|. name|append argument_list|( name|String operator|. name|format argument_list|( literal|" state=\"%s\"" argument_list|, name|getState argument_list|() argument_list|) argument_list|) expr_stmt|; comment|// use substring as we only want the attributes name|String name|stat init|= name|dumpStatsAsXml argument_list|( name|fullStats argument_list|) decl_stmt|; name|answer operator|. name|append argument_list|( literal|" exchangesInflight=\"" argument_list|) operator|. name|append argument_list|( name|getInflightExchanges argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; name|InflightRepository operator|. name|InflightExchange name|oldest init|= name|getOldestInflightEntry argument_list|() decl_stmt|; if|if condition|( name|oldest operator|== literal|null condition|) block|{ name|answer operator|. name|append argument_list|( literal|" oldestInflightExchangeId=\"\"" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|" oldestInflightDuration=\"\"" argument_list|) expr_stmt|; block|} else|else block|{ name|answer operator|. name|append argument_list|( literal|" oldestInflightExchangeId=\"" argument_list|) operator|. name|append argument_list|( name|oldest operator|. name|getExchange argument_list|() operator|. name|getExchangeId argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|" oldestInflightDuration=\"" argument_list|) operator|. name|append argument_list|( name|oldest operator|. name|getDuration argument_list|() argument_list|) operator|. name|append argument_list|( literal|"\"" argument_list|) expr_stmt|; block|} name|answer operator|. name|append argument_list|( literal|" " argument_list|) operator|. name|append argument_list|( name|stat operator|. name|substring argument_list|( literal|7 argument_list|, name|stat operator|. name|length argument_list|() operator|- literal|2 argument_list|) argument_list|) operator|. name|append argument_list|( literal|">\n" argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( name|sb argument_list|) expr_stmt|; name|answer operator|. name|append argument_list|( literal|"</routeStat>" argument_list|) expr_stmt|; return|return name|answer operator|. name|toString argument_list|() return|; block|} annotation|@ name|Override DECL|method|reset (boolean includeProcessors) specifier|public name|void name|reset parameter_list|( name|boolean name|includeProcessors parameter_list|) throws|throws name|Exception block|{ name|reset argument_list|() expr_stmt|; comment|// and now reset all processors for this route if|if condition|( name|includeProcessors condition|) block|{ name|MBeanServer name|server init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getMBeanServer argument_list|() decl_stmt|; if|if condition|( name|server operator|!= literal|null condition|) block|{ comment|// get all the processor mbeans and sort them accordingly to their index name|String name|prefix init|= name|getContext argument_list|() operator|. name|getManagementStrategy argument_list|() operator|. name|getManagementAgent argument_list|() operator|. name|getIncludeHostName argument_list|() condition|? literal|"*/" else|: literal|"" decl_stmt|; name|ObjectName name|query init|= name|ObjectName operator|. name|getInstance argument_list|( name|jmxDomain operator|+ literal|":context=" operator|+ name|prefix operator|+ name|getContext argument_list|() operator|. name|getManagementName argument_list|() operator|+ literal|",type=processors,*" argument_list|) decl_stmt|; name|QueryExp name|queryExp init|= name|Query operator|. name|match argument_list|( operator|new name|AttributeValueExp argument_list|( literal|"RouteId" argument_list|) argument_list|, operator|new name|StringValueExp argument_list|( name|getRouteId argument_list|() argument_list|) argument_list|) decl_stmt|; name|Set argument_list|< name|ObjectName argument_list|> name|names init|= name|server operator|. name|queryNames argument_list|( name|query argument_list|, name|queryExp argument_list|) decl_stmt|; for|for control|( name|ObjectName name|name range|: name|names control|) block|{ name|server operator|. name|invoke argument_list|( name|name argument_list|, literal|"reset" argument_list|, literal|null argument_list|, literal|null argument_list|) expr_stmt|; block|} block|} block|} block|} annotation|@ name|Override DECL|method|equals (Object o) specifier|public name|boolean name|equals parameter_list|( name|Object name|o parameter_list|) block|{ return|return name|this operator|== name|o operator||| operator|( name|o operator|!= literal|null operator|&& name|getClass argument_list|() operator|== name|o operator|. name|getClass argument_list|() operator|&& name|route operator|. name|equals argument_list|( operator|( operator|( name|ManagedRoute operator|) name|o operator|) operator|. name|route argument_list|) operator|) return|; block|} annotation|@ name|Override DECL|method|hashCode () specifier|public name|int name|hashCode parameter_list|() block|{ return|return name|route operator|. name|hashCode argument_list|() return|; block|} DECL|method|getOldestInflightEntry () specifier|private name|InflightRepository operator|. name|InflightExchange name|getOldestInflightEntry parameter_list|() block|{ return|return name|getContext argument_list|() operator|. name|getInflightRepository argument_list|() operator|. name|oldest argument_list|( name|getRouteId argument_list|() argument_list|) return|; block|} annotation|@ name|Override DECL|method|getOldestInflightDuration () specifier|public name|Long name|getOldestInflightDuration parameter_list|() block|{ name|InflightRepository operator|. name|InflightExchange name|oldest init|= name|getOldestInflightEntry argument_list|() decl_stmt|; if|if condition|( name|oldest operator|== literal|null condition|) block|{ return|return literal|null return|; block|} else|else block|{ return|return name|oldest operator|. name|getDuration argument_list|() return|; block|} block|} annotation|@ name|Override DECL|method|getOldestInflightExchangeId () specifier|public name|String name|getOldestInflightExchangeId parameter_list|() block|{ name|InflightRepository operator|. name|InflightExchange name|oldest init|= name|getOldestInflightEntry argument_list|() decl_stmt|; if|if condition|( name|oldest operator|== literal|null condition|) block|{ return|return literal|null return|; block|} else|else block|{ return|return name|oldest operator|. name|getExchange argument_list|() operator|. name|getExchangeId argument_list|() return|; block|} block|} annotation|@ name|Override DECL|method|getHasRouteController () specifier|public name|Boolean name|getHasRouteController parameter_list|() block|{ return|return name|route operator|. name|getRouteContext argument_list|() operator|. name|getRouteController argument_list|() operator|!= literal|null return|; block|} annotation|@ name|Override DECL|method|getLastError () specifier|public name|RouteError name|getLastError parameter_list|() block|{ name|org operator|. name|apache operator|. name|camel operator|. name|spi operator|. name|RouteError name|error init|= name|route operator|. name|getRouteContext argument_list|() operator|. name|getLastError argument_list|() decl_stmt|; if|if condition|( name|error operator|== literal|null condition|) block|{ return|return literal|null return|; block|} else|else block|{ return|return operator|new name|RouteError argument_list|() block|{ annotation|@ name|Override specifier|public name|Phase name|getPhase parameter_list|() block|{ if|if condition|( name|error operator|. name|getPhase argument_list|() operator|!= literal|null condition|) block|{ switch|switch condition|( name|error operator|. name|getPhase argument_list|() condition|) block|{ case|case name|START case|: return|return name|Phase operator|. name|START return|; case|case name|STOP case|: return|return name|Phase operator|. name|STOP return|; case|case name|SUSPEND case|: return|return name|Phase operator|. name|SUSPEND return|; case|case name|RESUME case|: return|return name|Phase operator|. name|RESUME return|; case|case name|SHUTDOWN case|: return|return name|Phase operator|. name|SHUTDOWN return|; case|case name|REMOVE case|: return|return name|Phase operator|. name|REMOVE return|; default|default: throw|throw operator|new name|IllegalStateException argument_list|() throw|; block|} block|} return|return literal|null return|; block|} annotation|@ name|Override specifier|public name|Throwable name|getException parameter_list|() block|{ return|return name|error operator|. name|getException argument_list|() return|; block|} block|} return|; block|} block|} comment|/** * Used for sorting the processor mbeans accordingly to their index. */ DECL|class|OrderProcessorMBeans specifier|private specifier|static specifier|final class|class name|OrderProcessorMBeans implements|implements name|Comparator argument_list|< name|ManagedProcessorMBean argument_list|> block|{ annotation|@ name|Override DECL|method|compare (ManagedProcessorMBean o1, ManagedProcessorMBean o2) specifier|public name|int name|compare parameter_list|( name|ManagedProcessorMBean name|o1 parameter_list|, name|ManagedProcessorMBean name|o2 parameter_list|) block|{ return|return name|o1 operator|. name|getIndex argument_list|() operator|. name|compareTo argument_list|( name|o2 operator|. name|getIndex argument_list|() argument_list|) return|; block|} block|} block|} end_class end_unit
14.483758
810
0.798321
b5eccb0e1e23402b6e9e6ccf770f9cd756365b54
597
package com.github.ltsopensource.alarm.email; import org.junit.Test; /** * @author Robert HG (254963746@qq.com) on 2/17/16. */ public class SMTPMailManagerImplTest { @Test public void testSend() throws Exception { // String host = "smtp.qq.com"; // // 授权码从这里获取 http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256 // // lts12345 // MailManager mailManager = new SMTPMailManagerImpl(host, "2179816070@qq.com", "这里是授权码", "LTS通知中心(notice@lts.com)", true); // mailManager.send("254963746@qq.com", "测试", "fdsafhakdsjfladslfj呵呵呵"); } }
33.166667
130
0.659966
659d9a5754fa91db7e09f50b98f338b8d72ccfe2
969
import java.util.*; public class Q7 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); //Q7 is to find the Fibonacci of the n number not the factor // System.out.print("Enter the number : "); // int number = sc.nextInt(); // System.out.print("Factors of " + number + " are: "); // for (int i = 1; i <= number; ++i){ // if (number % i == 0){ // System.out.print(i + " "); // } // } // sc.close(); //Fibonacci of n number System.out.print("Enter the number: "); int num = sc.nextInt(); int n1 = 0, n2 = 1, n3, i; System.out.print(n1 + " " + n2);//printing 0 and 1 for (i = 2; i < num; ++i)//loop starts from 2 because 0 and 1 are already printed { n3 = n1 + n2; System.out.print(" " + n3); n1 = n2; n2 = n3; } } }
30.28125
93
0.458204
87c380df4d7af38e2423f7759c3e49beee97fb33
5,285
/* * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft. * * This file is part of KeePass DX. * * KeePass DX is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with KeePass DX. If not, see <http://www.gnu.org/licenses/>. * */ package com.kunzisoft.keepass.database.action; import android.content.Context; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.support.annotation.StringRes; import android.util.Log; import com.kunzisoft.keepass.R; import com.kunzisoft.keepass.app.App; import com.kunzisoft.keepass.database.Database; import com.kunzisoft.keepass.database.exception.ArcFourException; import com.kunzisoft.keepass.database.exception.ContentFileNotFoundException; import com.kunzisoft.keepass.database.exception.InvalidAlgorithmException; import com.kunzisoft.keepass.database.exception.InvalidDBException; import com.kunzisoft.keepass.database.exception.InvalidDBSignatureException; import com.kunzisoft.keepass.database.exception.InvalidDBVersionException; import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; import com.kunzisoft.keepass.database.exception.InvalidPasswordException; import com.kunzisoft.keepass.database.exception.KeyFileEmptyException; import java.io.FileNotFoundException; import java.io.IOException; public class LoadDatabaseRunnable extends RunnableOnFinish { private static final String TAG = LoadDatabaseRunnable.class.getName(); private Context mContext; private Database mDatabase; private Uri mUri; private String mPass; private Uri mKey; private boolean mRememberKeyfile; public LoadDatabaseRunnable(Context context, Database database, Uri uri, String pass, Uri key, OnFinishRunnable finish) { super(finish); this.mContext = context; this.mDatabase = database; this.mUri = uri; this.mPass = pass; this.mKey = key; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); this.mRememberKeyfile = prefs.getBoolean(context.getString(R.string.keyfile_key), context.getResources().getBoolean(R.bool.keyfile_default)); } @Override public void run() { try { mDatabase.loadData(mContext, mUri, mPass, mKey, mStatus); saveFileData(mUri, mKey); } catch (ArcFourException e) { catchError(e, R.string.error_arc4); return; } catch (InvalidPasswordException e) { catchError(e, R.string.invalid_password); return; } catch (ContentFileNotFoundException e) { catchError(e, R.string.file_not_found_content); return; } catch (FileNotFoundException e) { catchError(e, R.string.file_not_found); return; } catch (IOException e) { if (e.getMessage().contains("Hash failed with code")) catchError(e, R.string.error_load_database_KDF_memory, true); else catchError(e, R.string.error_load_database, true); return; } catch (KeyFileEmptyException e) { catchError(e, R.string.keyfile_is_empty); return; } catch (InvalidAlgorithmException e) { catchError(e, R.string.invalid_algorithm); return; } catch (InvalidKeyFileException e) { catchError(e, R.string.keyfile_does_not_exist); return; } catch (InvalidDBSignatureException e) { catchError(e, R.string.invalid_db_sig); return; } catch (InvalidDBVersionException e) { catchError(e, R.string.unsupported_db_version); return; } catch (InvalidDBException e) { catchError(e, R.string.error_invalid_db); return; } catch (OutOfMemoryError e) { catchError(e, R.string.error_out_of_memory); return; } catch (Exception e) { catchError(e, R.string.error_load_database, true); return; } finish(true); } private void catchError(Throwable e, @StringRes int messageId) { catchError(e, messageId, false); } private void catchError(Throwable e, @StringRes int messageId, boolean addThrowableMessage) { String errorMessage = mContext.getString(messageId); Log.e(TAG, errorMessage, e); if (addThrowableMessage) errorMessage = errorMessage + " " + e.getLocalizedMessage(); finish(false, errorMessage); } private void saveFileData(Uri uri, Uri key) { if ( ! mRememberKeyfile ) { key = null; } App.getFileHistory().createFile(uri, key); } }
37.75
149
0.68193
152ff2d87f447129e357fe1673e2929360c4f456
1,781
package org.vaadin.addon.mermaid; import com.vaadin.annotations.JavaScript; import com.vaadin.annotations.StyleSheet; import com.vaadin.ui.AbstractJavaScriptComponent; import com.vaadin.ui.JavaScriptFunction; import java.util.LinkedList; import java.util.List; @JavaScript({"mermaid.min.js", "mermaid_connector.js", "simg.min.js",}) @StyleSheet({"mermaid.css"}) public class MermaidChart extends AbstractJavaScriptComponent { private final List<StateClickListener> stateClickListenerList = new LinkedList<>(); private String data; public interface StateClickListener { void onStateClick(String id); } public MermaidChart(String data) { this.data = data; addJsFunctions(); } // We must override getState() to cast the state to MermaidState @Override protected MermaidState getState() { return (MermaidState) super.getState(); } @Override public void attach() { if (data != null) { getState().data = data; } super.attach(); } private void addJsFunctions() { addFunction("onStateClick", (JavaScriptFunction) arguments -> stateClickListenerList.forEach(listener -> listener.onStateClick(arguments.getString(0)))); } public void render(String data) { if (data != null) { getState().data = data; } } public void downloadImage(String filename) { callFunction("downloadAsImage", filename); } public void addStateClickListener(StateClickListener listener) { stateClickListenerList.add(listener); listenerState(); } public void removeStateClickListener(StateClickListener listener) { stateClickListenerList.remove(listener); listenerState(); } private void listenerState() { getState().callListener = !stateClickListenerList.isEmpty(); } }
25.084507
99
0.720943
f785a7fdb52e85f7fcc42af9e2ad4e3d9014c7eb
155
package www.hwh.ognl; public class S { public static String STR = "STATIC STRING"; public static String s() { return "static method"; } }
15.5
45
0.63871
c6bd9ad4ef1e97359481ebd7f33abee97e1b6162
6,035
/* * Copyright 2019 Google LLC * * Licensed 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. */ package com.google.cloud.storage.contrib.nio; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import com.google.cloud.testing.junit4.MultipleAttemptsRule; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.channels.SeekableByteChannel; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class CloudStorageReadFileChannelTest { @Rule public final MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3); private static final class SeekableByteChannelImpl implements SeekableByteChannel { private boolean open = true; private ByteBuffer data; private SeekableByteChannelImpl(ByteBuffer data) { this.data = data; } @Override public boolean isOpen() { return open; } @Override public void close() throws IOException { open = false; } @Override public int read(ByteBuffer dst) throws IOException { byte[] tmp = new byte[Math.min(dst.remaining(), data.remaining())]; if (tmp.length == 0) { return -1; } else { data.get(tmp); dst.put(tmp); return tmp.length; } } @Override public int write(ByteBuffer src) throws IOException { int res = src.remaining(); if (data.position() + res > data.limit()) { data.limit(data.limit() + res); } data.put(src); return res; } @Override public long position() throws IOException { return data.position(); } @Override public SeekableByteChannel position(long newPosition) throws IOException { if (newPosition >= data.limit()) { data.limit((int) newPosition); } data.position((int) newPosition); return this; } @Override public long size() throws IOException { return data.limit(); } @Override public SeekableByteChannel truncate(long size) throws IOException { if (size < data.limit()) { if (data.position() >= size) { data.position((int) size - 1); } data.limit((int) size); } return this; } } private CloudStorageReadFileChannel fileChannel; private SeekableByteChannel readChannel; private ByteBuffer data; @Before public void before() throws IOException { data = ByteBuffer.allocate(5000); data.limit(3); data.put(new byte[] {1, 2, 3}); data.position(0); readChannel = new SeekableByteChannelImpl(data); fileChannel = new CloudStorageReadFileChannel(readChannel); } @Test public void testRead() throws IOException { ByteBuffer buffer = ByteBuffer.allocate(1); assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(fileChannel.read(buffer), is(equalTo(1))); assertThat(fileChannel.position(), is(equalTo(1L))); assertThat(buffer.get(0), is(equalTo((byte) 1))); } @Test public void testReadArray() throws IOException { ByteBuffer[] buffers = new ByteBuffer[] {ByteBuffer.allocate(1), ByteBuffer.allocate(1), ByteBuffer.allocate(1)}; assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(fileChannel.read(buffers), is(equalTo(3L))); assertThat(fileChannel.position(), is(equalTo(3L))); assertThat(buffers[0].get(0), is(equalTo((byte) 1))); assertThat(buffers[1].get(0), is(equalTo((byte) 2))); assertThat(buffers[2].get(0), is(equalTo((byte) 3))); } @Test public void testPosition() throws IOException { assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(fileChannel.position(1L), is(equalTo((FileChannel) fileChannel))); assertThat(fileChannel.position(), is(equalTo(1L))); assertThat(fileChannel.position(0L), is(equalTo((FileChannel) fileChannel))); assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(fileChannel.position(100L), is(equalTo((FileChannel) fileChannel))); assertThat(fileChannel.position(), is(equalTo(100L))); } @Test public void testSize() throws IOException { assertThat(fileChannel.size(), is(equalTo(3L))); } @Test public void testTransferTo() throws IOException { SeekableByteChannelImpl target = new SeekableByteChannelImpl(ByteBuffer.allocate(100)); assertThat(fileChannel.transferTo(0L, 3L, target), is(equalTo(3L))); assertThat(target.position(), is(equalTo(3L))); ByteBuffer dst = ByteBuffer.allocate(3); target.position(0L); target.read(dst); assertThat(dst.get(0), is(equalTo((byte) 1))); assertThat(dst.get(1), is(equalTo((byte) 2))); assertThat(dst.get(2), is(equalTo((byte) 3))); } @Test public void testReadOnPosition() throws IOException { ByteBuffer buffer = ByteBuffer.allocate(1); assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(fileChannel.read(buffer, 1L), is(equalTo(1))); assertThat(fileChannel.position(), is(equalTo(0L))); assertThat(buffer.get(0), is(equalTo((byte) 2))); } @Test public void testReadBeyondEnd() throws IOException { fileChannel.position(3L); assertThat(fileChannel.read(ByteBuffer.allocate(1)), is(equalTo(-1))); fileChannel.position(2L); assertThat(fileChannel.read(ByteBuffer.allocate(2)), is(equalTo(1))); } }
31.931217
98
0.686993
60dbe381fe1a1a057425f781cf80e6856b8568c4
1,805
package com.example.praktiskviewpager; import android.os.Bundle; import androidx.appcompat.widget.Toolbar; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; public class ScreenSlidePagerActivity extends AppCompatActivity { private static final int NUM_PAGES = 4; private ViewPager2 viewPager; private FragmentStateAdapter pagerAdapter; protected static EquipmentList equipmentList; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_screen_slide); Toolbar mainToolbar = findViewById(R.id.toolbar); setSupportActionBar(mainToolbar); viewPager = findViewById(R.id.pager); pagerAdapter = new ScreenSlidePagerAdapter(this); viewPager.setAdapter(pagerAdapter); equipmentList = new EquipmentList(); } @Override public void onBackPressed() { if(viewPager.getCurrentItem() == 0){ super.onBackPressed(); } else { viewPager.setCurrentItem(viewPager.getCurrentItem() - 1); } } private class ScreenSlidePagerAdapter extends FragmentStateAdapter{ public ScreenSlidePagerAdapter(FragmentActivity fa){ super(fa); } @NonNull @Override public Fragment createFragment(int position) { return new ScreenSlidePageFragment(position); } @Override public int getItemCount() { return NUM_PAGES; } } }
30.59322
71
0.705263
7367143079e7e9390b5ccb411ea3327ccb1ae179
2,396
/* * Copyright (c) 2019 by European Commission * * Licensed under the EUPL, Version 1.2 or - as soon they will be * approved by the European Commission - subsequent versions of the * EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * https://joinup.ec.europa.eu/page/eupl-text-11-12 * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * */ package eu.eidas.auth.commons.attribute.impl.reflect; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; import java.util.Arrays; final class WildcardTypeImpl implements WildcardType { private final Type[] upperBounds; private final Type[] lowerBounds; public WildcardTypeImpl(Type[] upperBounds, Type[] lowerBounds) { if (upperBounds.length == 0) { throw new IllegalArgumentException( "There must be at least one upper bound. For an unbound wildcard, the upper bound must be Object"); } this.upperBounds = upperBounds; this.lowerBounds = lowerBounds; } public Type[] getUpperBounds() { return upperBounds.clone(); } public Type[] getLowerBounds() { return lowerBounds.clone(); } @Override public boolean equals(Object obj) { if (!(obj instanceof WildcardType)) { return false; } WildcardType other = (WildcardType) obj; return Arrays.equals(lowerBounds, other.getLowerBounds()) && Arrays.equals(upperBounds, other.getUpperBounds()); } @Override public int hashCode() { return Arrays.hashCode(lowerBounds) ^ Arrays.hashCode(upperBounds); } @Override public String toString() { if (lowerBounds.length > 0) { return "? super " + GenericTypeReflector.getTypeName(lowerBounds[0]); } else if (upperBounds[0] == Object.class) { return "?"; } else { return "? extends " + GenericTypeReflector.getTypeName(upperBounds[0]); } } }
33.277778
121
0.644407
b9cd9e21412b901edd7d9c239a7db0ff359f1199
187
package com.silinx.source.effectivejava.chapter4.item23.hierarchy; // Class hierarchy replacement for a tagged class (Page 110-11) abstract class Figure { abstract double area(); }
26.714286
66
0.770053
adba6e7098618d9e2a839bf8751784eb9a025007
10,489
/******************************************************************************* * * SenSocial Middleware * * Copyright (c) ${2014}, University of Birmingham * Abhinav Mehrotra, axm514@cs.bham.ac.uk * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the University of Birmingham * nor the names of its contributors may be used to endorse or * promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *******************************************************************************/ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.ubhave.sensocial.server.data.SocialEvent; import com.ubhave.sensocial.server.exception.PPDException; import com.ubhave.sensocial.server.exception.XMLFileException; import com.ubhave.sensocial.server.filters.Condition; import com.ubhave.sensocial.server.filters.Filter; import com.ubhave.sensocial.server.filters.ModalValue; import com.ubhave.sensocial.server.filters.ModalityType; import com.ubhave.sensocial.server.filters.Operator; import com.ubhave.sensocial.server.manager.Device; import com.ubhave.sensocial.server.manager.SSListener; import com.ubhave.sensocial.server.manager.SSManager; import com.ubhave.sensocial.server.manager.Sensors; import com.ubhave.sensocial.server.manager.Stream; import com.ubhave.sensocial.server.manager.User; public class SenSocialServerFacebookClient { private static SSListener listener; private static SSManager sm; private static Stream s1,s2,s3,ns1,ns2,ns3; private static Map<String, SocialEvent> map=new HashMap<String, SocialEvent>(); private static int streamSize; public static void main(String[] args) { // TODO Auto-generated method stub sm=SSManager.getSSManager(); Set<User> users=new HashSet<User>(); users=sm.getAllUsers(); if(users==null){ System.out.println("NULL"); } else{ for(User u:users){ System.out.println("User:"+u.getId()); ArrayList<Device> devices=u.getDevices(); for(Device d:devices){ createStream(d); setListener(); startStream(); } } } } private static void createStream(Device d){ System.out.println("Device:"+d.getDeviceId()); try { streamSize=3; s1=d.getStream(Sensors.SENSOR_TYPE_ACCELEROMETER, "classified"); s2=d.getStream(Sensors.SENSOR_TYPE_MICROPHONE, "classified"); s3=d.getStream(Sensors.SENSOR_TYPE_LOCATION, "classified"); Filter filter=new Filter(); ArrayList<Condition> conditions=new ArrayList<Condition>(); conditions.add(new Condition(ModalityType.facebook_activity, Operator.equal_to, ModalValue.active)); filter.addConditions(conditions); ns1=s1.setFilter(filter); ns2=s2.setFilter(filter); ns3=s3.setFilter(filter); } catch (Exception e1) { e1.printStackTrace(); } } private static void setListener(){ listener = new SSListener() { public void onDataReceived(SocialEvent socialEvent) { String message, contextInfo, streamId; try{ message=socialEvent.getSocialData().getOSNFeed(); } catch(Exception e){ message="unknown"; } contextInfo=socialEvent.getFilteredSensorData().getClassifiedData(); streamId=socialEvent.getFilteredSensorData().getStreamId(); System.out.println("Social Event Received! \nStream-id: "+streamId +"\nSensor data: "+contextInfo+"\nOSN Message: "+message); map.put(streamId, socialEvent); if(map.size()==streamSize){ String acc="Disabled", mic="Disabled", location="Disabled"; try{ acc = map.get(ns1.getStreamId()).getFilteredSensorData().getClassifiedData(); } catch(Exception e){ System.out.println(e.toString()); } try{ mic=map.get(ns2.getStreamId()).getFilteredSensorData().getClassifiedData(); } catch(Exception e){ System.out.println(e.toString()); } try{ location=map.get(ns3.getStreamId()).getFilteredSensorData().getClassifiedData();; } catch(Exception e){ System.out.println(e.toString()); } //save in db String osn_message="unknown", time="unknown", userName="unknown"; try{ osn_message=socialEvent.getSocialData().getOSNFeed(); time=socialEvent.getSocialData().getTime(); userName=socialEvent.getSocialData().getUserName(); } catch(NullPointerException e1){ System.out.println("OSN data is unavailable!"); } String context= acc +" & "+mic; System.out.println("Location data: "+ location); double latitude= Double.parseDouble(location.substring(10, location.indexOf(','))); location=location.substring(13+location.indexOf(',')); double longitude=Double.parseDouble(location); insertMapData(userName, osn_message, context, time, latitude, longitude); insertD3Data(userName, osn_message, context, time, latitude, longitude); //clear all entries map.clear(); } } }; } private static void startStream(){ try { sm.registerListener(listener, ns1.getStreamId()); sm.registerListener(listener, ns2.getStreamId()); sm.registerListener(listener, ns3.getStreamId()); ns1.startStream(); ns2.startStream(); ns3.startStream(); } catch (PPDException e) { e.printStackTrace(); } catch (XMLFileException e) { e.printStackTrace(); } } private static void insertMapData(String userName, String message, String context, String time, double latitude, double longitude){ try { File file=new File("MapData.json"); Boolean flag=file.createNewFile(); if(flag){ //new file created, so add the root try { JSONObject obj= new JSONObject(); obj.put("name", "SenSocial"); obj.put("value", 100); JSONArray arr=new JSONArray(); obj.put("children", arr); FileWriter f= new FileWriter("MapData.json"); f.write("var data = "+obj.toString()); f.flush(); f.close(); } catch (JSONException e) { e.printStackTrace(); } } //read the file BufferedReader br=null; String str=""; try { String sCurrentLine; br = new BufferedReader(new FileReader("MapData.json")); while ((sCurrentLine = br.readLine()) != null) { str+=sCurrentLine; } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } //append child to json array try { JSONObject json = new JSONObject(str.substring("var data = ".length())); JSONArray children=json.getJSONArray("children"); JSONObject child=new JSONObject(); child.put("username", userName); child.put("message", message); child.put("value", 25); child.put("time", time); child.put("modality", context); child.put("latitude", latitude); child.put("longitude", longitude); children.put(child); FileWriter f= new FileWriter("MapData.json"); f.write("var data = "+ json.toString()); f.flush(); f.close(); } catch (JSONException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } private static void insertD3Data(String userName, String message, String context, String time, double latitude, double longitude){ try { File file=new File("D3Data.json"); Boolean flag=file.createNewFile(); if(flag){ //new file created, so add the root try { JSONObject obj= new JSONObject(); obj.put("name", "SenSocial"); obj.put("value", 100); JSONArray arr=new JSONArray(); obj.put("children", arr); FileWriter f= new FileWriter("D3Data.json"); f.write(obj.toString()); f.flush(); f.close(); } catch (JSONException e) { e.printStackTrace(); } } //read the file BufferedReader br=null; String str=""; try { String sCurrentLine; br = new BufferedReader(new FileReader("D3Data.json")); while ((sCurrentLine = br.readLine()) != null) { str+=sCurrentLine; } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } //append child to json array try { JSONObject json = new JSONObject(str); JSONArray children=json.getJSONArray("children"); JSONObject child=new JSONObject(); child.put("username", userName); child.put("message", message); child.put("value", 25); child.put("modality", context); child.put("time", time); child.put("latitude", latitude); child.put("longitude", longitude); children.put(child); FileWriter f= new FileWriter("D3Data.json"); f.write(json.toString()); f.flush(); f.close(); } catch (JSONException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } }
31.593373
132
0.670893
acc27dc82cdcb56b333891823ebc873b004c11ca
4,634
/* * Copyright 2017-present Open Networking Foundation * * Licensed 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. */ package org.opencord.olttopology; import org.onlab.packet.LLDPTLV; import org.onosproject.net.Port; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; /** * Information about an OLT's neighbor. An instance of this class stores * information about an OLT and it's neighbour. The information contains * which port of the OLT is connected to which port of the neighbor */ public class OltNeighborInfo { private String neighborName; private String neighborPort; private String oltName; private Port oltPort; // Serial number of the OLT private String oltSerialNo; // The management IP address of the neighbor private String mgmtAddr; // The time when this entry was last updated private Date lastUpdated; // List of other optional TLVs that would have been received from the // neighbor in the last LLDP message private List<LLDPTLV> otherOptionalTlvs; public OltNeighborInfo(String neighborName, String neighborPort, String oltName, Port oltPort, String oltSerialNo) { this.neighborName = neighborName; this.neighborPort = neighborPort; this.oltName = oltName; this.oltPort = oltPort; this.oltSerialNo = oltSerialNo; otherOptionalTlvs = new ArrayList<>(); updateTimeStamp(); } public String neighborName() { return neighborName; } public String neighborPort() { return neighborPort; } public String oltName() { return oltName; } public Port oltPort() { return oltPort; } public String oltSerialNo() { return oltSerialNo; } public Date getLastUpdated() { return lastUpdated; } public void updateTimeStamp() { lastUpdated = new Date(); } public String mgmtAddr() { return mgmtAddr; } public void setMgmtAddress(String neighborManagementAddress) { mgmtAddr = neighborManagementAddress; } public void addOtherOptionalLldpTlvs(LLDPTLV lldptlv) { otherOptionalTlvs.add(lldptlv); } public List<LLDPTLV> getOtherOptionalTlvs() { return otherOptionalTlvs; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OltNeighborInfo that = (OltNeighborInfo) o; return Objects.equals(neighborName, that.neighborName) && Objects.equals(neighborPort, that.neighborPort) && Objects.equals(oltName, that.oltName) && Objects.equals(oltPort, that.oltPort) && Objects.equals(oltSerialNo, that.oltSerialNo) && Objects.equals(mgmtAddr, that.mgmtAddr) && Objects.equals(lastUpdated, that.lastUpdated); } @Override public int hashCode() { return Objects.hash(neighborName, neighborPort, oltName, oltPort, oltSerialNo, mgmtAddr, lastUpdated); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { final StringBuilder buf = new StringBuilder(); buf.append('['); buf.append("neighborName:"); buf.append(this.neighborName); buf.append(",neighborPort:"); buf.append(this.neighborPort); buf.append(",oltName:"); buf.append(this.oltName); buf.append(",oltPort:"); buf.append((this.oltPort.annotations().value("portName").isEmpty()) ? "" : this.oltPort.annotations().value("portName")); buf.append(",oltSerialNo:"); buf.append(this.oltSerialNo); buf.append(",neighbor_mgmt_address:"); buf.append(this.mgmtAddr); buf.append(",lastUpdated:"); buf.append(this.lastUpdated); buf.append(']'); return buf.toString(); } }
28.9625
82
0.638973
038b1bcadadaa2c26a83d912ffd1998e6b5aa1d2
4,389
package org.apereo.cas.web.report; import org.apache.commons.io.input.TailerListener; import org.apereo.cas.audit.spi.config.CasCoreAuditConfiguration; import org.apereo.cas.config.CasCoreAuthenticationConfiguration; import org.apereo.cas.config.CasCoreAuthenticationHandlersConfiguration; import org.apereo.cas.config.CasCoreAuthenticationMetadataConfiguration; import org.apereo.cas.config.CasCoreAuthenticationPrincipalConfiguration; import org.apereo.cas.config.CasCoreAuthenticationServiceSelectionStrategyConfiguration; import org.apereo.cas.config.CasCoreAuthenticationSupportConfiguration; import org.apereo.cas.config.CasCoreConfiguration; import org.apereo.cas.config.CasCoreHttpConfiguration; import org.apereo.cas.config.CasCoreServicesAuthenticationConfiguration; import org.apereo.cas.config.CasCoreServicesConfiguration; import org.apereo.cas.config.CasCoreTicketCatalogConfiguration; import org.apereo.cas.config.CasCoreTicketsConfiguration; import org.apereo.cas.config.CasCoreUtilConfiguration; import org.apereo.cas.config.CasCoreViewsConfiguration; import org.apereo.cas.config.CasCoreWebConfiguration; import org.apereo.cas.config.CasDiscoveryProfileConfiguration; import org.apereo.cas.config.CasMetricsConfiguration; import org.apereo.cas.config.CasPersonDirectoryTestConfiguration; import org.apereo.cas.config.support.CasWebApplicationServiceFactoryConfiguration; import org.apereo.cas.support.events.config.CasCoreEventsConfiguration; import org.apereo.cas.trusted.config.MultifactorAuthnTrustConfiguration; import org.apereo.cas.validation.config.CasCoreValidationConfiguration; import org.apereo.cas.web.config.CasProtocolViewsConfiguration; import org.apereo.cas.web.config.CasValidationConfiguration; import org.apereo.cas.web.report.config.CasReportsConfiguration; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration; import org.springframework.test.context.junit4.SpringRunner; /** * This is {@link LoggingOutputTailingServiceTests}. * * @author Misagh Moayyed * @since 5.3.0 */ @RunWith(SpringRunner.class) @SpringBootTest(classes = { CasCoreAuthenticationPrincipalConfiguration.class, CasCoreAuthenticationConfiguration.class, CasCoreAuthenticationMetadataConfiguration.class, CasCoreAuthenticationHandlersConfiguration.class, CasPersonDirectoryTestConfiguration.class, CasCoreAuthenticationSupportConfiguration.class, CasCoreAuthenticationServiceSelectionStrategyConfiguration.class, CasWebApplicationServiceFactoryConfiguration.class, CasCoreValidationConfiguration.class, CasCoreTicketsConfiguration.class, CasCoreTicketCatalogConfiguration.class, CasCoreServicesAuthenticationConfiguration.class, CasValidationConfiguration.class, CasCoreViewsConfiguration.class, CasProtocolViewsConfiguration.class, CasCoreConfiguration.class, CasCoreServicesConfiguration.class, CasCoreWebConfiguration.class, CasCoreUtilConfiguration.class, CasCoreHttpConfiguration.class, ThymeleafAutoConfiguration.class, ServerPropertiesAutoConfiguration.class, EndpointAutoConfiguration.class, CasDiscoveryProfileConfiguration.class, CasCoreEventsConfiguration.class, MultifactorAuthnTrustConfiguration.class, CasCoreAuditConfiguration.class, CasMetricsConfiguration.class, CasReportsConfiguration.class, RefreshAutoConfiguration.class }) public class LoggingOutputTailingServiceTests { @Autowired @Qualifier("loggingOutputTailingService") private TailerListener loggingOutputTailingService; @Test public void verifyOperation() { try { loggingOutputTailingService.handle("This is a message"); loggingOutputTailingService.handle(new RuntimeException("This is an error")); } catch (final Exception e) { throw new AssertionError(e.getMessage(), e); } } }
46.2
89
0.83846
b825e1fc0a7f9ab1960125adcfb5e2e31b20d540
2,282
package com.github.sqs.spring.autoconfiguration; import com.github.sqs.spring.configuration.ListenerContainerConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.sqs.SqsClient; /** * @author 无羡 2020-04-29 */ @Configuration @Import(ListenerContainerConfiguration.class) @EnableConfigurationProperties(AmazonSqsProperties.class) @ConditionalOnProperty(prefix = "aws", value = {"access-key-id", "secret-access-key"}) public class SqsAutoConfiguration { @Bean @ConditionalOnMissingBean(AwsBasicCredentials.class) @ConditionalOnProperty(prefix = "aws", value = {"access-key-id", "secret-access-key"}) public AwsBasicCredentials basicAWSCredentials(AmazonSqsProperties amazonProperties) { return AwsBasicCredentials.create(amazonProperties.getAccessKeyId(), amazonProperties.getSecretAccessKey()); } @Bean @ConditionalOnMissingBean(StaticCredentialsProvider.class) public StaticCredentialsProvider awsStaticCredentialsProvider(AwsBasicCredentials awsBasicCredentials) { return StaticCredentialsProvider.create(awsBasicCredentials); } @Bean(name = "sqsClient") @ConditionalOnMissingBean(SqsClient.class) public SqsClient sqsClient(StaticCredentialsProvider awsStaticCredentialsProvider, AmazonSqsProperties amazonProperties) { return SqsClient.builder().credentialsProvider(awsStaticCredentialsProvider) .region(getRegion(amazonProperties.getRegion())) .build(); } /** * the region must be available * you find it on amazon sqs console * * @return {@link Region} */ public Region getRegion(String region) { return Region.of(region); } }
41.490909
126
0.788344
20bd09b741e42bd0448f54e875e6e15f27a7a6b1
2,421
package com.dalongtech.testapplication.component; /** * Author:xianglei * Date: 2019-12-19 17:05 * Description:动作队列,比如3个弹框依次显示,可以每个弹框加入队列,不同时显示 */ public class ActionQueue { private PendingPostQueue mActions; private boolean mExecuting; public ActionQueue() { mActions = new PendingPostQueue(); } public void enqueue(ActionExe action) { synchronized (this) { mActions.enqueue(new Action(action)); if (!mExecuting) { mExecuting = true; executingNext(); } } } public void executingNext() { Action action = mActions.poll(); if (action == null) { synchronized (this) { // Check again, this time in synchronized action = mActions.poll(); if (action == null) { mExecuting = false; return; } } } action.action(); } final class PendingPostQueue { private Action head; private Action tail; synchronized void enqueue(Action pendingPost) { if (pendingPost == null) { throw new NullPointerException("null cannot be enqueued"); } if (tail != null) { tail.next = pendingPost; tail = pendingPost; } else if (head == null) { head = tail = pendingPost; } else { throw new IllegalStateException("Head present, but no tail"); } notifyAll(); } synchronized Action poll() { Action pendingPost = head; if (head != null) { head = head.next; if (head == null) { tail = null; } } return pendingPost; } public synchronized Action poll(int maxMillisToWait) throws InterruptedException { if (head == null) { wait(maxMillisToWait); } return poll(); } } class Action { Action next; ActionExe mActionExe; Action(ActionExe actionExe) { mActionExe = actionExe; } void action() { mActionExe.action(); } } public interface ActionExe { void action(); } }
24.704082
90
0.487402
7f20d626ee0979d0713ae02862370544d411f22b
11,420
package com.tlabs.android.jeeves.data; import android.app.SearchManager; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.MatrixCursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public final class SearchProvider extends ContentProvider { private static final String AUTHORITY = "com.tlabs.android.evanova.search"; public static final Uri URI = Uri.parse("content://" + AUTHORITY); public static final Uri ALL = URI.buildUpon().appendPath("all").build(); public static final Uri SKILLS = URI.buildUpon().appendPath("skills").build(); public static final Uri LOCATIONS = URI.buildUpon().appendPath("location").build(); public static final Uri ITEMS = URI.buildUpon().appendPath("items").build(); public static final Uri NAMES = URI.buildUpon().appendPath("names").build(); public static final Uri ASSETS = URI.buildUpon().appendPath("assets").build(); public static final Uri SHIPS = URI.buildUpon().appendPath("ships").build(); public static final Uri MODULES = URI.buildUpon().appendPath("modules").build(); private static final UriMatcher uriMatcher; private static final int CONTENT_ALL = 0; private static final int CONTENT_ITEMS = 1; private static final int CONTENT_LOCATIONS = 2; private static final int CONTENT_SKILLS = 3; private static final int CONTENT_NAMES = 4; private static final int CONTENT_ASSETS = 5; private static final int CONTENT_SHIPS = 6; private static final int CONTENT_MODULES = 7; private static final int SINK = 98; static { uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); uriMatcher.addURI(AUTHORITY, "all", CONTENT_ALL); uriMatcher.addURI(AUTHORITY, "all/*", CONTENT_ALL); uriMatcher.addURI(AUTHORITY, "skills/search_suggest_query", CONTENT_SKILLS); uriMatcher.addURI(AUTHORITY, "skills/search_suggest_query/*", CONTENT_SKILLS); uriMatcher.addURI(AUTHORITY, "items", CONTENT_ITEMS); uriMatcher.addURI(AUTHORITY, "items/*", CONTENT_ITEMS); uriMatcher.addURI(AUTHORITY, "ships", CONTENT_SHIPS); uriMatcher.addURI(AUTHORITY, "ships/*", CONTENT_SHIPS); uriMatcher.addURI(AUTHORITY, "modules", CONTENT_MODULES); uriMatcher.addURI(AUTHORITY, "modules/*", CONTENT_MODULES); uriMatcher.addURI(AUTHORITY, "names", CONTENT_NAMES); uriMatcher.addURI(AUTHORITY, "names/*", CONTENT_NAMES); uriMatcher.addURI(AUTHORITY, "assets/search_suggest_query", CONTENT_ASSETS); uriMatcher.addURI(AUTHORITY, "assets/search_suggest_query/*", CONTENT_ASSETS); uriMatcher.addURI(AUTHORITY, "location/search_suggest_query", CONTENT_LOCATIONS); uriMatcher.addURI(AUTHORITY, "location/search_suggest_query/*", CONTENT_LOCATIONS); } private EveDatabaseOpenHelper eveDatabase; @Override public boolean onCreate() { this.eveDatabase = EveDatabaseOpenHelper.from(getContext().getApplicationContext()); return true; } @Override public String getType(Uri uri) { switch (uriMatcher.match(uri)) { //We do not export our data default: throw new IllegalArgumentException("Unsupported URI: " + uri); } } @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor cursor = null; switch (uriMatcher.match(uri)) { case CONTENT_ITEMS: { String term = selectionArgs[0]; term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchItem(term); } break; } case CONTENT_SHIPS: { String term = selectionArgs[0]; term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchItem(term, 6); } break; } case CONTENT_MODULES: { String term = selectionArgs[0]; term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchItem(term, 7); } break; } case CONTENT_SKILLS: { String term = uri.getLastPathSegment(); term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchSkill(term); } break; } case CONTENT_ASSETS: { String term = selectionArgs[0]; term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchItem(term); } break; } case CONTENT_LOCATIONS: { String term = uri.getLastPathSegment(); term = null == term ? "" : term.trim(); if (term.length() >= 3) { cursor = searchLocation(term.trim(), uri.getQueryParameter("status")); } break; } case SINK: default: break; } return null == cursor ? new MatrixCursor(new String[] { "_id", SearchManager.SUGGEST_COLUMN_TEXT_1 }) : cursor; } @Override public Uri insert(Uri uri, ContentValues values) { throw new UnsupportedOperationException(uri.toString()); } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { throw new UnsupportedOperationException(uri.toString()); } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { throw new UnsupportedOperationException(uri.toString()); } public static List<String> searchLocations(final ContentResolver r, final String search, final float maxSecurityStatus) { return searchLocations( r, LOCATIONS .buildUpon() .appendPath("search_suggest_query") .appendPath(search) .appendQueryParameter("status", Float.toString(maxSecurityStatus)) .build()); } public static List<String> searchLocations(final ContentResolver r, final String search) { return searchLocations( r, LOCATIONS .buildUpon() .appendPath("search_suggest_query") .appendPath(search) .build()); } private static List<String> searchLocations(final ContentResolver r, final Uri uri) { final List<String> returned = new ArrayList<>(); final Cursor c = r.query(uri, null, null, null, null); if (c.getCount() == 0) { c.close(); return returned; } c.moveToFirst(); while (!c.isAfterLast()) { returned.add(c.getString(0)); c.moveToNext(); } c.close(); return returned; } //Totally hackish way of listing jump freighters because I don't have time to get them from SDE //it's every item with attribute 861 private static final String[] JUMPSHIPS = new String[]{ "Panther", "Redeemer", "Sin", "Widow", "Rorqual", "Rorqual ORE Development Edition", "Archon", "Chimera", "Nidhoggur", "Thanatos", "Moros", "Moros Interbus Edition", "Naglfar", "Naglfar Justice Edition", "Phoenix", "Phoenix Wiyrkomi Edition", "Revelation", "Revelation Sarum Edition", "Anshar", "Ark", "Nomad", "Rhea", "Jump Bridge", "QA Jump Bridge", "Aeon", "Hel", "Nyx", "Revenant", "Wyvern", "Avatar", "Erebus", "Leviathan", "Ragnarok" }; public static List<String> searchJumpShips(final ContentResolver r, final String search) { final List<String> returned = new ArrayList<>(Arrays.asList(JUMPSHIPS)); CollectionUtils.filter(returned, input -> { final String s = (String)input; return s.toLowerCase().startsWith(search.toLowerCase()); }); Collections.sort(returned); return returned; } private static final String TABLE_SKILLS = "apiSkillTree"; private static final String TABLE_LOCATIONS = "jeevesLocations"; private static final String TABLE_NAMES = "jeevesNames"; private static final String TABLE_ITEMS = "jeevesItems"; private static final String querySearchItem = "select n.name_id as _id, n.name_id as " + SearchManager.SUGGEST_COLUMN_INTENT_DATA + ", n.name as " + SearchManager.SUGGEST_COLUMN_TEXT_1 + " from " + TABLE_NAMES + " n " + " where n.name_type = 0 and n.name like '%{$1}%' and n.published = 1" + " order by " + SearchManager.SUGGEST_COLUMN_TEXT_1 + " ASC"; private Cursor searchItem(final String term) { SQLiteDatabase db = eveDatabase.getReadableDatabase(); return db.rawQuery(StringUtils.replace(querySearchItem, "{$1}", term), null); } private static final String querySearchItemWithCategory = "select n.name_id as _id, n.name_id as " + SearchManager.SUGGEST_COLUMN_INTENT_DATA + ", n.name as " + SearchManager.SUGGEST_COLUMN_TEXT_1 + " from " + TABLE_NAMES + " n, " + TABLE_ITEMS + " i " + " where n.name_type = 0 and n.name like '%{$1}%' and i.typeID = n.name_id and i.categoryID = {$2} and n.published = 1 " + " order by " + SearchManager.SUGGEST_COLUMN_TEXT_1 + " ASC"; private Cursor searchItem(final String term, int categoryId) { SQLiteDatabase db = eveDatabase.getReadableDatabase(); return db.rawQuery( StringUtils.replace(StringUtils.replace(querySearchItemWithCategory, "{$1}", term), "{$2}", Long.toString(categoryId)), null); } private Cursor searchSkill(String searchTerm) { SQLiteDatabase db = eveDatabase.getReadableDatabase(); return db.query(TABLE_SKILLS, new String[]{"_id", "_id as " + SearchManager.SUGGEST_COLUMN_INTENT_DATA, "name", "name as " + SearchManager.SUGGEST_COLUMN_TEXT_1}, "name like '%" + searchTerm + "%'", null, null, null, "name ASC"); } private Cursor searchLocation(String searchTerm, final String statusParam) { //type id 5 is solar systems. String query = "typeID = 5 AND name like '%" + searchTerm + "%'"; if (StringUtils.isNotBlank(statusParam)) { query = query + " AND security <= " + statusParam; } SQLiteDatabase db = eveDatabase.getReadableDatabase(); return db.query(TABLE_LOCATIONS, new String[]{"name"}, query, null, null, null, "name ASC"); } }
37.320261
152
0.603152
19b29fe275a742c22a32ab90837b87608adcde16
514
package com.baeldung.domain; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baeldung.model.Employee; public class EmployeeService { private static final Logger logger = LoggerFactory.getLogger(EmployeeService.class); private EmployeeRepository repo; public EmployeeService(EmployeeRepository repo) { this.repo = repo; } public Employee saveEmployee(Employee emp) { logger.info("Inside EmployeeService.saveEmployee()"); return repo.saveEmployee(emp); } }
23.363636
86
0.754864
f6064846ba646a6122f66e48cb159f5afa7dc1b7
301
package com.tencent.cos.xml.utils; import java.util.concurrent.TimeUnit; public class TimeUtils { private static final String TAG = "TimeUtil"; public static long getTookTime(long start){ return TimeUnit.MILLISECONDS.convert(System.nanoTime() - start,TimeUnit.NANOSECONDS); } }
25.083333
93
0.737542
b663e187c78b9804de4a62d6c2d9e0d74017b796
2,939
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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. */ package org.elasticsearch.action.admin.indices.shrink; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.AbstractSerializingTestCase; public class ResizeResponseTests extends AbstractSerializingTestCase<ResizeResponse> { public void testToXContent() { ResizeResponse response = new ResizeResponse(true, false, "index_name"); String output = Strings.toString(response); assertEquals("{\"acknowledged\":true,\"shards_acknowledged\":false,\"index\":\"index_name\"}", output); } @Override protected ResizeResponse doParseInstance(XContentParser parser) { return ResizeResponse.fromXContent(parser); } @Override protected ResizeResponse createTestInstance() { boolean acknowledged = randomBoolean(); boolean shardsAcknowledged = acknowledged && randomBoolean(); String index = randomAlphaOfLength(5); return new ResizeResponse(acknowledged, shardsAcknowledged, index); } @Override protected Writeable.Reader<ResizeResponse> instanceReader() { return ResizeResponse::new; } @Override protected ResizeResponse mutateInstance(ResizeResponse response) { if (randomBoolean()) { if (randomBoolean()) { boolean acknowledged = response.isAcknowledged() == false; boolean shardsAcknowledged = acknowledged && response.isShardsAcknowledged(); return new ResizeResponse(acknowledged, shardsAcknowledged, response.index()); } else { boolean shardsAcknowledged = response.isShardsAcknowledged() == false; boolean acknowledged = shardsAcknowledged || response.isAcknowledged(); return new ResizeResponse(acknowledged, shardsAcknowledged, response.index()); } } else { return new ResizeResponse(response.isAcknowledged(), response.isShardsAcknowledged(), response.index() + randomAlphaOfLengthBetween(2, 5)); } } }
41.394366
111
0.708064
23a446ea38cb1ecb18a9bf8404c3301095d894d0
500
package net.mabako.steamgifts.data; import net.mabako.steamgifts.core.R; public class Winner extends BasicUser { public static final int VIEW_LAYOUT = R.layout.winner_item; private static final long serialVersionUID = 5793503158843335275L; private String status; public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Override public int getLayout() { return VIEW_LAYOUT; } }
20.833333
70
0.684
3f4bcb1b45d4cb6c8f05059ae63afcaf286f289c
167,398
/* *AVISO LEGAL © Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.contabilidad.presentation.swing.jinternalframes; import com.bydan.erp.seguridad.presentation.swing.jinternalframes.*; import com.bydan.erp.contabilidad.presentation.web.jsf.sessionbean.*;//; import com.bydan.erp.contabilidad.presentation.swing.jinternalframes.*; import com.bydan.erp.contabilidad.presentation.swing.jinternalframes.auxiliar.*; import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*; import com.bydan.erp.seguridad.business.entity.*; //import com.bydan.erp.contabilidad.presentation.report.source.*; import com.bydan.framework.erp.business.entity.Reporte; import com.bydan.erp.seguridad.business.entity.Modulo; import com.bydan.erp.seguridad.business.entity.Opcion; import com.bydan.erp.seguridad.business.entity.Usuario; import com.bydan.erp.seguridad.business.entity.ResumenUsuario; import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg; import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario; import com.bydan.erp.seguridad.util.SistemaParameterReturnGeneral; import com.bydan.erp.contabilidad.business.entity.*; import com.bydan.erp.contabilidad.util.TipoParametroFormularioIvaConstantesFunciones; import com.bydan.erp.contabilidad.business.logic.*; import com.bydan.framework.erp.business.entity.DatoGeneral; import com.bydan.framework.erp.business.entity.OrderBy; import com.bydan.framework.erp.business.entity.Mensajes; import com.bydan.framework.erp.business.entity.Classe; import com.bydan.framework.erp.business.logic.*; import com.bydan.framework.erp.presentation.desktop.swing.DateConverter; import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate; import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing; import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase; import com.bydan.framework.erp.presentation.desktop.swing.*; import com.bydan.framework.erp.util.*; import java.util.Date; import java.util.List; import java.util.ArrayList; import java.io.File; import java.util.HashMap; import java.util.Map; import java.io.PrintWriter; import java.sql.SQLException; import java.sql.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRRuntimeException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.data.JRBeanArrayDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import javax.swing.*; import java.awt.*; import javax.swing.border.EtchedBorder; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.event.*; import javax.swing.event.*; import javax.swing.GroupLayout.Alignment; import javax.swing.table.TableColumn; import com.toedter.calendar.JDateChooser; @SuppressWarnings("unused") public class TipoParametroFormularioIvaJInternalFrame extends TipoParametroFormularioIvaBeanSwingJInternalFrameAdditional { private static final long serialVersionUID = 1L; //protected Usuario usuarioActual=null; public JToolBar jTtoolBarTipoParametroFormularioIva; protected JMenuBar jmenuBarTipoParametroFormularioIva; protected JMenu jmenuTipoParametroFormularioIva; protected JMenu jmenuDatosTipoParametroFormularioIva; protected JMenu jmenuArchivoTipoParametroFormularioIva; protected JMenu jmenuAccionesTipoParametroFormularioIva; protected JPanel jContentPane = null; protected JPanel jPanelBusquedasParametrosTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); protected GridBagLayout gridaBagLayoutTipoParametroFormularioIva; protected GridBagConstraints gridBagConstraintsTipoParametroFormularioIva; //protected JInternalFrameBase jInternalFrameParent; public TipoParametroFormularioIvaDetalleFormJInternalFrame jInternalFrameDetalleFormTipoParametroFormularioIva; protected ReporteDinamicoJInternalFrame jInternalFrameReporteDinamicoTipoParametroFormularioIva; protected ImportacionJInternalFrame jInternalFrameImportacionTipoParametroFormularioIva; //VENTANAS PARA ACTUALIZAR Y BUSCAR FK public TipoParametroFormularioIvaSessionBean tipoparametroformularioivaSessionBean; //protected JDesktopPane jDesktopPane; public List<TipoParametroFormularioIva> tipoparametroformularioivas; public List<TipoParametroFormularioIva> tipoparametroformularioivasEliminados; public List<TipoParametroFormularioIva> tipoparametroformularioivasAux; protected OrderByJInternalFrame jInternalFrameOrderByTipoParametroFormularioIva; protected JButton jButtonAbrirOrderByTipoParametroFormularioIva; //protected JPanel jPanelOrderByTipoParametroFormularioIva; //public JScrollPane jScrollPanelOrderByTipoParametroFormularioIva; //protected JButton jButtonCerrarOrderByTipoParametroFormularioIva; public ArrayList<OrderBy> arrOrderBy= new ArrayList<OrderBy>(); public TipoParametroFormularioIvaLogic tipoparametroformularioivaLogic; public JScrollPane jScrollPanelDatosTipoParametroFormularioIva; public JScrollPane jScrollPanelDatosEdicionTipoParametroFormularioIva; public JScrollPane jScrollPanelDatosGeneralTipoParametroFormularioIva; //public JScrollPane jScrollPanelDatosTipoParametroFormularioIvaOrderBy; //public JScrollPane jScrollPanelReporteDinamicoTipoParametroFormularioIva; //public JScrollPane jScrollPanelImportacionTipoParametroFormularioIva; protected JPanel jPanelAccionesTipoParametroFormularioIva; protected JPanel jPanelPaginacionTipoParametroFormularioIva; protected JPanel jPanelParametrosReportesTipoParametroFormularioIva; protected JPanel jPanelParametrosReportesAccionesTipoParametroFormularioIva; ; protected JPanel jPanelParametrosAuxiliar1TipoParametroFormularioIva; protected JPanel jPanelParametrosAuxiliar2TipoParametroFormularioIva; protected JPanel jPanelParametrosAuxiliar3TipoParametroFormularioIva; protected JPanel jPanelParametrosAuxiliar4TipoParametroFormularioIva; //protected JPanel jPanelParametrosAuxiliar5TipoParametroFormularioIva; //protected JPanel jPanelReporteDinamicoTipoParametroFormularioIva; //protected JPanel jPanelImportacionTipoParametroFormularioIva; public JTable jTableDatosTipoParametroFormularioIva; //public JTable jTableDatosTipoParametroFormularioIvaOrderBy; //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN protected JButton jButtonNuevoTipoParametroFormularioIva; protected JButton jButtonDuplicarTipoParametroFormularioIva; protected JButton jButtonCopiarTipoParametroFormularioIva; protected JButton jButtonVerFormTipoParametroFormularioIva; protected JButton jButtonNuevoRelacionesTipoParametroFormularioIva; protected JButton jButtonModificarTipoParametroFormularioIva; protected JButton jButtonGuardarCambiosTablaTipoParametroFormularioIva; protected JButton jButtonCerrarTipoParametroFormularioIva; protected JButton jButtonRecargarInformacionTipoParametroFormularioIva; protected JButton jButtonProcesarInformacionTipoParametroFormularioIva; protected JButton jButtonAnterioresTipoParametroFormularioIva; protected JButton jButtonSiguientesTipoParametroFormularioIva; protected JButton jButtonNuevoGuardarCambiosTipoParametroFormularioIva; //protected JButton jButtonGenerarReporteDinamicoTipoParametroFormularioIva; //protected JButton jButtonCerrarReporteDinamicoTipoParametroFormularioIva; //protected JButton jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva; //protected JButton jButtonAbrirImportacionTipoParametroFormularioIva; //protected JButton jButtonGenerarImportacionTipoParametroFormularioIva; //protected JButton jButtonCerrarImportacionTipoParametroFormularioIva; //protected JFileChooser jFileChooserImportacionTipoParametroFormularioIva; //protected File fileImportacionTipoParametroFormularioIva; //TOOLBAR protected JButton jButtonNuevoToolBarTipoParametroFormularioIva; protected JButton jButtonDuplicarToolBarTipoParametroFormularioIva; protected JButton jButtonNuevoRelacionesToolBarTipoParametroFormularioIva; public JButton jButtonGuardarCambiosToolBarTipoParametroFormularioIva; protected JButton jButtonCopiarToolBarTipoParametroFormularioIva; protected JButton jButtonVerFormToolBarTipoParametroFormularioIva; public JButton jButtonGuardarCambiosTablaToolBarTipoParametroFormularioIva; protected JButton jButtonMostrarOcultarTablaToolBarTipoParametroFormularioIva; protected JButton jButtonCerrarToolBarTipoParametroFormularioIva; protected JButton jButtonRecargarInformacionToolBarTipoParametroFormularioIva; protected JButton jButtonProcesarInformacionToolBarTipoParametroFormularioIva; protected JButton jButtonAnterioresToolBarTipoParametroFormularioIva; protected JButton jButtonSiguientesToolBarTipoParametroFormularioIva; protected JButton jButtonNuevoGuardarCambiosToolBarTipoParametroFormularioIva; protected JButton jButtonAbrirOrderByToolBarTipoParametroFormularioIva; //TOOLBAR //MENU protected JMenuItem jMenuItemNuevoTipoParametroFormularioIva; protected JMenuItem jMenuItemDuplicarTipoParametroFormularioIva; protected JMenuItem jMenuItemNuevoRelacionesTipoParametroFormularioIva; protected JMenuItem jMenuItemGuardarCambiosTipoParametroFormularioIva; protected JMenuItem jMenuItemCopiarTipoParametroFormularioIva; protected JMenuItem jMenuItemVerFormTipoParametroFormularioIva; protected JMenuItem jMenuItemGuardarCambiosTablaTipoParametroFormularioIva; protected JMenuItem jMenuItemCerrarTipoParametroFormularioIva; protected JMenuItem jMenuItemDetalleCerrarTipoParametroFormularioIva; protected JMenuItem jMenuItemDetalleAbrirOrderByTipoParametroFormularioIva; protected JMenuItem jMenuItemDetalleMostarOcultarTipoParametroFormularioIva; protected JMenuItem jMenuItemRecargarInformacionTipoParametroFormularioIva; protected JMenuItem jMenuItemProcesarInformacionTipoParametroFormularioIva; protected JMenuItem jMenuItemAnterioresTipoParametroFormularioIva; protected JMenuItem jMenuItemSiguientesTipoParametroFormularioIva; protected JMenuItem jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva; protected JMenuItem jMenuItemAbrirOrderByTipoParametroFormularioIva; protected JMenuItem jMenuItemMostrarOcultarTipoParametroFormularioIva; //MENU protected JLabel jLabelAccionesTipoParametroFormularioIva; protected JCheckBox jCheckBoxSeleccionarTodosTipoParametroFormularioIva; protected JCheckBox jCheckBoxSeleccionadosTipoParametroFormularioIva; protected JCheckBox jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva; protected JCheckBox jCheckBoxConGraficoReporteTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposArchivosReportesTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposReportesTipoParametroFormularioIva; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposReportesDinamicoTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposGraficosReportesTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposPaginacionTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposRelacionesTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposAccionesTipoParametroFormularioIva; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposSeleccionarTipoParametroFormularioIva; protected JTextField jTextFieldValorCampoGeneralTipoParametroFormularioIva; //REPORTE DINAMICO //@SuppressWarnings("rawtypes") //public JLabel jLabelColumnasSelectReporteTipoParametroFormularioIva; //public JList<Reporte> jListColumnasSelectReporteTipoParametroFormularioIva; //public JScrollPane jScrollColumnasSelectReporteTipoParametroFormularioIva; //public JLabel jLabelRelacionesSelectReporteTipoParametroFormularioIva; //public JList<Reporte> jListRelacionesSelectReporteTipoParametroFormularioIva; //public JScrollPane jScrollRelacionesSelectReporteTipoParametroFormularioIva; //public JLabel jLabelConGraficoDinamicoTipoParametroFormularioIva; //protected JCheckBox jCheckBoxConGraficoDinamicoTipoParametroFormularioIva; //public JLabel jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva; //public JLabel jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva; //public JLabel jLabelArchivoImportacionTipoParametroFormularioIva; //public JLabel jLabelPathArchivoImportacionTipoParametroFormularioIva; //protected JTextField jTextFieldPathArchivoImportacionTipoParametroFormularioIva; //public JLabel jLabelColumnaCategoriaGraficoTipoParametroFormularioIva; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaGraficoTipoParametroFormularioIva; //public JLabel jLabelColumnaCategoriaValorTipoParametroFormularioIva; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaValorTipoParametroFormularioIva; //public JLabel jLabelColumnasValoresGraficoTipoParametroFormularioIva; //public JList<Reporte> jListColumnasValoresGraficoTipoParametroFormularioIva; //public JScrollPane jScrollColumnasValoresGraficoTipoParametroFormularioIva; //public JLabel jLabelTiposGraficosReportesDinamicoTipoParametroFormularioIva; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposGraficosReportesDinamicoTipoParametroFormularioIva; protected Boolean conMaximoRelaciones=true; protected Boolean conFuncionalidadRelaciones=true; public Boolean conCargarMinimo=false; public Boolean cargarRelaciones=false; public Boolean conMostrarAccionesCampo=false; public Boolean permiteRecargarForm=false;//PARA NUEVO PREPARAR Y MANEJO DE EVENTOS, EVITAR QUE SE EJECUTE AL CARGAR VENTANA O LOAD public Boolean conCargarFormDetalle=false; //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN public static int openFrameCount = 0; public static final int xOffset = 10, yOffset = 35; //LOS DATOS DE NUEVO Y EDICION ACTUAL APARECEN EN OTRA VENTANA(true) O NO(false) public static Boolean CON_DATOS_FRAME=true; public static Boolean ISBINDING_MANUAL=true; public static Boolean ISLOAD_FKLOTE=true; public static Boolean ISBINDING_MANUAL_TABLA=true; public static Boolean CON_CARGAR_MEMORIA_INICIAL=true; //Al final no se utilizan, se inicializan desde JInternalFrameBase, desde ParametroGeneralUsuario public static String STIPO_TAMANIO_GENERAL="NORMAL"; public static String STIPO_TAMANIO_GENERAL_TABLA="NORMAL"; public static Boolean CONTIPO_TAMANIO_MANUAL=false; public static Boolean CON_LLAMADA_SIMPLE=true; public static Boolean CON_LLAMADA_SIMPLE_TOTAL=true; public static Boolean ESTA_CARGADO_PORPARTE=false; public int iWidthScroll=0;//(screenSize.width-screenSize.width/2)+(250*0); public int iHeightScroll=0;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //public int iWidthFormulario=450;//(screenSize.width-screenSize.width/2)+(250*0); //public int iHeightFormulario=418;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //Esto va en DetalleForm //public int iHeightFormularioMaximo=0; //public int iWidthFormularioMaximo=0; public int iWidthTableDefinicion=0; public double dStart = 0; public double dEnd = 0; public double dDif = 0; /* double start=(double)System.currentTimeMillis(); double end=0; double dif=0; end=(double)System.currentTimeMillis(); dif=end - start; start=(double)System.currentTimeMillis(); System.out.println("Tiempo(ms) Carga TEST 1_2 DetalleMovimientoInventario: " + dif); */ public SistemaParameterReturnGeneral sistemaReturnGeneral; public List<Opcion> opcionsRelacionadas=new ArrayList<Opcion>(); //ES AUXILIAR PARA WINDOWS FORMS public TipoParametroFormularioIvaJInternalFrame() throws Exception { super(PaginaTipo.PRINCIPAL); //super("TipoParametroFormularioIva No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { //Boolean cargarRelaciones=false; initialize(null,false,false,false/*cargarRelaciones*/,null,null,null,null,null,null,PaginaTipo.PRINCIPAL); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public TipoParametroFormularioIvaJInternalFrame(Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("TipoParametroFormularioIva No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,false,false,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public TipoParametroFormularioIvaJInternalFrame(Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("TipoParametroFormularioIva No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public TipoParametroFormularioIvaJInternalFrame(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { super(paginaTipo);//,jdesktopPane this.jDesktopPane=jdesktopPane; this.dStart=(double)System.currentTimeMillis(); //super("TipoParametroFormularioIva No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { long start_time=0; long end_time=0; if(Constantes2.ISDEVELOPING2) { start_time = System.currentTimeMillis(); } initialize(jdesktopPane,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); if(Constantes2.ISDEVELOPING2) { end_time = System.currentTimeMillis(); String sTipo="Clase Padre Ventana"; Funciones2.getMensajeTiempoEjecucion(start_time, end_time, sTipo,false); } } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public JInternalFrameBase getJInternalFrameParent() { return jInternalFrameParent; } public void setJInternalFrameParent(JInternalFrameBase internalFrameParent) { jInternalFrameParent = internalFrameParent; } public void setjButtonRecargarInformacion(JButton jButtonRecargarInformacionTipoParametroFormularioIva) { this.jButtonRecargarInformacionTipoParametroFormularioIva = jButtonRecargarInformacionTipoParametroFormularioIva; } public JButton getjButtonProcesarInformacionTipoParametroFormularioIva() { return this.jButtonProcesarInformacionTipoParametroFormularioIva; } public void setjButtonProcesarInformacion(JButton jButtonProcesarInformacionTipoParametroFormularioIva) { this.jButtonProcesarInformacionTipoParametroFormularioIva = jButtonProcesarInformacionTipoParametroFormularioIva; } public JButton getjButtonRecargarInformacionTipoParametroFormularioIva() { return this.jButtonRecargarInformacionTipoParametroFormularioIva; } public List<TipoParametroFormularioIva> gettipoparametroformularioivas() { return this.tipoparametroformularioivas; } public void settipoparametroformularioivas(List<TipoParametroFormularioIva> tipoparametroformularioivas) { this.tipoparametroformularioivas = tipoparametroformularioivas; } public List<TipoParametroFormularioIva> gettipoparametroformularioivasAux() { return this.tipoparametroformularioivasAux; } public void settipoparametroformularioivasAux(List<TipoParametroFormularioIva> tipoparametroformularioivasAux) { this.tipoparametroformularioivasAux = tipoparametroformularioivasAux; } public List<TipoParametroFormularioIva> gettipoparametroformularioivasEliminados() { return this.tipoparametroformularioivasEliminados; } public void setTipoParametroFormularioIvasEliminados(List<TipoParametroFormularioIva> tipoparametroformularioivasEliminados) { this.tipoparametroformularioivasEliminados = tipoparametroformularioivasEliminados; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposSeleccionarTipoParametroFormularioIva() { return jComboBoxTiposSeleccionarTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposSeleccionarTipoParametroFormularioIva( JComboBox jComboBoxTiposSeleccionarTipoParametroFormularioIva) { this.jComboBoxTiposSeleccionarTipoParametroFormularioIva = jComboBoxTiposSeleccionarTipoParametroFormularioIva; } public void setBorderResaltarTiposSeleccionarTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposSeleccionarTipoParametroFormularioIva .setBorder(borderResaltar); } public JTextField getjTextFieldValorCampoGeneralTipoParametroFormularioIva() { return jTextFieldValorCampoGeneralTipoParametroFormularioIva; } public void setjTextFieldValorCampoGeneralTipoParametroFormularioIva( JTextField jTextFieldValorCampoGeneralTipoParametroFormularioIva) { this.jTextFieldValorCampoGeneralTipoParametroFormularioIva = jTextFieldValorCampoGeneralTipoParametroFormularioIva; } public void setBorderResaltarValorCampoGeneralTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jTextFieldValorCampoGeneralTipoParametroFormularioIva .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionarTodosTipoParametroFormularioIva() { return this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva; } public void setjCheckBoxSeleccionarTodosTipoParametroFormularioIva( JCheckBox jCheckBoxSeleccionarTodosTipoParametroFormularioIva) { this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva = jCheckBoxSeleccionarTodosTipoParametroFormularioIva; } public void setBorderResaltarSeleccionarTodosTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionadosTipoParametroFormularioIva() { return this.jCheckBoxSeleccionadosTipoParametroFormularioIva; } public void setjCheckBoxSeleccionadosTipoParametroFormularioIva( JCheckBox jCheckBoxSeleccionadosTipoParametroFormularioIva) { this.jCheckBoxSeleccionadosTipoParametroFormularioIva = jCheckBoxSeleccionadosTipoParametroFormularioIva; } public void setBorderResaltarSeleccionadosTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jCheckBoxSeleccionadosTipoParametroFormularioIva .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposArchivosReportesTipoParametroFormularioIva() { return this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposArchivosReportesTipoParametroFormularioIva( JComboBox jComboBoxTiposArchivosReportesTipoParametroFormularioIva) { this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva = jComboBoxTiposArchivosReportesTipoParametroFormularioIva; } public void setBorderResaltarTiposArchivosReportesTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposReportesTipoParametroFormularioIva() { return this.jComboBoxTiposReportesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposReportesTipoParametroFormularioIva( JComboBox jComboBoxTiposReportesTipoParametroFormularioIva) { this.jComboBoxTiposReportesTipoParametroFormularioIva = jComboBoxTiposReportesTipoParametroFormularioIva; } //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposReportesDinamicoTipoParametroFormularioIva() { // return jComboBoxTiposReportesDinamicoTipoParametroFormularioIva; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposReportesDinamicoTipoParametroFormularioIva( // JComboBox jComboBoxTiposReportesDinamicoTipoParametroFormularioIva) { // this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva = jComboBoxTiposReportesDinamicoTipoParametroFormularioIva; //} //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva() { // return jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva( // JComboBox jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva) { // this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva = jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva; //} public void setBorderResaltarTiposReportesTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposReportesTipoParametroFormularioIva .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposGraficosReportesTipoParametroFormularioIva() { return this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposGraficosReportesTipoParametroFormularioIva( JComboBox jComboBoxTiposGraficosReportesTipoParametroFormularioIva) { this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva = jComboBoxTiposGraficosReportesTipoParametroFormularioIva; } public void setBorderResaltarTiposGraficosReportesTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposPaginacionTipoParametroFormularioIva() { return this.jComboBoxTiposPaginacionTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposPaginacionTipoParametroFormularioIva( JComboBox jComboBoxTiposPaginacionTipoParametroFormularioIva) { this.jComboBoxTiposPaginacionTipoParametroFormularioIva = jComboBoxTiposPaginacionTipoParametroFormularioIva; } public void setBorderResaltarTiposPaginacionTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposPaginacionTipoParametroFormularioIva .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposRelacionesTipoParametroFormularioIva() { return this.jComboBoxTiposRelacionesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposAccionesTipoParametroFormularioIva() { return this.jComboBoxTiposAccionesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposRelacionesTipoParametroFormularioIva( JComboBox jComboBoxTiposRelacionesTipoParametroFormularioIva) { this.jComboBoxTiposRelacionesTipoParametroFormularioIva = jComboBoxTiposRelacionesTipoParametroFormularioIva; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposAccionesTipoParametroFormularioIva( JComboBox jComboBoxTiposAccionesTipoParametroFormularioIva) { this.jComboBoxTiposAccionesTipoParametroFormularioIva = jComboBoxTiposAccionesTipoParametroFormularioIva; } public void setBorderResaltarTiposRelacionesTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposRelacionesTipoParametroFormularioIva .setBorder(borderResaltar); } public void setBorderResaltarTiposAccionesTipoParametroFormularioIva() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); this.jComboBoxTiposAccionesTipoParametroFormularioIva .setBorder(borderResaltar); } //public JCheckBox getjCheckBoxConGraficoDinamicoTipoParametroFormularioIva() { // return jCheckBoxConGraficoDinamicoTipoParametroFormularioIva; //} //public void setjCheckBoxConGraficoDinamicoTipoParametroFormularioIva( // JCheckBox jCheckBoxConGraficoDinamicoTipoParametroFormularioIva) { // this.jCheckBoxConGraficoDinamicoTipoParametroFormularioIva = jCheckBoxConGraficoDinamicoTipoParametroFormularioIva; //} //public void setBorderResaltarConGraficoDinamicoTipoParametroFormularioIva() { // Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); // this.jTtoolBarTipoParametroFormularioIva.setBorder(borderResaltar); // this.jCheckBoxConGraficoDinamicoTipoParametroFormularioIva .setBorder(borderResaltar); //} /* public JDesktopPane getJDesktopPane() { return jDesktopPane; } public void setJDesktopPane(JDesktopPane desktopPane) { jDesktopPane = desktopPane; } */ private void initialize(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { this.tipoparametroformularioivaSessionBean=new TipoParametroFormularioIvaSessionBean(); this.tipoparametroformularioivaSessionBean.setConGuardarRelaciones(conGuardarRelaciones); this.tipoparametroformularioivaSessionBean.setEsGuardarRelacionado(esGuardarRelacionado); this.conCargarMinimo=this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado(); this.cargarRelaciones=cargarRelaciones; if(!this.conCargarMinimo) { } //this.sTipoTamanioGeneral=TipoParametroFormularioIvaJInternalFrame.STIPO_TAMANIO_GENERAL; //this.sTipoTamanioGeneralTabla=TipoParametroFormularioIvaJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA; this.sTipoTamanioGeneral=FuncionesSwing.getTipoTamanioGeneral(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.sTipoTamanioGeneralTabla=FuncionesSwing.getTipoTamanioGeneralTabla(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioManual=FuncionesSwing.getConTipoTamanioManual(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioTodo=FuncionesSwing.getConTipoTamanioTodo(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); TipoParametroFormularioIvaJInternalFrame.STIPO_TAMANIO_GENERAL=this.sTipoTamanioGeneral; TipoParametroFormularioIvaJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA=this.sTipoTamanioGeneralTabla; TipoParametroFormularioIvaJInternalFrame.CONTIPO_TAMANIO_MANUAL=this.conTipoTamanioManual; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidth=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO); int iHeight=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //this.setTitle(Funciones.GetTituloSistema(this.parametroGeneralSg,this.moduloActual,this.opcionActual,this.usuarioActual,"Tipo Parametro Formulario Iva MANTENIMIENTO")); if(iWidth > 650) { iWidth=650; } if(iHeight > 910) { iHeight=910; } this.setSize(iWidth,iHeight); this.setFrameIcon(new ImageIcon(FuncionesSwing.getImagenBackground(Constantes2.S_ICON_IMAGE))); this.setContentPane(this.getJContentPane(iWidth,iHeight,jdesktopPane,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo)); if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { this.setResizable(true); this.setClosable(true); this.setMaximizable(true); this.iconable=true; setLocation(xOffset*openFrameCount, yOffset*openFrameCount); if(Constantes.CON_VARIAS_VENTANAS) { openFrameCount++; if(openFrameCount==Constantes.INUM_MAX_VENTANAS) { openFrameCount=0; } } } TipoParametroFormularioIvaJInternalFrame.ESTA_CARGADO_PORPARTE=true; //super("TipoParametroFormularioIva No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable //SwingUtilities.updateComponentTreeUI(this); } public void inicializarToolBar() { this.jTtoolBarTipoParametroFormularioIva= new JToolBar("MENU PRINCIPAL"); //TOOLBAR //PRINCIPAL this.jButtonNuevoToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "nuevo","nuevo","Nuevo"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO"),"Nuevo",false); this.jButtonNuevoGuardarCambiosToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoGuardarCambiosToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "nuevoguardarcambios","nuevoguardarcambios","Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"),"Nuevo",false); this.jButtonGuardarCambiosTablaToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonGuardarCambiosTablaToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "guardarcambiostabla","guardarcambiostabla","Guardar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"),"Guardar",false); this.jButtonDuplicarToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonDuplicarToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "duplicar","duplicar","Duplicar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR"),"Duplicar",false); this.jButtonCopiarToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCopiarToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "copiar","copiar","Copiar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("COPIAR"),"Copiar",false); this.jButtonVerFormToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonVerFormToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "ver_form","ver_form","Ver"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("VER_FORM"),"Ver",false); this.jButtonRecargarInformacionToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "recargar","recargar","Recargar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR"),"Recargar",false); this.jButtonAnterioresToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "anteriores","anteriores","Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES"),"<<",false); this.jButtonSiguientesToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "siguientes","siguientes","Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES"),">>",false); this.jButtonAbrirOrderByToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonAbrirOrderByToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "orden","orden","Orden" + FuncionesSwing.getKeyMensaje("ORDEN"),"Orden",false); this.jButtonNuevoRelacionesToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoRelacionesToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "nuevo_relaciones","nuevo_relaciones","NUEVO RELACIONES" + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES"),"NUEVO RELACIONES",false); this.jButtonMostrarOcultarTablaToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonMostrarOcultarTablaToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "mostrar_ocultar","mostrar_ocultar","Mostrar Ocultar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"),"Mostrar Ocultar",false); this.jButtonCerrarToolBarTipoParametroFormularioIva=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCerrarToolBarTipoParametroFormularioIva,this.jTtoolBarTipoParametroFormularioIva, "cerrar","cerrar","Salir"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR"),"Salir",false); //this.jButtonNuevoRelacionesToolBarTipoParametroFormularioIva=new JButtonMe(); //protected JButton jButtonNuevoRelacionesToolBarTipoParametroFormularioIva; this.jButtonProcesarInformacionToolBarTipoParametroFormularioIva=new JButtonMe(); //protected JButton jButtonProcesarInformacionToolBarTipoParametroFormularioIva; //protected JButton jButtonModificarToolBarTipoParametroFormularioIva; //PRINCIPAL //DETALLE //DETALLE_FIN } public void cargarMenus() { this.jmenuBarTipoParametroFormularioIva=new JMenuBarMe(); //PRINCIPAL this.jmenuTipoParametroFormularioIva=new JMenuMe("General"); this.jmenuArchivoTipoParametroFormularioIva=new JMenuMe("Archivo"); this.jmenuAccionesTipoParametroFormularioIva=new JMenuMe("Acciones"); this.jmenuDatosTipoParametroFormularioIva=new JMenuMe("Datos"); //PRINCIPAL_FIN //DETALLE //DETALLE_FIN this.jMenuItemNuevoTipoParametroFormularioIva= new JMenuItem("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO")); this.jMenuItemNuevoTipoParametroFormularioIva.setActionCommand("Nuevo"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoTipoParametroFormularioIva,"nuevo_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDuplicarTipoParametroFormularioIva= new JMenuItem("Duplicar" + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jMenuItemDuplicarTipoParametroFormularioIva.setActionCommand("Duplicar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDuplicarTipoParametroFormularioIva,"duplicar_button","Duplicar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDuplicarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoRelacionesTipoParametroFormularioIva= new JMenuItem("Nuevo Rel" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoRelacionesTipoParametroFormularioIva.setActionCommand("Nuevo Rel"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoRelacionesTipoParametroFormularioIva,"nuevorelaciones_button","Nuevo Rel"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoRelacionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosTipoParametroFormularioIva= new JMenuItem("Guardar" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosTipoParametroFormularioIva.setActionCommand("Guardar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosTipoParametroFormularioIva,"guardarcambios_button","Guardar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCopiarTipoParametroFormularioIva= new JMenuItem("Copiar" + FuncionesSwing.getKeyMensaje("COPIAR")); this.jMenuItemCopiarTipoParametroFormularioIva.setActionCommand("Copiar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCopiarTipoParametroFormularioIva,"copiar_button","Copiar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCopiarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemVerFormTipoParametroFormularioIva= new JMenuItem("Ver" + FuncionesSwing.getKeyMensaje("VER_FORM")); this.jMenuItemVerFormTipoParametroFormularioIva.setActionCommand("Ver"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemVerFormTipoParametroFormularioIva,"ver_form_button","Ver"); FuncionesSwing.setBoldMenuItem(this.jMenuItemVerFormTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosTablaTipoParametroFormularioIva= new JMenuItem("Guardar Tabla" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosTablaTipoParametroFormularioIva.setActionCommand("Guardar Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosTablaTipoParametroFormularioIva,"guardarcambiostabla_button","Guardar Tabla"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosTablaTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCerrarTipoParametroFormularioIva= new JMenuItem("Salir" + FuncionesSwing.getKeyMensaje("CERRAR")); this.jMenuItemCerrarTipoParametroFormularioIva.setActionCommand("Cerrar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCerrarTipoParametroFormularioIva,"cerrar_button","Salir"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCerrarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemRecargarInformacionTipoParametroFormularioIva= new JMenuItem("Recargar" + FuncionesSwing.getKeyMensaje("RECARGAR")); this.jMenuItemRecargarInformacionTipoParametroFormularioIva.setActionCommand("Recargar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemRecargarInformacionTipoParametroFormularioIva,"recargar_button","Recargar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemRecargarInformacionTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemProcesarInformacionTipoParametroFormularioIva= new JMenuItem("Procesar Informacion"); this.jMenuItemProcesarInformacionTipoParametroFormularioIva.setActionCommand("Procesar Informacion"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemProcesarInformacionTipoParametroFormularioIva,"procesar_button","Procesar Informacion"); this.jMenuItemAnterioresTipoParametroFormularioIva= new JMenuItem("Anteriores" + FuncionesSwing.getKeyMensaje("ANTERIORES")); this.jMenuItemAnterioresTipoParametroFormularioIva.setActionCommand("Anteriores"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAnterioresTipoParametroFormularioIva,"anteriores_button","Anteriores"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAnterioresTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemSiguientesTipoParametroFormularioIva= new JMenuItem("Siguientes" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); this.jMenuItemSiguientesTipoParametroFormularioIva.setActionCommand("Siguientes"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemSiguientesTipoParametroFormularioIva,"siguientes_button","Siguientes"); FuncionesSwing.setBoldMenuItem(this.jMenuItemSiguientesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemAbrirOrderByTipoParametroFormularioIva= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemAbrirOrderByTipoParametroFormularioIva.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAbrirOrderByTipoParametroFormularioIva,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAbrirOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemMostrarOcultarTipoParametroFormularioIva= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemMostrarOcultarTipoParametroFormularioIva.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemMostrarOcultarTipoParametroFormularioIva,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemMostrarOcultarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleAbrirOrderByTipoParametroFormularioIva= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemDetalleAbrirOrderByTipoParametroFormularioIva.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleAbrirOrderByTipoParametroFormularioIva,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleAbrirOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleMostarOcultarTipoParametroFormularioIva= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemDetalleMostarOcultarTipoParametroFormularioIva.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleMostarOcultarTipoParametroFormularioIva,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleMostarOcultarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva= new JMenuItem("Nuevo Tabla" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva.setActionCommand("Nuevo Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva,"nuevoguardarcambios_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); //PRINCIPAL if(!this.conCargarMinimo) { this.jmenuArchivoTipoParametroFormularioIva.add(this.jMenuItemCerrarTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemNuevoTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemNuevoGuardarCambiosTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemNuevoRelacionesTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemGuardarCambiosTablaTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemDuplicarTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemCopiarTipoParametroFormularioIva); this.jmenuAccionesTipoParametroFormularioIva.add(this.jMenuItemVerFormTipoParametroFormularioIva); this.jmenuDatosTipoParametroFormularioIva.add(this.jMenuItemRecargarInformacionTipoParametroFormularioIva); this.jmenuDatosTipoParametroFormularioIva.add(this.jMenuItemAnterioresTipoParametroFormularioIva); this.jmenuDatosTipoParametroFormularioIva.add(this.jMenuItemSiguientesTipoParametroFormularioIva); this.jmenuDatosTipoParametroFormularioIva.add(this.jMenuItemAbrirOrderByTipoParametroFormularioIva); this.jmenuDatosTipoParametroFormularioIva.add(this.jMenuItemMostrarOcultarTipoParametroFormularioIva); } //PRINCIPAL_FIN //DETALLE //this.jmenuDetalleAccionesTipoParametroFormularioIva.add(this.jMenuItemGuardarCambiosTipoParametroFormularioIva); //DETALLE_FIN //RELACIONES //RELACIONES //PRINCIPAL if(!this.conCargarMinimo) { FuncionesSwing.setBoldMenu(this.jmenuArchivoTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuAccionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuDatosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jmenuBarTipoParametroFormularioIva.add(this.jmenuArchivoTipoParametroFormularioIva); this.jmenuBarTipoParametroFormularioIva.add(this.jmenuAccionesTipoParametroFormularioIva); this.jmenuBarTipoParametroFormularioIva.add(this.jmenuDatosTipoParametroFormularioIva); } //PRINCIPAL_FIN //DETALLE //DETALLE_FIN //AGREGA MENU A PANTALLA if(!this.conCargarMinimo) { this.setJMenuBar(this.jmenuBarTipoParametroFormularioIva); } //AGREGA MENU DETALLE A PANTALLA } public void inicializarElementosBusquedasTipoParametroFormularioIva() { //BYDAN_BUSQUEDAS //INDICES BUSQUEDA //INDICES BUSQUEDA_FIN } //JPanel //@SuppressWarnings({"unchecked" })//"rawtypes" public JScrollPane getJContentPane(int iWidth,int iHeight,JDesktopPane jDesktopPane,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { //PARA TABLA PARAMETROS String sKeyStrokeName=""; KeyStroke keyStrokeControl=null; this.jContentPane = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.usuarioActual=usuarioActual; this.resumenUsuarioActual=resumenUsuarioActual; this.opcionActual=opcionActual; this.moduloActual=moduloActual; this.parametroGeneralSg=parametroGeneralSg; this.parametroGeneralUsuario=parametroGeneralUsuario; this.jDesktopPane=jDesktopPane; this.conFuncionalidadRelaciones=parametroGeneralUsuario.getcon_guardar_relaciones(); int iGridyPrincipal=0; this.inicializarToolBar(); //CARGAR MENUS if(this.conCargarFormDetalle) { //true) { //this.jInternalFrameDetalleTipoParametroFormularioIva = new TipoParametroFormularioIvaDetalleJInternalFrame(paginaTipo);//JInternalFrameBase("Tipo Parametro Formulario Iva DATOS"); this.jInternalFrameDetalleFormTipoParametroFormularioIva = new TipoParametroFormularioIvaDetalleFormJInternalFrame(jDesktopPane,this.tipoparametroformularioivaSessionBean.getConGuardarRelaciones(),this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado(),cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); } else { this.jInternalFrameDetalleFormTipoParametroFormularioIva = null;//new TipoParametroFormularioIvaDetalleFormJInternalFrame("MINIMO"); } this.cargarMenus(); this.gridaBagLayoutTipoParametroFormularioIva= new GridBagLayout(); this.jTableDatosTipoParametroFormularioIva = new JTableMe(); String sToolTipTipoParametroFormularioIva=""; sToolTipTipoParametroFormularioIva=TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO; if(Constantes.ISDEVELOPING) { sToolTipTipoParametroFormularioIva+="(Contabilidad.TipoParametroFormularioIva)"; } if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { sToolTipTipoParametroFormularioIva+="_"+this.opcionActual.getId(); } this.jTableDatosTipoParametroFormularioIva.setToolTipText(sToolTipTipoParametroFormularioIva); //SE DEFINE EN DETALLE //FuncionesSwing.setBoldLabelTable(this.jTableDatosTipoParametroFormularioIva); this.jTableDatosTipoParametroFormularioIva.setAutoCreateRowSorter(true); this.jTableDatosTipoParametroFormularioIva.setRowHeight(Constantes.ISWING_ALTO_FILA_TABLA + Constantes.ISWING_ALTO_FILA_TABLA_EXTRA_FECHA); //MULTIPLE SELECTION this.jTableDatosTipoParametroFormularioIva.setRowSelectionAllowed(true); this.jTableDatosTipoParametroFormularioIva.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); FuncionesSwing.setBoldTable(jTableDatosTipoParametroFormularioIva,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoTipoParametroFormularioIva = new JButtonMe(); this.jButtonDuplicarTipoParametroFormularioIva = new JButtonMe(); this.jButtonCopiarTipoParametroFormularioIva = new JButtonMe(); this.jButtonVerFormTipoParametroFormularioIva = new JButtonMe(); this.jButtonNuevoRelacionesTipoParametroFormularioIva = new JButtonMe(); this.jButtonGuardarCambiosTablaTipoParametroFormularioIva = new JButtonMe(); this.jButtonCerrarTipoParametroFormularioIva = new JButtonMe(); this.jScrollPanelDatosTipoParametroFormularioIva = new JScrollPane(); this.jScrollPanelDatosGeneralTipoParametroFormularioIva = new JScrollPane(); this.jPanelAccionesTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); //if(!this.conCargarMinimo) { ; //} this.sPath=" <---> Acceso: Tipo Parametro Formulario Iva "; if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { this.jScrollPanelDatosTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Tipo Parametro Formulario Iva s" + this.sPath)); } else { this.jScrollPanelDatosTipoParametroFormularioIva.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } this.jScrollPanelDatosGeneralTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Edicion Datos")); this.jPanelAccionesTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Acciones")); this.jPanelAccionesTipoParametroFormularioIva.setToolTipText("Acciones"); this.jPanelAccionesTipoParametroFormularioIva.setName("Acciones"); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosGeneralTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,false,this); //if(!this.conCargarMinimo) { ; //} //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN if(!this.conCargarMinimo) { //REPORTE DINAMICO //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameReporteDinamicoTipoParametroFormularioIva=new ReporteDinamicoJInternalFrame(TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarReporteDinamicoTipoParametroFormularioIva(); //IMPORTACION //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameImportacionTipoParametroFormularioIva=new ImportacionJInternalFrame(TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarImportacionTipoParametroFormularioIva(); } String sMapKey = ""; InputMap inputMap =null; this.jButtonAbrirOrderByTipoParametroFormularioIva = new JButtonMe(); this.jButtonAbrirOrderByTipoParametroFormularioIva.setText("Orden"); this.jButtonAbrirOrderByTipoParametroFormularioIva.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByTipoParametroFormularioIva,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderBySistema"; inputMap = this.jButtonAbrirOrderByTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderBySistema")); if(!this.conCargarMinimo) { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByTipoParametroFormularioIva=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByTipoParametroFormularioIva,false,this); //this.cargarOrderByTipoParametroFormularioIva(false); } else { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByTipoParametroFormularioIva=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByTipoParametroFormularioIva,true,this); //this.cargarOrderByTipoParametroFormularioIva(true); } //VALORES PARA DISENO /* this.jTableDatosTipoParametroFormularioIva.setMinimumSize(new Dimension(400,50));//430 this.jTableDatosTipoParametroFormularioIva.setMaximumSize(new Dimension(400,50));//430 this.jTableDatosTipoParametroFormularioIva.setPreferredSize(new Dimension(400,50));//430 this.jScrollPanelDatosTipoParametroFormularioIva.setMinimumSize(new Dimension(400,50)); this.jScrollPanelDatosTipoParametroFormularioIva.setMaximumSize(new Dimension(400,50)); this.jScrollPanelDatosTipoParametroFormularioIva.setPreferredSize(new Dimension(400,50)); */ this.jButtonNuevoTipoParametroFormularioIva.setText("Nuevo"); this.jButtonDuplicarTipoParametroFormularioIva.setText("Duplicar"); this.jButtonCopiarTipoParametroFormularioIva.setText("Copiar"); this.jButtonVerFormTipoParametroFormularioIva.setText("Ver"); this.jButtonNuevoRelacionesTipoParametroFormularioIva.setText("Nuevo Rel"); this.jButtonGuardarCambiosTablaTipoParametroFormularioIva.setText("Guardar"); this.jButtonCerrarTipoParametroFormularioIva.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoTipoParametroFormularioIva,"nuevo_button","Nuevo",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonDuplicarTipoParametroFormularioIva,"duplicar_button","Duplicar",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCopiarTipoParametroFormularioIva,"copiar_button","Copiar",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonVerFormTipoParametroFormularioIva,"ver_form","Ver",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoRelacionesTipoParametroFormularioIva,"nuevorelaciones_button","Nuevo Rel",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonGuardarCambiosTablaTipoParametroFormularioIva,"guardarcambiostabla_button","Guardar",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarTipoParametroFormularioIva,"cerrar_button","Salir",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonDuplicarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCopiarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonVerFormTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonNuevoRelacionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonGuardarCambiosTablaTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCerrarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoTipoParametroFormularioIva.setToolTipText("Nuevo"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO")); this.jButtonDuplicarTipoParametroFormularioIva.setToolTipText("Duplicar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jButtonCopiarTipoParametroFormularioIva.setToolTipText("Copiar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("COPIAR")); this.jButtonVerFormTipoParametroFormularioIva.setToolTipText("Ver"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("VER_FORM")); this.jButtonNuevoRelacionesTipoParametroFormularioIva.setToolTipText("Nuevo Rel"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES")); this.jButtonGuardarCambiosTablaTipoParametroFormularioIva.setToolTipText("Guardar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jButtonCerrarTipoParametroFormularioIva.setToolTipText("Salir"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR")); //HOT KEYS /* N->Nuevo N->Alt + Nuevo Relaciones (ANTES R) A->Actualizar E->Eliminar S->Cerrar C->->Mayus + Cancelar (ANTES Q->Quit) G->Guardar Cambios D->Duplicar C->Alt + Cop?ar O->Orden N->Nuevo Tabla R->Recargar Informacion Inicial (ANTES I) Alt + Pag.Down->Siguientes Alt + Pag.Up->Anteriores NO UTILIZADOS M->Modificar */ //String sMapKey = ""; //InputMap inputMap =null; //NUEVO sMapKey = "NuevoTipoParametroFormularioIva"; inputMap = this.jButtonNuevoTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO") , FuncionesSwing.getMaskKey("NUEVO")), sMapKey); this.jButtonNuevoTipoParametroFormularioIva.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"NuevoTipoParametroFormularioIva")); //DUPLICAR sMapKey = "DuplicarTipoParametroFormularioIva"; inputMap = this.jButtonDuplicarTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("DUPLICAR") , FuncionesSwing.getMaskKey("DUPLICAR")), sMapKey); this.jButtonDuplicarTipoParametroFormularioIva.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"DuplicarTipoParametroFormularioIva")); //COPIAR sMapKey = "CopiarTipoParametroFormularioIva"; inputMap = this.jButtonCopiarTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("COPIAR") , FuncionesSwing.getMaskKey("COPIAR")), sMapKey); this.jButtonCopiarTipoParametroFormularioIva.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"CopiarTipoParametroFormularioIva")); //VEr FORM sMapKey = "VerFormTipoParametroFormularioIva"; inputMap = this.jButtonVerFormTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("VER_FORM") , FuncionesSwing.getMaskKey("VER_FORM")), sMapKey); this.jButtonVerFormTipoParametroFormularioIva.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"VerFormTipoParametroFormularioIva")); //NUEVO RELACIONES sMapKey = "NuevoRelacionesTipoParametroFormularioIva"; inputMap = this.jButtonNuevoRelacionesTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_RELACIONES") , FuncionesSwing.getMaskKey("NUEVO_RELACIONES")), sMapKey); this.jButtonNuevoRelacionesTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoRelacionesTipoParametroFormularioIva")); //MODIFICAR /* sMapKey = "ModificarTipoParametroFormularioIva"; inputMap = this.jButtonModificarTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("MODIFICAR") , FuncionesSwing.getMaskKey("MODIFICAR")), sMapKey); this.jButtonModificarTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"ModificarTipoParametroFormularioIva")); */ //CERRAR sMapKey = "CerrarTipoParametroFormularioIva"; inputMap = this.jButtonCerrarTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("CERRAR") , FuncionesSwing.getMaskKey("CERRAR")), sMapKey); this.jButtonCerrarTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"CerrarTipoParametroFormularioIva")); //GUARDAR CAMBIOS sMapKey = "GuardarCambiosTablaTipoParametroFormularioIva"; inputMap = this.jButtonGuardarCambiosTablaTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("GUARDAR_CAMBIOS") , FuncionesSwing.getMaskKey("GUARDAR_CAMBIOS")), sMapKey); this.jButtonGuardarCambiosTablaTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"GuardarCambiosTablaTipoParametroFormularioIva")); //ABRIR ORDER BY if(!this.conCargarMinimo) { } //HOT KEYS this.jPanelParametrosReportesTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesAccionesTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelPaginacionTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar1TipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar2TipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar3TipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar4TipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); //this.jPanelParametrosAuxiliar5TipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Reportes-Acciones")); this.jPanelParametrosReportesTipoParametroFormularioIva.setName("jPanelParametrosReportesTipoParametroFormularioIva"); this.jPanelParametrosReportesAccionesTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Acciones")); //this.jPanelParametrosReportesAccionesTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); this.jPanelParametrosReportesAccionesTipoParametroFormularioIva.setName("jPanelParametrosReportesAccionesTipoParametroFormularioIva"); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesAccionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,false,this); this.jButtonRecargarInformacionTipoParametroFormularioIva = new JButtonMe(); this.jButtonRecargarInformacionTipoParametroFormularioIva.setText("Recargar"); this.jButtonRecargarInformacionTipoParametroFormularioIva.setToolTipText("Recargar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR")); FuncionesSwing.addImagenButtonGeneral(this.jButtonRecargarInformacionTipoParametroFormularioIva,"recargar_button","Recargar"); this.jButtonProcesarInformacionTipoParametroFormularioIva = new JButtonMe(); this.jButtonProcesarInformacionTipoParametroFormularioIva.setText("Procesar"); this.jButtonProcesarInformacionTipoParametroFormularioIva.setToolTipText("Procesar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); this.jButtonProcesarInformacionTipoParametroFormularioIva.setVisible(false); this.jButtonProcesarInformacionTipoParametroFormularioIva.setMinimumSize(new Dimension(185,25)); this.jButtonProcesarInformacionTipoParametroFormularioIva.setMaximumSize(new Dimension(185,25)); this.jButtonProcesarInformacionTipoParametroFormularioIva.setPreferredSize(new Dimension(185,25)); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setText("TIPO"); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setToolTipText("Tipos De Archivo"); this.jComboBoxTiposReportesTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setText("TIPO"); this.jComboBoxTiposReportesTipoParametroFormularioIva.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setText("TIPO"); this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposPaginacionTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposPaginacionTipoParametroFormularioIva.setText("Paginacion"); this.jComboBoxTiposPaginacionTipoParametroFormularioIva.setToolTipText("Tipos De Paginacion"); this.jComboBoxTiposRelacionesTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposRelacionesTipoParametroFormularioIva.setText("Accion"); this.jComboBoxTiposRelacionesTipoParametroFormularioIva.setToolTipText("Tipos de Relaciones"); this.jComboBoxTiposAccionesTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposAccionesTipoParametroFormularioIva.setText("Accion"); this.jComboBoxTiposAccionesTipoParametroFormularioIva.setToolTipText("Tipos de Acciones"); this.jComboBoxTiposSeleccionarTipoParametroFormularioIva = new JComboBoxMe(); //this.jComboBoxTiposSeleccionarTipoParametroFormularioIva.setText("Accion"); this.jComboBoxTiposSeleccionarTipoParametroFormularioIva.setToolTipText("Tipos de Seleccion"); this.jTextFieldValorCampoGeneralTipoParametroFormularioIva=new JTextFieldMe(); this.jTextFieldValorCampoGeneralTipoParametroFormularioIva.setMinimumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralTipoParametroFormularioIva.setMaximumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralTipoParametroFormularioIva.setPreferredSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesTipoParametroFormularioIva = new JLabelMe(); this.jLabelAccionesTipoParametroFormularioIva.setText("Acciones"); this.jLabelAccionesTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva = new JCheckBoxMe(); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva.setText("Sel. Todos"); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva.setToolTipText("Sel. Todos"); this.jCheckBoxSeleccionadosTipoParametroFormularioIva = new JCheckBoxMe(); //this.jCheckBoxSeleccionadosTipoParametroFormularioIva.setText("Seleccionados"); this.jCheckBoxSeleccionadosTipoParametroFormularioIva.setToolTipText("SELECCIONAR SELECCIONADOS"); this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva = new JCheckBoxMe(); //this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.setText("Con Maximo Alto Tabla"); this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.setToolTipText("Con Maximo Alto Tabla"); this.jCheckBoxConGraficoReporteTipoParametroFormularioIva = new JCheckBoxMe(); this.jCheckBoxConGraficoReporteTipoParametroFormularioIva.setText("Graf."); this.jCheckBoxConGraficoReporteTipoParametroFormularioIva.setToolTipText("Con Grafico"); this.jButtonAnterioresTipoParametroFormularioIva = new JButtonMe(); //this.jButtonAnterioresTipoParametroFormularioIva.setText("<<"); this.jButtonAnterioresTipoParametroFormularioIva.setToolTipText("Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAnterioresTipoParametroFormularioIva,"anteriores_button","<<"); FuncionesSwing.setBoldButton(this.jButtonAnterioresTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonSiguientesTipoParametroFormularioIva = new JButtonMe(); //this.jButtonSiguientesTipoParametroFormularioIva.setText(">>"); this.jButtonSiguientesTipoParametroFormularioIva.setToolTipText("Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonSiguientesTipoParametroFormularioIva,"siguientes_button",">>"); FuncionesSwing.setBoldButton(this.jButtonSiguientesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva = new JButtonMe(); this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva.setText("Nue"); this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva.setToolTipText("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva,"nuevoguardarcambios_button","Nue",this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); //HOT KEYS2 /* T->Nuevo Tabla */ //NUEVO GUARDAR CAMBIOS O NUEVO TABLA sMapKey = "NuevoGuardarCambiosTipoParametroFormularioIva"; inputMap = this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_TABLA") , FuncionesSwing.getMaskKey("NUEVO_TABLA")), sMapKey); this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoGuardarCambiosTipoParametroFormularioIva")); //RECARGAR sMapKey = "RecargarInformacionTipoParametroFormularioIva"; inputMap = this.jButtonRecargarInformacionTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("RECARGAR") , FuncionesSwing.getMaskKey("RECARGAR")), sMapKey); this.jButtonRecargarInformacionTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"RecargarInformacionTipoParametroFormularioIva")); //SIGUIENTES sMapKey = "SiguientesTipoParametroFormularioIva"; inputMap = this.jButtonSiguientesTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("SIGUIENTES") , FuncionesSwing.getMaskKey("SIGUIENTES")), sMapKey); this.jButtonSiguientesTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"SiguientesTipoParametroFormularioIva")); //ANTERIORES sMapKey = "AnterioresTipoParametroFormularioIva"; inputMap = this.jButtonAnterioresTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ANTERIORES") , FuncionesSwing.getMaskKey("ANTERIORES")), sMapKey); this.jButtonAnterioresTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AnterioresTipoParametroFormularioIva")); //HOT KEYS2 //DETALLE //TOOLBAR //INDICES BUSQUEDA //INDICES BUSQUEDA_FIN //INDICES BUSQUEDA if(!this.conCargarMinimo) { this.inicializarElementosBusquedasTipoParametroFormularioIva(); } //INDICES BUSQUEDA_FIN //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN //ELEMENTOS TABLAS PARAMETOS_FIN //ESTA EN BEAN /* this.jTabbedPaneRelacionesTipoParametroFormularioIva.setMinimumSize(new Dimension(this.getWidth(),TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesTipoParametroFormularioIva.setMaximumSize(new Dimension(this.getWidth(),TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesTipoParametroFormularioIva.setPreferredSize(new Dimension(this.getWidth(),TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(TipoParametroFormularioIvaBean.ALTO_TABPANE_RELACIONES,0))); */ int iPosXAccionPaginacion=0; GridBagLayout gridaBagLayoutPaginacionTipoParametroFormularioIva = new GridBagLayout(); this.jPanelPaginacionTipoParametroFormularioIva.setLayout(gridaBagLayoutPaginacionTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.EAST; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 0; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonAnterioresTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 0; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonNuevoGuardarCambiosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 0; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonSiguientesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); iPosXAccionPaginacion=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonNuevoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); if(this.conFuncionalidadRelaciones) { this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonNuevoRelacionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado() && !this.conCargarMinimo) { this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonGuardarCambiosTablaTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonDuplicarTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonCopiarTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonVerFormTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 1; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionTipoParametroFormularioIva.add(this.jButtonCerrarTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.jButtonRecargarInformacionTipoParametroFormularioIva.setMinimumSize(new Dimension(95,25)); this.jButtonRecargarInformacionTipoParametroFormularioIva.setMaximumSize(new Dimension(95,25)); this.jButtonRecargarInformacionTipoParametroFormularioIva.setPreferredSize(new Dimension(95,25)); FuncionesSwing.setBoldButton(this.jButtonRecargarInformacionTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setMinimumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setMaximumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva.setPreferredSize(new Dimension(105,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposReportesTipoParametroFormularioIva.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesTipoParametroFormularioIva.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesTipoParametroFormularioIva.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposGraficosReportesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposPaginacionTipoParametroFormularioIva.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionTipoParametroFormularioIva.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionTipoParametroFormularioIva.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposPaginacionTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposRelacionesTipoParametroFormularioIva.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesTipoParametroFormularioIva.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesTipoParametroFormularioIva.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposRelacionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposAccionesTipoParametroFormularioIva.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesTipoParametroFormularioIva.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesTipoParametroFormularioIva.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposAccionesTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposSeleccionarTipoParametroFormularioIva.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarTipoParametroFormularioIva.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarTipoParametroFormularioIva.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposSeleccionarTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.setMinimumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.setMaximumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConGraficoReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(60,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConGraficoReporteTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva.setMinimumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva.setMaximumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxSeleccionadosTipoParametroFormularioIva.setMinimumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosTipoParametroFormularioIva.setMaximumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosTipoParametroFormularioIva.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionadosTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; GridBagLayout gridaBagParametrosReportesTipoParametroFormularioIva = new GridBagLayout(); GridBagLayout gridaBagParametrosReportesAccionesTipoParametroFormularioIva = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar1TipoParametroFormularioIva = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar2TipoParametroFormularioIva = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar3TipoParametroFormularioIva = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar4TipoParametroFormularioIva = new GridBagLayout(); int iGridxParametrosReportes=0; int iGridyParametrosReportes=0; int iGridxParametrosAuxiliar=0; int iGridyParametrosAuxiliar=0; this.jPanelParametrosReportesTipoParametroFormularioIva.setLayout(gridaBagParametrosReportesTipoParametroFormularioIva); this.jPanelParametrosReportesAccionesTipoParametroFormularioIva.setLayout(gridaBagParametrosReportesAccionesTipoParametroFormularioIva); this.jPanelParametrosAuxiliar1TipoParametroFormularioIva.setLayout(gridaBagParametrosAuxiliar1TipoParametroFormularioIva); this.jPanelParametrosAuxiliar2TipoParametroFormularioIva.setLayout(gridaBagParametrosAuxiliar2TipoParametroFormularioIva); this.jPanelParametrosAuxiliar3TipoParametroFormularioIva.setLayout(gridaBagParametrosAuxiliar3TipoParametroFormularioIva); this.jPanelParametrosAuxiliar4TipoParametroFormularioIva.setLayout(gridaBagParametrosAuxiliar4TipoParametroFormularioIva); //this.jPanelParametrosAuxiliar5TipoParametroFormularioIva.setLayout(gridaBagParametrosAuxiliar2TipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jButtonRecargarInformacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //PAGINACION this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1TipoParametroFormularioIva.add(this.jComboBoxTiposPaginacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //CON ALTO MAXIMO TABLA this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1TipoParametroFormularioIva.add(this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //TIPOS ARCHIVOS REPORTES this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1TipoParametroFormularioIva.add(this.jComboBoxTiposArchivosReportesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jPanelParametrosAuxiliar1TipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR FIN //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar4TipoParametroFormularioIva.add(this.jComboBoxTiposReportesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES //USANDO AUXILIAR 4 this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jPanelParametrosAuxiliar4TipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR 4 FIN //TIPOS REPORTES /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jComboBoxTiposReportesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ //GENERAR REPORTE (jCheckBoxExportar) /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jCheckBoxGenerarReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; //USANDO AUXILIAR this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jPanelParametrosAuxiliar2TipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR FIN //PARAMETROS ACCIONES //iGridxParametrosReportes=1; iGridxParametrosReportes=0; iGridyParametrosReportes=1; /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jLabelAccionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ //PARAMETROS_ACCIONES-PARAMETROS_REPORTES //ORDER BY if(!this.conCargarMinimo) { this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jButtonAbrirOrderByTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } //PARAMETROS_ACCIONES-PARAMETROS_REPORTES this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jComboBoxTiposSeleccionarTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3TipoParametroFormularioIva.add(this.jCheckBoxSeleccionarTodosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3TipoParametroFormularioIva.add(this.jCheckBoxSeleccionadosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR3 this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.WEST; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jPanelParametrosAuxiliar3TipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //USANDO AUXILIAR3 FIN this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jComboBoxTiposRelacionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jComboBoxTiposAccionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyParametrosReportes; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesTipoParametroFormularioIva.add(this.jTextFieldValorCampoGeneralTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); ; //ELEMENTOS TABLAS PARAMETOS //SUBPANELES POR CAMPO if(!this.conCargarMinimo) { //SUBPANELES EN PANEL CAMPOS } //ELEMENTOS TABLAS PARAMETOS_FIN /* GridBagLayout gridaBagLayoutDatosTipoParametroFormularioIva = new GridBagLayout(); this.jScrollPanelDatosTipoParametroFormularioIva.setLayout(gridaBagLayoutDatosTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 0; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jScrollPanelDatosTipoParametroFormularioIva.add(this.jTableDatosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ this.redimensionarTablaDatos(-1); this.jScrollPanelDatosTipoParametroFormularioIva.setViewportView(this.jTableDatosTipoParametroFormularioIva); this.jTableDatosTipoParametroFormularioIva.setFillsViewportHeight(true); this.jTableDatosTipoParametroFormularioIva.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); Integer iGridXParametrosAccionesFormulario=0; Integer iGridYParametrosAccionesFormulario=0; GridBagLayout gridaBagLayoutAccionesTipoParametroFormularioIva= new GridBagLayout(); this.jPanelAccionesTipoParametroFormularioIva.setLayout(gridaBagLayoutAccionesTipoParametroFormularioIva); /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = 0; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jPanelAccionesTipoParametroFormularioIva.add(this.jButtonNuevoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ int iPosXAccion=0; //this.setJProgressBarToJPanel(); GridBagLayout gridaBagLayoutTipoParametroFormularioIva = new GridBagLayout(); this.jContentPane.setLayout(gridaBagLayoutTipoParametroFormularioIva); if(this.parametroGeneralUsuario.getcon_botones_tool_bar() && !this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; //this.gridBagConstraintsTipoParametroFormularioIva.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.CENTER;//.CENTER;NORTH this.gridBagConstraintsTipoParametroFormularioIva.ipadx = 100; this.jContentPane.add(this.jTtoolBarTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } //PROCESANDO EN OTRA PANTALLA /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; //this.gridBagConstraintsTipoParametroFormularioIva.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.anchor = GridBagConstraints.CENTER; this.gridBagConstraintsTipoParametroFormularioIva.ipadx = 100; this.jContentPane.add(this.jPanelProgressProcess, this.gridBagConstraintsTipoParametroFormularioIva); */ int iGridxBusquedasParametros=0; //PARAMETROS TABLAS PARAMETROS if(!this.conCargarMinimo) { } //PARAMETROS TABLAS PARAMETROS_FIN //PARAMETROS REPORTES this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesAccionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx =0; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsTipoParametroFormularioIva.ipady =150; this.jContentPane.add(this.jScrollPanelDatosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jContentPane.add(this.jPanelPaginacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); iWidthScroll=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO_RELSCROLL)+(250*0); iHeightScroll=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO_RELSCROLL); //iWidthFormulario=iWidthScroll; //iHeightFormulario=iHeightScroll; if(TipoParametroFormularioIvaJInternalFrame.CON_DATOS_FRAME) { this.jPanelBusquedasParametrosTipoParametroFormularioIva= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); int iGridyRelaciones=0; GridBagLayout gridaBagLayoutBusquedasParametrosTipoParametroFormularioIva = new GridBagLayout(); this.jPanelBusquedasParametrosTipoParametroFormularioIva.setLayout(gridaBagLayoutBusquedasParametrosTipoParametroFormularioIva); if(this.parametroGeneralUsuario.getcon_botones_tool_bar()) { } this.jScrollPanelDatosGeneralTipoParametroFormularioIva= new JScrollPane(jContentPane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelDatosGeneralTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthScroll,iHeightScroll)); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); //if(!this.conCargarMinimo) { //} this.conMaximoRelaciones=true; if(this.parametroGeneralUsuario.getcon_cargar_por_parte()) { } Boolean tieneColumnasOcultas=false; if(!Constantes.ISDEVELOPING) { } else { if(tieneColumnasOcultas) { } } } else { //DISENO_DETALLE COMENTAR Y //DISENO_DETALLE(Solo Descomentar Seccion Inferior) //NOTA-DISENO_DETALLE(Si cambia lo de abajo, cambiar lo comentado, Al final no es lo mismo) } //DISENO_DETALLE-(Descomentar) /* this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jContentPane.add(this.jPanelCamposTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy = iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = 0; this.jContentPane.add(this.jPanelCamposOcultosTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iGridyPrincipal++; this.gridBagConstraintsTipoParametroFormularioIva.gridx =0; this.jContentPane.add(this.jPanelAccionesTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); */ //pack(); return this.jScrollPanelDatosGeneralTipoParametroFormularioIva;//jContentPane; } /* public void cargarReporteDinamicoTipoParametroFormularioIva() throws Exception { int iWidthReporteDinamico=350; int iHeightReporteDinamico=450;//250;400; int iPosXReporteDinamico=0; int iPosYReporteDinamico=0; GridBagLayout gridaBagLayoutReporteDinamicoTipoParametroFormularioIva = new GridBagLayout(); //PANEL this.jPanelReporteDinamicoTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelReporteDinamicoTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelReporteDinamicoTipoParametroFormularioIva.setName("jPanelReporteDinamicoTipoParametroFormularioIva"); this.jPanelReporteDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoTipoParametroFormularioIva.setLayout(gridaBagLayoutReporteDinamicoTipoParametroFormularioIva); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva= new ReporteDinamicoJInternalFrame(); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteTipoParametroFormularioIva= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setjInternalFrameParent(this); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setTitle("REPORTE DINAMICO"); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setSize(iWidthReporteDinamico+70,iHeightReporteDinamico+100); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setResizable(true); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setClosable(true); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setMaximizable(true); //SCROLL PANEL //this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Tipo Parametro Formulario Iva s")); //CONTROLES-ELEMENTOS //LABEL SELECT COLUMNAS this.jLabelColumnasSelectReporteTipoParametroFormularioIva = new JLabelMe(); this.jLabelColumnasSelectReporteTipoParametroFormularioIva.setText("Columnas Seleccion"); this.jLabelColumnasSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jLabelColumnasSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LISTA SELECT COLUMNAS this.jListColumnasSelectReporteTipoParametroFormularioIva = new JList<Reporte>(); this.jListColumnasSelectReporteTipoParametroFormularioIva.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListColumnasSelectReporteTipoParametroFormularioIva.setToolTipText("Tipos de Seleccion"); this.jListColumnasSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(145,300)); this.jListColumnasSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(145,300)); this.jListColumnasSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollColumnasSelectReporteTipoParametroFormularioIva=new JScrollPane(this.jListColumnasSelectReporteTipoParametroFormularioIva); this.jScrollColumnasSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("COLUMNAS")); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jListColumnasSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jScrollColumnasSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LABEL SELECT RELACIONES this.jLabelRelacionesSelectReporteTipoParametroFormularioIva = new JLabelMe(); this.jLabelRelacionesSelectReporteTipoParametroFormularioIva.setText("Relaciones Seleccion"); this.jLabelRelacionesSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jLabelRelacionesSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LABEL SELECT RELACIONES_FIN //LISTA SELECT RELACIONES this.jListRelacionesSelectReporteTipoParametroFormularioIva = new JList<Reporte>(); this.jListRelacionesSelectReporteTipoParametroFormularioIva.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListRelacionesSelectReporteTipoParametroFormularioIva.setToolTipText("Tipos de Seleccion"); this.jListRelacionesSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(145,300)); this.jListRelacionesSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(145,300)); this.jListRelacionesSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollRelacionesSelectReporteTipoParametroFormularioIva=new JScrollPane(this.jListRelacionesSelectReporteTipoParametroFormularioIva); this.jScrollRelacionesSelectReporteTipoParametroFormularioIva.setMinimumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteTipoParametroFormularioIva.setMaximumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteTipoParametroFormularioIva.setPreferredSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("RELACIONES")); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jListRelacionesSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jScrollRelacionesSelectReporteTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LISTA SELECT RELACIONES_FIN this.jCheckBoxConGraficoDinamicoTipoParametroFormularioIva = new JCheckBoxMe(); this.jComboBoxColumnaCategoriaGraficoTipoParametroFormularioIva = new JComboBoxMe(); this.jListColumnasValoresGraficoTipoParametroFormularioIva = new JList<Reporte>(); //COMBO TIPOS REPORTES this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva = new JComboBoxMe(); this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS REPORTES //COMBO TIPOS ARCHIVOS this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva = new JComboBoxMe(); this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva.setToolTipText("Tipos Archivos"); this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS ARCHIVOS //LABEL GENERAR EXCEL this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva = new JLabelMe(); this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva.setText("Tipos de Reporte"); this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jLabelGenerarExcelReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON GENERAR EXCEL this.jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva = new JButtonMe(); this.jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva.setText("Generar Excel"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva,"generar_excel_reporte_dinamico_button","Generar EXCEL"); this.jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva.setToolTipText("Generar EXCEL"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); //this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); //this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; //this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; //this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jButtonGenerarExcelReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //COMBO TIPOS REPORTES this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jComboBoxTiposReportesDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LABEL TIPOS DE ARCHIVO this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva = new JLabelMe(); this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva.setText("Tipos de Archivo"); this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jLabelTiposArchivoReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //COMBO TIPOS ARCHIVOS this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jComboBoxTiposArchivosReportesDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON GENERAR this.jButtonGenerarReporteDinamicoTipoParametroFormularioIva = new JButtonMe(); this.jButtonGenerarReporteDinamicoTipoParametroFormularioIva.setText("Generar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarReporteDinamicoTipoParametroFormularioIva,"generar_reporte_dinamico_button","Generar"); this.jButtonGenerarReporteDinamicoTipoParametroFormularioIva.setToolTipText("Generar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jButtonGenerarReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON CERRAR this.jButtonCerrarReporteDinamicoTipoParametroFormularioIva = new JButtonMe(); this.jButtonCerrarReporteDinamicoTipoParametroFormularioIva.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarReporteDinamicoTipoParametroFormularioIva,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarReporteDinamicoTipoParametroFormularioIva.setToolTipText("Cancelar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoTipoParametroFormularioIva.add(this.jButtonCerrarReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutReporteDinamicoPrincipalTipoParametroFormularioIva = new GridBagLayout(); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva= new JScrollPane(jPanelReporteDinamicoTipoParametroFormularioIva,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Tipo Parametro Formulario Iva s")); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iPosYReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iPosXReporteDinamico; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.BOTH; this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.getContentPane().setLayout(gridaBagLayoutReporteDinamicoPrincipalTipoParametroFormularioIva); this.jInternalFrameReporteDinamicoTipoParametroFormularioIva.getContentPane().add(this.jScrollPanelReporteDinamicoTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } */ /* public void cargarImportacionTipoParametroFormularioIva() throws Exception { int iWidthImportacion=350; int iHeightImportacion=250;//400; int iPosXImportacion=0; int iPosYImportacion=0; GridBagLayout gridaBagLayoutImportacionTipoParametroFormularioIva = new GridBagLayout(); //PANEL this.jPanelImportacionTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelImportacionTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelImportacionTipoParametroFormularioIva.setName("jPanelImportacionTipoParametroFormularioIva"); this.jPanelImportacionTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionTipoParametroFormularioIva.setLayout(gridaBagLayoutImportacionTipoParametroFormularioIva); this.jInternalFrameImportacionTipoParametroFormularioIva= new ImportacionJInternalFrame(); //this.jInternalFrameImportacionTipoParametroFormularioIva= new ImportacionJInternalFrame(); this.jScrollPanelImportacionTipoParametroFormularioIva = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteTipoParametroFormularioIva= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameImportacionTipoParametroFormularioIva.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionTipoParametroFormularioIva.setjInternalFrameParent(this); this.jInternalFrameImportacionTipoParametroFormularioIva.setTitle("REPORTE DINAMICO"); this.jInternalFrameImportacionTipoParametroFormularioIva.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionTipoParametroFormularioIva.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionTipoParametroFormularioIva.setResizable(true); this.jInternalFrameImportacionTipoParametroFormularioIva.setClosable(true); this.jInternalFrameImportacionTipoParametroFormularioIva.setMaximizable(true); //JINTERNAL FRAME IMPORTACION this.jInternalFrameImportacionTipoParametroFormularioIva.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionTipoParametroFormularioIva.setjInternalFrameParent(this); this.jInternalFrameImportacionTipoParametroFormularioIva.setTitle("IMPORTACION"); this.jInternalFrameImportacionTipoParametroFormularioIva.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionTipoParametroFormularioIva.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionTipoParametroFormularioIva.setResizable(true); this.jInternalFrameImportacionTipoParametroFormularioIva.setClosable(true); this.jInternalFrameImportacionTipoParametroFormularioIva.setMaximizable(true); //SCROLL PANEL this.jScrollPanelImportacionTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Tipo Parametro Formulario Iva s")); //LABEL ARCHIVO IMPORTACION this.jLabelArchivoImportacionTipoParametroFormularioIva = new JLabelMe(); this.jLabelArchivoImportacionTipoParametroFormularioIva.setText("ARCHIVO IMPORTACION"); this.jLabelArchivoImportacionTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jLabelArchivoImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON ABRIR IMPORTACION this.jFileChooserImportacionTipoParametroFormularioIva = new JFileChooser(); this.jFileChooserImportacionTipoParametroFormularioIva.setToolTipText("ESCOGER ARCHIVO"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); this.jButtonAbrirImportacionTipoParametroFormularioIva = new JButtonMe(); this.jButtonAbrirImportacionTipoParametroFormularioIva.setText("ESCOGER"); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirImportacionTipoParametroFormularioIva,"generar_importacion_button","ESCOGER"); this.jButtonAbrirImportacionTipoParametroFormularioIva.setToolTipText("Generar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jButtonAbrirImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //LABEL PATH IMPORTACION this.jLabelPathArchivoImportacionTipoParametroFormularioIva = new JLabelMe(); this.jLabelPathArchivoImportacionTipoParametroFormularioIva.setText("PATH ARCHIVO"); this.jLabelPathArchivoImportacionTipoParametroFormularioIva.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionTipoParametroFormularioIva.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionTipoParametroFormularioIva.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jLabelPathArchivoImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //PATH IMPORTACION this.jTextFieldPathArchivoImportacionTipoParametroFormularioIva=new JTextFieldMe(); this.jTextFieldPathArchivoImportacionTipoParametroFormularioIva.setMinimumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionTipoParametroFormularioIva.setMaximumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionTipoParametroFormularioIva.setPreferredSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jTextFieldPathArchivoImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON IMPORTACION this.jButtonGenerarImportacionTipoParametroFormularioIva = new JButtonMe(); this.jButtonGenerarImportacionTipoParametroFormularioIva.setText("IMPORTAR"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarImportacionTipoParametroFormularioIva,"generar_importacion_button","IMPORTAR"); this.jButtonGenerarImportacionTipoParametroFormularioIva.setToolTipText("Generar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jButtonGenerarImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //BOTON CERRAR this.jButtonCerrarImportacionTipoParametroFormularioIva = new JButtonMe(); this.jButtonCerrarImportacionTipoParametroFormularioIva.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarImportacionTipoParametroFormularioIva,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarImportacionTipoParametroFormularioIva.setToolTipText("Cancelar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXImportacion++; this.jPanelImportacionTipoParametroFormularioIva.add(this.jButtonCerrarImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutImportacionPrincipalTipoParametroFormularioIva = new GridBagLayout(); this.jScrollPanelImportacionTipoParametroFormularioIva= new JScrollPane(jPanelImportacionTipoParametroFormularioIva,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXImportacion=0; iPosYImportacion=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iPosYImportacion; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iPosXImportacion; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.BOTH; this.jInternalFrameImportacionTipoParametroFormularioIva.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameImportacionTipoParametroFormularioIva.getContentPane().setLayout(gridaBagLayoutImportacionPrincipalTipoParametroFormularioIva); this.jInternalFrameImportacionTipoParametroFormularioIva.getContentPane().add(this.jScrollPanelImportacionTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } */ /* public void cargarOrderByTipoParametroFormularioIva(Boolean cargaMinima) throws Exception { String sMapKey = ""; InputMap inputMap =null; int iWidthOrderBy=350; int iHeightOrderBy=300;//400; int iPosXOrderBy=0; int iPosYOrderBy=0; if(!cargaMinima) { this.jButtonAbrirOrderByTipoParametroFormularioIva = new JButtonMe(); this.jButtonAbrirOrderByTipoParametroFormularioIva.setText("Orden"); this.jButtonAbrirOrderByTipoParametroFormularioIva.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByTipoParametroFormularioIva,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderByTipoParametroFormularioIva"; inputMap = this.jButtonAbrirOrderByTipoParametroFormularioIva.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByTipoParametroFormularioIva.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderByTipoParametroFormularioIva")); GridBagLayout gridaBagLayoutOrderByTipoParametroFormularioIva = new GridBagLayout(); //PANEL this.jPanelOrderByTipoParametroFormularioIva = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelOrderByTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelOrderByTipoParametroFormularioIva.setName("jPanelOrderByTipoParametroFormularioIva"); this.jPanelOrderByTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldPanel(this.jPanelOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jPanelOrderByTipoParametroFormularioIva.setLayout(gridaBagLayoutOrderByTipoParametroFormularioIva); this.jTableDatosTipoParametroFormularioIvaOrderBy = new JTableMe(); this.jTableDatosTipoParametroFormularioIvaOrderBy.setAutoCreateRowSorter(true); FuncionesSwing.setBoldTable(jTableDatosTipoParametroFormularioIvaOrderBy,STIPO_TAMANIO_GENERAL,false,true,this); this.jScrollPanelDatosTipoParametroFormularioIvaOrderBy = new JScrollPane(); this.jScrollPanelDatosTipoParametroFormularioIvaOrderBy.setBorder(javax.swing.BorderFactory.createTitledBorder("Orden")); this.jScrollPanelDatosTipoParametroFormularioIvaOrderBy.setViewportView(this.jTableDatosTipoParametroFormularioIvaOrderBy); this.jTableDatosTipoParametroFormularioIvaOrderBy.setFillsViewportHeight(true); this.jTableDatosTipoParametroFormularioIvaOrderBy.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); this.jInternalFrameOrderByTipoParametroFormularioIva= new OrderByJInternalFrame(); this.jInternalFrameOrderByTipoParametroFormularioIva= new OrderByJInternalFrame(); this.jScrollPanelOrderByTipoParametroFormularioIva = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteTipoParametroFormularioIva= new JScrollPane(); //JINTERNAL FRAME OrderBy this.jInternalFrameOrderByTipoParametroFormularioIva.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameOrderByTipoParametroFormularioIva.setjInternalFrameParent(this); this.jInternalFrameOrderByTipoParametroFormularioIva.setTitle("Orden"); this.jInternalFrameOrderByTipoParametroFormularioIva.setSize(iWidthOrderBy+70,iHeightOrderBy+100); this.jInternalFrameOrderByTipoParametroFormularioIva.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameOrderByTipoParametroFormularioIva.setResizable(true); this.jInternalFrameOrderByTipoParametroFormularioIva.setClosable(true); this.jInternalFrameOrderByTipoParametroFormularioIva.setMaximizable(true); //FuncionesSwing.setBoldPanel(this.jInternalFrameOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; //SCROLL PANEL this.jScrollPanelOrderByTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.jScrollPanelOrderByTipoParametroFormularioIva.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Tipo Parametro Formulario Iva s")); //DATOS TOTALES this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iPosYOrderBy++; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iPosXOrderBy; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsTipoParametroFormularioIva.ipady =150; this.jPanelOrderByTipoParametroFormularioIva.add(jScrollPanelDatosTipoParametroFormularioIvaOrderBy, this.gridBagConstraintsTipoParametroFormularioIva);//this.jTableDatosTipoParametroFormularioIvaTotales //BOTON CERRAR this.jButtonCerrarOrderByTipoParametroFormularioIva = new JButtonMe(); this.jButtonCerrarOrderByTipoParametroFormularioIva.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarOrderByTipoParametroFormularioIva,"cerrar","Salir");//cerrar_reporte_dinamico_button this.jButtonCerrarOrderByTipoParametroFormularioIva.setToolTipText("Cancelar"+" "+TipoParametroFormularioIvaConstantesFunciones.SCLASSWEBTITULO); FuncionesSwing.setBoldButton(this.jButtonCerrarOrderByTipoParametroFormularioIva, STIPO_TAMANIO_GENERAL,false,true,this);; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsTipoParametroFormularioIva.gridy = iPosYOrderBy++; this.gridBagConstraintsTipoParametroFormularioIva.gridx = iPosXOrderBy; this.jPanelOrderByTipoParametroFormularioIva.add(this.jButtonCerrarOrderByTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutOrderByPrincipalTipoParametroFormularioIva = new GridBagLayout(); this.jScrollPanelOrderByTipoParametroFormularioIva= new JScrollPane(jPanelOrderByTipoParametroFormularioIva,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXOrderBy=0; iPosYOrderBy=0; this.gridBagConstraintsTipoParametroFormularioIva = new GridBagConstraints(); this.gridBagConstraintsTipoParametroFormularioIva.gridy =iPosYOrderBy; this.gridBagConstraintsTipoParametroFormularioIva.gridx =iPosXOrderBy; this.gridBagConstraintsTipoParametroFormularioIva.fill = GridBagConstraints.BOTH; this.jInternalFrameOrderByTipoParametroFormularioIva.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameOrderByTipoParametroFormularioIva.getContentPane().setLayout(gridaBagLayoutOrderByPrincipalTipoParametroFormularioIva); this.jInternalFrameOrderByTipoParametroFormularioIva.getContentPane().add(this.jScrollPanelOrderByTipoParametroFormularioIva, this.gridBagConstraintsTipoParametroFormularioIva); } else { this.jButtonAbrirOrderByTipoParametroFormularioIva = new JButtonMe(); } } */ public void redimensionarTablaDatos(int iNumFilas) { this.redimensionarTablaDatos(iNumFilas,0); } public void redimensionarTablaDatos(int iNumFilas,int iTamanioFilaTabla) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidthTable=screenSize.width*2;//screenSize.width - (screenSize.width/8); int iWidthTableScroll=screenSize.width - (screenSize.width/8); int iWidthTableCalculado=0;//830 int iHeightTable=0;//screenSize.height/3; int iHeightTableTotal=0; //ANCHO COLUMNAS SIMPLES iWidthTableCalculado+=430; //ANCHO COLUMNAS OCULTAS if(Constantes.ISDEVELOPING) { iWidthTableCalculado+=300; } //ANCHO COLUMNAS RELACIONES iWidthTableCalculado+=100; //ESPACION PARA SELECT RELACIONES if(this.conMaximoRelaciones && this.tipoparametroformularioivaSessionBean.getConGuardarRelaciones() ) { if(this.conFuncionalidadRelaciones) { iWidthTableCalculado+=Constantes.ISWING_ANCHO_COLUMNA; } } //SI CALCULADO ES MENOR QUE MAXIMO /* if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } */ //SI TABLA ES MENOR QUE SCROLL if(iWidthTableCalculado<=iWidthTableScroll) { iWidthTableScroll=iWidthTableCalculado; } //NO VALE SIEMPRE PONE TAMANIO COLUMNA 200 /* int iTotalWidth=0; int iWidthColumn=0; int iCountColumns=this.jTableDatosTipoParametroFormularioIva.getColumnModel().getColumnCount(); if(iCountColumns>0) { for(int i = 0; i < this.jTableDatosTipoParametroFormularioIva.getColumnModel().getColumnCount(); i++) { TableColumn column = this.jTableDatosTipoParametroFormularioIva.getColumnModel().getColumn(i); iWidthColumn=column.getWidth(); iTotalWidth+=iWidthColumn; } //iWidthTableCalculado=iTotalWidth; } */ if(iTamanioFilaTabla<=0) { iTamanioFilaTabla=this.jTableDatosTipoParametroFormularioIva.getRowHeight();//TipoParametroFormularioIvaConstantesFunciones.ITAMANIOFILATABLA; } if(iNumFilas>0) { iHeightTable=(iNumFilas * iTamanioFilaTabla); } else { iHeightTable=iTamanioFilaTabla; } iHeightTableTotal=iHeightTable; if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { if(iHeightTable > TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.isSelected()) { iHeightTable=TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } else { if(iHeightTable > TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaTipoParametroFormularioIva.isSelected()) { iHeightTable=TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=TipoParametroFormularioIvaConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } //OJO:SE DESHABILITA CALCULADO //NO SE UTILIZA CALCULADO SI POR DEFINICION if(iWidthTableDefinicion>0) { iWidthTableCalculado=iWidthTableDefinicion; } this.jTableDatosTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));//iWidthTable this.jScrollPanelDatosTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //ORDER BY //OrderBy int iHeightTableOrderBy=0; int iNumFilasOrderBy=this.arrOrderBy.size(); int iTamanioFilaTablaOrderBy=0; if(this.jInternalFrameOrderByTipoParametroFormularioIva!=null && this.jInternalFrameOrderByTipoParametroFormularioIva.getjTableDatosOrderBy()!=null) { //if(!this.tipoparametroformularioivaSessionBean.getEsGuardarRelacionado()) { iTamanioFilaTablaOrderBy=this.jInternalFrameOrderByTipoParametroFormularioIva.getjTableDatosOrderBy().getRowHeight(); if(iNumFilasOrderBy>0) { iHeightTableOrderBy=iNumFilasOrderBy * iTamanioFilaTablaOrderBy; } else { iHeightTableOrderBy=iTamanioFilaTablaOrderBy; } this.jInternalFrameOrderByTipoParametroFormularioIva.getjTableDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTableCalculado/4 this.jInternalFrameOrderByTipoParametroFormularioIva.getjTableDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy)); this.jInternalFrameOrderByTipoParametroFormularioIva.getjTableDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTable this.jInternalFrameOrderByTipoParametroFormularioIva.getjScrollPanelDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));//iHeightTableOrderBy,iWidthTableScroll this.jInternalFrameOrderByTipoParametroFormularioIva.getjScrollPanelDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); this.jInternalFrameOrderByTipoParametroFormularioIva.getjScrollPanelDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); } //ORDER BY //this.jScrollPanelDatosTipoParametroFormularioIva.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosTipoParametroFormularioIva.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosTipoParametroFormularioIva.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //VERSION 0 /* //SI CALCULADO ES MENOR QUE MAXIMO if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } //SI TABLA ES MENOR QUE SCROLL if(iWidthTable<=iWidthTableScroll) { iWidthTableScroll=iWidthTable; } */ } public void redimensionarTablaDatosConTamanio(int iTamanioFilaTabla) throws Exception { int iSizeTabla=0; //ARCHITECTURE if(Constantes.ISUSAEJBLOGICLAYER) { iSizeTabla=tipoparametroformularioivaLogic.getTipoParametroFormularioIvas().size(); } else if(Constantes.ISUSAEJBREMOTE || Constantes.ISUSAEJBHOME) { iSizeTabla=tipoparametroformularioivas.size(); } //ARCHITECTURE this.redimensionarTablaDatos(iSizeTabla,iTamanioFilaTabla); } //PARA REPORTES public static List<TipoParametroFormularioIva> TraerTipoParametroFormularioIvaBeans(List<TipoParametroFormularioIva> tipoparametroformularioivas,ArrayList<Classe> classes)throws Exception { try { for(TipoParametroFormularioIva tipoparametroformularioiva:tipoparametroformularioivas) { if(!(TipoParametroFormularioIvaConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_GENERICO) || TipoParametroFormularioIvaConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_TOTALES_GENERICO)) ) { tipoparametroformularioiva.setsDetalleGeneralEntityReporte(TipoParametroFormularioIvaConstantesFunciones.getTipoParametroFormularioIvaDescripcion(tipoparametroformularioiva)); if(tipoparametroformularioiva.getParametroFormularioIvas()!=null && Funciones.existeClass(classes,ParametroFormularioIva.class)) { try{tipoparametroformularioiva.setparametroformularioivasDescripcionReporte(new JRBeanCollectionDataSource(ParametroFormularioIvaJInternalFrame.TraerParametroFormularioIvaBeans(tipoparametroformularioiva.getParametroFormularioIvas(),classes)));}catch(Exception e){e.printStackTrace();} } } else { //tipoparametroformularioiva.setsDetalleGeneralEntityReporte(tipoparametroformularioiva.getsDetalleGeneralEntityReporte()); } //tipoparametroformularioivabeans.add(tipoparametroformularioivabean); } } catch(Exception ex) { throw ex; } return tipoparametroformularioivas; } //PARA REPORTES FIN }
52.90708
403
0.82808
18a6abc9cb750d9f1d0b025372c4886719830e45
120
package alexmog.rulemastersworld.entity; public enum Faction { NEUTRAL, RED, BLUE, GREEN, YELLOW }
12
40
0.65
17479bcee21fbbb706f447fad2a999a07916ff39
617
package org.infinispan.query.remote.impl; import java.util.List; public class RemoteQueryResult { private final String[] projections; private final int totalResults; private final List<Object> results; RemoteQueryResult(String[] projections, int totalResults, List<Object> results) { this.projections = projections; this.totalResults = totalResults; this.results = results; } public String[] getProjections() { return projections; } public int getTotalResults() { return totalResults; } public List<Object> getResults() { return results; } }
22.035714
84
0.693679
575dbe7afe88ea4df93690f0aa40e9c163b1e69b
1,288
package com.lothrazar.cyclicmagic.capability; import com.lothrazar.cyclicmagic.ModCyclic; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilitySerializable; public class PlayerCapInstance implements ICapabilitySerializable<NBTTagCompound> { IPlayerExtendedProperties inst = ModCyclic.CAPABILITYSTORAGE.getDefaultInstance(); @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return capability == ModCyclic.CAPABILITYSTORAGE; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == ModCyclic.CAPABILITYSTORAGE ? ModCyclic.CAPABILITYSTORAGE.<T> cast(inst) : null; } @Override public NBTTagCompound serializeNBT() { NBTBase ret = ModCyclic.CAPABILITYSTORAGE.getStorage().writeNBT(ModCyclic.CAPABILITYSTORAGE, inst, null); if (ret instanceof NBTTagCompound) { return (NBTTagCompound) ret; } return null; } @Override public void deserializeNBT(NBTTagCompound nbt) { ModCyclic.CAPABILITYSTORAGE.getStorage().readNBT(ModCyclic.CAPABILITYSTORAGE, inst, null, nbt); } }
34.810811
109
0.787267
e4913932d68e1c512eff0d68a045a7010ec5af7a
1,517
/*- * Copyright (C) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * * This file was distributed by Oracle as part of a version of Oracle Berkeley * DB Java Edition made available at: * * http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html * * Please see the LICENSE file included in the top-level directory of the * appropriate version of Oracle Berkeley DB Java Edition for a copy of the * license and additional information. */ package com.sleepycat.je.rep; import com.sleepycat.je.OperationFailureException; /** * @hidden internal, for use in disaster recovery [#23447] * * Thrown when an operation is performed on an active replication group member * but it requires that the member not be active. */ public class MemberActiveException extends OperationFailureException { private static final long serialVersionUID = 1; /** * For internal use only. * @hidden */ public MemberActiveException(String message) { super(null /*locker*/, false /*abortOnly*/, message, null /*cause*/); } /** * For internal use only. * @hidden */ private MemberActiveException(String message, MemberActiveException cause) { super(message, cause); } /** * For internal use only. * @hidden */ @Override public OperationFailureException wrapSelf(String msg) { return new MemberActiveException(msg, this); } }
28.622642
99
0.679631
540bd77603eb9e6c5f2e52631ac575eb8b5d037c
17,365
import java.util.Map; import java.util.HashMap; import java.time.LocalDate; import java.util.ArrayList; import java.util.Iterator; /** * Clase para la gestión de la vacunacion * * Esta clase crea dos estructuras de tipo HashMap donde se almacenan: * 1. Los pacientes prioritarios: firstPriorityGroup * 2. Los pacientes NO prioritarios: secondPriorityGroup * * Como en el resto de clases, la clave es el DNI y en este caso el valor es un objeto del tipo VaccinationRegister * donde esta toda la informacion relacionada con la vacunacion del paciente * * @author @Deividgdt * @version 0.8 */ public class VaccinationManagement { private Map<String, VaccinationRegister> firstPriorityGroup; private Map<String, VaccinationRegister> secondPriorityGroup; /** * Constructor para objetos de la clase VaccinationManagement */ public VaccinationManagement() { firstPriorityGroup = new HashMap<>(); secondPriorityGroup = new HashMap<>(); } /** * Metodo encargado de programar una vacunacion, para poder realizar la cita se debe cumplir * que la cita sea 21 dias superior a la fecha de la primera vacuna. * * Dependiendo de si el paciente es o no prioritario se añadira al HashMap firstPriorityGroup o secondPriorityGroup * * @param patientToBeVaccinated El paciente a ser vacunado * @param AppointmentDate La fecha de la cita * @return boolean true == la creacion de la cita ha sido correcta || false == no se ha creado la cita */ public boolean scheduleVaccination(Patient patientToBeVaccinated, LocalDate AppointmentDate) { if(patientIsScheduledToBeVaccinated(patientToBeVaccinated)){ if(!secondDosesIsAfter21days(patientToBeVaccinated, AppointmentDate)){ System.out.println(" +++ ATENCION: La segunda dosis no puede ser antes de 21 días."); return false; }else{ scheduleSecondVaccination(patientToBeVaccinated, AppointmentDate); return true; } }else{ VaccinationRegister newVaccinationRegister = new VaccinationRegister(patientToBeVaccinated, AppointmentDate); if(patientToBeVaccinated.isAPriorityPatient()){ firstPriorityGroup.put(patientToBeVaccinated.getDNI(), newVaccinationRegister); return true; }else{ secondPriorityGroup.put(patientToBeVaccinated.getDNI(), newVaccinationRegister); return true; } } } /** * Metodo privado para crear la segunda cita de vacunacion, si el paciente es prioritario * lo añade a firstPriorityGroup y no lo es lo añade a secondPriorityGroup * * @param patientToBeVaccinated Paciente a vacunar * @param secondAppointmentDate La fecha de la segunda cita * @return true */ private boolean scheduleSecondVaccination(Patient patientToBeVaccinated, LocalDate secondAppointmentDate) { if(patientToBeVaccinated.isAPriorityPatient()){ firstPriorityGroup.get(patientToBeVaccinated.getDNI()).setNextDosesAppointment(secondAppointmentDate); return true; }else{ secondPriorityGroup.get(patientToBeVaccinated.getDNI()).setNextDosesAppointment(secondAppointmentDate); return true; } } /** * Metodo para buscar un registro de vacunacion. Se comprueba si el paciente es prioritario * o no para buscarlo en un HashMap u otro * * @param patient El paciente sobre el cual se busca el registro * @return VaccinationRegister El registro de vacunacion buscaddo */ public VaccinationRegister searchForVaccinationRegister(Patient patient) { if(patient.isAPriorityPatient()){ return firstPriorityGroup.get(patient.getDNI()); }else{ return secondPriorityGroup.get(patient.getDNI()); } } /** * Metodo que comprueba si un paciente ya esta programado para ser vacunado * * @param patient El paciente a comprobar si esta vacunado * @return boolean true == paciente programado || false == paciente no programado */ public boolean patientIsScheduledToBeVaccinated(Patient patient) { if(firstPriorityGroup.get(patient.getDNI()) != null || secondPriorityGroup.get(patient.getDNI()) != null){ return true; } return false; } /** * Metodo que comprueba si el paciente ya esta programado para la segunda cita de vacunacion * * @param patient El paciente a comprobar si esta programado para la segunda cita * @return boolean true == paciente programado para segunda cita || false == paciente no programado */ public boolean patientIsScheduledForSecondDosesAppointment(Patient patient) { if(patient.isAPriorityPatient() && firstPriorityGroup.get(patient.getDNI()).getNextDosesAppointment() != null){ return true; }else if(!patient.isAPriorityPatient() && secondPriorityGroup.get(patient.getDNI()).getNextDosesAppointment() != null){ return true; }else{ return false; } } /** * Metodo que comprueba si todos los pacientes prioritarios estan vacunados * * Se recorre todo el HashMap firstPriorityGroup y se llama al metodo isPatientVaccinated() * Si se encuentra algun paciente en el que este metodo devuelva false se devuelve un * false * * @return boolean true == todos los pacientes prioritarios vacunados || false == hay pacientes prioritarios sin vacunar */ public boolean allPriorityPatientsAreVaccinated() { for(Map.Entry<String, VaccinationRegister> register : firstPriorityGroup.entrySet()){ if(!register.getValue().isPatientVaccinated()){ return false; } } return true; } /** * Metodo para buscar la fecha mas cercana de todas las segundas citas del grupo prioritario * se recorren todas las citas y se obtiene la fecha mas cercana a la fecha actual * * @return LocalDate La fecha más cercana de la segunda vacunacion */ public LocalDate getClosestPriorityVaccinationSecondDate() { LocalDate currentRegisterDate = null; LocalDate closestRegisterDate = LocalDate.now().plusYears(100); LocalDate defaultDate = LocalDate.now().plusYears(100); for(Map.Entry<String, VaccinationRegister> register : firstPriorityGroup.entrySet()){ currentRegisterDate = register.getValue().getNextDosesAppointment(); if(currentRegisterDate != null && currentRegisterDate.isBefore(closestRegisterDate)){ closestRegisterDate = currentRegisterDate; } } if(closestRegisterDate.isEqual(defaultDate)){ return getFarthestPriorityVaccinationFirstDosesDate(); } return closestRegisterDate; } /** * Metodo para buscar la fecha mas lejana de la primera vacunacion del grupo prioritario * El funcionamiento es igual al metodo getClosestPriorityVaccinationSecondDate * * @return LocalDate La fecha mas lejana */ public LocalDate getFarthestPriorityVaccinationFirstDosesDate() { LocalDate currentRegisterDate = null; LocalDate farthestRegisterDate = LocalDate.now(); for(Map.Entry<String, VaccinationRegister> register : firstPriorityGroup.entrySet()){ currentRegisterDate = register.getValue().getFirstDosesAppointment(); if(currentRegisterDate != null && currentRegisterDate.isAfter(farthestRegisterDate)){ farthestRegisterDate = currentRegisterDate; } } return farthestRegisterDate; } /** * Metodo para saber una fecha dada se encuentra entre le fecha mas lejana de la primera * vacunacion y la fecha mas cercana de la segunda vacunacion. Este metodo hace uso de los * metodos getClosestPriorityVaccinationSecondDate y getFarthestPriorityVaccinationFirstDosesDate * para devolver un valor boolean dependiendo de si la fecha dada se encuentra entre ambas fechas * devueltas por los metodos * * Este metodo se utiliza basicamente para saber si un paciente no prioritario puede ser vacunado en medio * de las vacunaciones de los pacientes prioritarios * * @param vaccinationDate La fecha de vacunacion * @return boolean true == fecha entre dosis correctas || false == fecha No esta entre dosis correctas */ public boolean dateIsBetweenDoses(LocalDate vaccinationDate) { LocalDate farthestDate = getFarthestPriorityVaccinationFirstDosesDate(); LocalDate closestDate = getClosestPriorityVaccinationSecondDate(); LocalDate defaultDate = LocalDate.now().plusYears(100); // Si no existen aun segundas citas programadas if(closestDate.isEqual(defaultDate)){ return true; }else if(vaccinationDate.isAfter(farthestDate) && vaccinationDate.isBefore(closestDate)){ return true; } return false; } /** * Metodo que obtiene la primera fecha de vacunacion de un paciente * * @param patient El paciente del que queremos obtener la primera fecha de vacunacion * @return String La fecha en formato String */ public String getFirstDosesDateAppointment(Patient patient) { if(patient.isAPriorityPatient()){ return firstPriorityGroup.get(patient.getDNI()).getFirstDosesAppointment().toString(); } else{ return secondPriorityGroup.get(patient.getDNI()).getFirstDosesAppointment().toString(); } } /** * Metodo para obtener la segunda fecha de vacunacion de un paciente * * @param patient El paciente del que queremos obtener la segunda fecha de vacunacion * @return String La fecha en formato String || NO PROG si la fecha no ha sido programada */ public String getSecondDosesDateAppointment(Patient patient) { if(patientIsScheduledForSecondDosesAppointment(patient)){ if(patient.isAPriorityPatient()){ return firstPriorityGroup.get(patient.getDNI()).getNextDosesAppointment().toString(); }else{ return secondPriorityGroup.get(patient.getDNI()).getNextDosesAppointment().toString(); } }else{ return "NO PROG."; } } /** * Comprueba si la fecha de la segunda dosis esta 21 dias por delante de la primera * * @param patient, dateToSecondDosis - Paciente, fecha para la segunda dosis * @return true == fecha correcta || false == fecha incorrecta */ private boolean secondDosesIsAfter21days(Patient patient, LocalDate dateToSecondDosis) { LocalDate firstDosesAppointment; LocalDate firstDosesAppointmentPlus21days; if(patient.isAPriorityPatient()){ firstDosesAppointment = firstPriorityGroup.get(patient.getDNI()).getFirstDosesAppointment(); firstDosesAppointmentPlus21days = firstDosesAppointment.plusDays(21); if(dateToSecondDosis.isAfter(firstDosesAppointmentPlus21days)){ return true; } } else{ firstDosesAppointment = secondPriorityGroup.get(patient.getDNI()).getFirstDosesAppointment(); firstDosesAppointmentPlus21days = firstDosesAppointment.plusDays(21); if(dateToSecondDosis.isAfter(firstDosesAppointmentPlus21days)){ return true; } } return false; } /** * Metodo encargado de asignar un/a enfermero/a a un registro de vacunacion * * Este metodo hace uso del metodo searchForVaccinationRegister() para buscar el registro * y a continuacion asignar el/la enfermero/a * * @param patient El paciente al cual se le quiere asignar el/la enfermero/a * @param nurse El/la enfermero/a a asignar */ public void assignNurseToRegister(Patient patient, Nurse nurse) { VaccinationRegister registerToAssingNurse = searchForVaccinationRegister(patient); registerToAssingNurse.assignNurse(nurse); } /** * Metodo encargado de marcar a un paciente como vacunado * * Este metodo hace uso del metodo searchForVaccinationRegister() para buscar el registro * y a continuacion marcar al paciente como vacunado con el metodo setPatientAsVaccinated de la * clase register * * @param patient El paciente el cual se quiere marcar como vacunado */ public void vaccinatePatient(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); register.setPatientAsVaccinated(); } /** * Metodo encargado de asignar la primera fecha de vacunacion * * Hace uso del metodo searchForVaccinationRegister() * * @param patient El paciente al cual se le quiere asignar la primera fecha */ public void setFirstDosesDone(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); register.setFirstDosesState(true); } /** * Metodo encargado de devolver un valor boolean dependiendo de si la primera * dosis del paciente ha sido dada o no * * Hace uso del metodo isFirstDosesDone() de la clase Register * * @param patient El paciente sobre el cual se quiere consultar el estado de la primera dosis * @return boolean true == la primera dosis ha sido dada || false == la primera dosis no ha sido dada */ public boolean isFirstDosesDone(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); return register.isFirstDosesDone(); } /** * Metodo encargado de devolver un valor boolean dependiendo de si la segunda * dosis ha sido dada o no * * Hace uso del metodo searchForVaccinationRegister() de la clase Register * * @param patient El paciente sobre el cual se quiere consultar el estado de la segunda dosis */ public boolean isSecondDosesNeeded(Patient patient){ VaccinationRegister register = searchForVaccinationRegister(patient); return register.isSecondDosesNeeded(); } /** * Metodo encargado de indicar que la segunda dosis para un paciente no es necesaria, * esto solo ocurre en el caso de que la vacuna asignada sea Johnson * * @param patient El paciente al cual queremos indicar en el registro que no necesita segunda dosis */ public void secondDosesIsNoNeeded(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); register.secondDosesIsNeeded(false); } /** * Metodo encargado de devolver un valor boolean dependiendo de si el paciente ya ha sido * vacunado o no * * @param patient El paciente sobre el cual queremos consultar si ha sido vacunado o no * @return boolean true == ha sido vacunado || false == no ha sido vacunado */ public boolean isPatientVaccinated(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); if(register != null){ return register.isPatientVaccinated(); } return false; } /** * Metodo encargado de obtener el tipo enumero del tipo de vacuna asignada a un paciente * * @param patient El paciente sobre el cual queremos consultar el tipo de vacuna asignada * @return VaccineType Tipo enumerado de las vacunas = JOHNSON, MODERNA, PFIZER */ public VaccineType getVaccineType(Patient patient) { VaccinationRegister register = searchForVaccinationRegister(patient); if(register != null){ return register.getTypeOfVaccineAssigned(); } return VaccineType.UNKOWN; } /** * Metodo encargado de devolver un ArrayList de Strings con DNIs con los pacientes * a los que se les ha asignado el/la enfermero/a para la vacunacion * * @param nurseDNI El DNI de el/la enfermero/a * @return ArrayList Lista de DNIs con los pacientes asignados a el/la enfermera con DNI nurseDNI */ public ArrayList<String> getPatientsByNurseDNI(String nurseDNI) { ArrayList<String> DNIs = new ArrayList<>(); for(Map.Entry<String, VaccinationRegister> register : firstPriorityGroup.entrySet()){ Nurse currentNurse = register.getValue().getNurseAssigned(); if(currentNurse != null && currentNurse.getDNI().equals(nurseDNI)){ DNIs.add(register.getKey()); } } for(Map.Entry<String, VaccinationRegister> register : secondPriorityGroup.entrySet()){ Nurse currentNurse = register.getValue().getNurseAssigned(); if(currentNurse != null && currentNurse.getDNI().equals(nurseDNI)){ DNIs.add(register.getKey()); } } return DNIs; } }
39.198646
127
0.67135
a956f3d9bfaf03e905bc694eba3af8d6f0144d28
1,266
package cn.rapidtsdb.tsdb.plugins; import cn.rapidtsdb.tsdb.plugins.func.ConfigurablePlugin; import cn.rapidtsdb.tsdb.plugins.func.NameablePlugin; import cn.rapidtsdb.tsdb.plugins.func.PreparablePlugin; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * abstracting the persistence storage into file notation. * <p> * handle file io, note you need handle io lock by yourself */ public interface FileStoreHandlerPlugin extends NameablePlugin, PreparablePlugin, ConfigurablePlugin { /** * return the handler scheme * such as file, s3, hadoop, hdfs * * @return */ String getScheme(); boolean fileExisted(String filePath); boolean fileWriteable(String filePath); boolean fileReadable(String filePath); InputStream openFileInputStream(String filePath) throws IOException; OutputStream openFileOutputStream(String filePath) throws IOException; OutputStream openFileAppendStream(String filePath) throws IOException; File getFile(String filePath); long getFileSize(String filePath); boolean createDirectory(String filePath); boolean createFile(String filePath); boolean removeFile(String filePath, boolean force); }
25.32
102
0.758294
f968978255eceee8d6fdb198a5b55fd96ae6d6b7
2,838
/******************************************************************************* * Copyright 2013 Ednovo d/b/a Gooru. All rights reserved. * * http://www.goorulearning.org/ * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ package org.ednovo.gooru.shared.model.folder; import java.io.Serializable; import org.ednovo.gooru.shared.model.content.ResourceFormatDo; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonInclude(Include.NON_NULL) public class FolderItemDo implements Serializable{ private static final long serialVersionUID = -3298220423508874309L; private String gooruOid; private String title; private ResourceFormatDo resourceFormat; private String type; public FolderItemDo(){} /** * This method is to get the gooruOid */ public String getGooruOid() { return gooruOid; } /** * This method is to set the gooruOid */ public void setGooruOid(String gooruOid) { this.gooruOid = gooruOid; } /** * This method is to get the title */ public String getTitle() { return title; } /** * This method is to set the title */ public void setTitle(String title) { this.title = title; } /** * This method is to get the resourceFormat */ public ResourceFormatDo getResourceFormat() { return resourceFormat; } /** * This method is to set the resourceFormat */ public void setResourceFormat(ResourceFormatDo resourceFormat) { this.resourceFormat = resourceFormat; } /** * This method is to get the type */ public String getType() { return type; } /** * This method is to set the type */ public void setType(String type) { this.type = type; } }
28.09901
80
0.687808
6b6fffda47f9fb039434d22bc82b39f5d163b1d7
5,283
/* * Copyright 2015-present Open Networking Laboratory * * Licensed 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. */ package org.onosproject.bgpio.types.attr; import java.util.Objects; import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.bgpio.exceptions.BgpParseException; import org.onosproject.bgpio.types.BgpErrorType; import org.onosproject.bgpio.types.BgpValueType; import org.onosproject.bgpio.util.Validation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.MoreObjects; /** * Implements BGP link IGP metric attribute. */ public class BgpLinkAttrIgpMetric implements BgpValueType { protected static final Logger log = LoggerFactory .getLogger(BgpLinkAttrIgpMetric.class); public static final int ATTRLINK_IGPMETRIC = 1095; public static final int ATTRLINK_MAX_LEN = 3; /* Variable metric length based on protocol */ public static final int ISIS_SMALL_METRIC = 1; public static final int OSPF_LINK_METRIC = 2; public static final int ISIS_WIDE_METRIC = 3; /* IGP Metric */ private final int igpMetric; private final int igpMetricLen; /** * Constructor to initialize the value. * * @param igpMetric 3 byte IGP metric data. * @param igpMetricLen length of IGP metric data. */ public BgpLinkAttrIgpMetric(final int igpMetric, final int igpMetricLen) { this.igpMetric = igpMetric; this.igpMetricLen = igpMetricLen; } /** * Returns object of this class with specified values. * * @param igpMetric 3 byte IGP metric data. * @param igpMetricLen length of IGP metric data. * @return object of BgpLinkAttrIgpMetric */ public static BgpLinkAttrIgpMetric of(final int igpMetric, final int igpMetricLen) { return new BgpLinkAttrIgpMetric(igpMetric, igpMetricLen); } /** * Reads the BGP link attributes IGP Metric. * * @param cb Channel buffer * @return object of type BgpLinkAttrIgpMetric * @throws BgpParseException while parsing BgpLinkAttrIgpMetric */ public static BgpLinkAttrIgpMetric read(ChannelBuffer cb) throws BgpParseException { int linkigp; int igpMetric = 0; int igpMetricLen = 0; short lsAttrLength = cb.readShort(); if (cb.readableBytes() < lsAttrLength || lsAttrLength > ATTRLINK_MAX_LEN) { Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, lsAttrLength); } switch (lsAttrLength) { case ISIS_SMALL_METRIC: igpMetric = cb.readByte(); igpMetricLen = ISIS_SMALL_METRIC; break; case OSPF_LINK_METRIC: igpMetric = cb.readShort(); igpMetricLen = OSPF_LINK_METRIC; break; case ISIS_WIDE_METRIC: linkigp = cb.readShort(); igpMetric = cb.readByte(); igpMetric = (linkigp << 8) | igpMetric; igpMetricLen = ISIS_WIDE_METRIC; break; default: // validation is already in place break; } return BgpLinkAttrIgpMetric.of(igpMetric, igpMetricLen); } /** * Returns the variable length IGP metric data. * * @return IGP metric data */ public int attrLinkIgpMetric() { return igpMetric; } /** * Returns IGP metric data length. * * @return IGP metric length */ public int attrLinkIgpMetricLength() { return igpMetricLen; } @Override public short getType() { return ATTRLINK_IGPMETRIC; } @Override public int hashCode() { return Objects.hash(igpMetric, igpMetricLen); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof BgpLinkAttrIgpMetric) { BgpLinkAttrIgpMetric other = (BgpLinkAttrIgpMetric) obj; return Objects.equals(igpMetric, other.igpMetric) && Objects.equals(igpMetricLen, other.igpMetricLen); } return false; } @Override public int write(ChannelBuffer cb) { // TODO This will be implemented in the next version return 0; } @Override public String toString() { return MoreObjects.toStringHelper(getClass()) .add("igpMetric", igpMetric).add("igpMetricLen", igpMetricLen) .toString(); } @Override public int compareTo(Object o) { // TODO Auto-generated method stub return 0; } }
29.513966
78
0.638084
d33cd5dc48e37059e998358553ab44cc1a03511c
2,990
/* * Copyright (c) 2022 VMware Inc. or its affiliates, All Rights Reserved. * * Licensed 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 * * https://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. */ package reactor.core.scheduler; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.openjdk.jmh.infra.Blackhole; /** * @author Simon Baslé */ @State(Scope.Benchmark) public class BoundedElasticBusyStructureBenchmark { OldBoundedElasticScheduler oldBoundedElasticScheduler; Scheduler newBoundedElasticScheduler; @Setup(Level.Trial) public void setup() { final AtomicInteger oldCounter = new AtomicInteger(); ThreadFactory oldFactory = r -> new Thread(r, "oldBounded-" + oldCounter.incrementAndGet()); oldBoundedElasticScheduler = new OldBoundedElasticScheduler(100, 10_000, oldFactory, 60 * 1000); oldBoundedElasticScheduler.start(); newBoundedElasticScheduler = Schedulers.newBoundedElastic(100, 10_000, "newBounded", 60, false); } @Benchmark @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 10, time = 1) @Threads(10) @BenchmarkMode({Mode.AverageTime}) public void withArray(Blackhole bh) throws InterruptedException { int runs = 1000; CountDownLatch latch = new CountDownLatch(runs); for (int i = 0; i < runs; i++) { newBoundedElasticScheduler.schedule(latch::countDown); } bh.consume(latch.await(100, TimeUnit.MILLISECONDS)); } @Benchmark() @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 10, time = 1) @Threads(10) @BenchmarkMode({Mode.AverageTime}) public void withPriorityQueue(Blackhole bh) throws InterruptedException { int runs = 1000; CountDownLatch latch = new CountDownLatch(runs); for (int i = 0; i < runs; i++) { oldBoundedElasticScheduler.schedule(latch::countDown); } bh.consume(latch.await(100, TimeUnit.MILLISECONDS)); } }
34.767442
98
0.765217
26d0d1555701aa6dc736b212a93b7aa77b7251a8
328
package com.acme.greeting.api.restful.wso2is.constant; public final class GreetingApiRestfulConfigConstant { private GreetingApiRestfulConfigConstant() { } public static final String GENERIC_PACKAGE = "com.acme.greeting"; public static final String BASE_PACKAGE = GENERIC_PACKAGE + ".api.restful.wso2is"; }
27.333333
84
0.768293
379e9a55ea40f736c493f3687c3300cc043b14fb
768
package martinandersson.com.bytes; /** * Read and write methods of Input- OutputStream accept/return int, which is * an unsigned byte. Casting this unsigned version to (byte) does exactly what * we want to. * * @author Martin Andersson (webmaster at martinandersson.com) */ public class IntToByteCast { public static void main(String[] args) { byte signedByte = -1; int unsignedByte = signedByte & (0xff); // Signed: -1 Unsigned: 255 System.out.println("Signed: " + signedByte + " Unsigned: " + unsignedByte); int maxUnsignedByte = 255; byte signedMaxByte = (byte) maxUnsignedByte; // signedMaxByte: -1 System.out.println("signedMaxByte: " + signedMaxByte); } }
30.72
83
0.638021
c44b2318fdba55d9d744c846bebe5dd6267e9b21
2,580
package com.mycompany.propertytycoon.gui.initialisegame; import com.mycompany.propertytycoon.gui.utils.StageManager; import com.mycompany.propertytycoon.gui.utils.View; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.text.Text; /** * FXML Controller class * * @author ankeet */ public class Player_an_ai_countController implements Initializable { @FXML private Button PlayerPlus, playerMinus, BotPlus, BotMinus, confirm, Back; @FXML private Text PlayerCount, BotCount; private int player_count, bot_count; private StageManager SM = StageManager.getInstance(); /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { player_count = 2; bot_count = 0; PlayerCount.setText(String.valueOf(player_count)); BotCount.setText(String.valueOf(bot_count)); PlayerPlus.setOnAction(e -> { if (player_count < 6 && player_count >= 1) { player_count++; PlayerCount.setText((String.valueOf(player_count))); } }); playerMinus.setOnAction(e -> { if (player_count <= 6 && player_count > 1) { player_count--; PlayerCount.setText((String.valueOf(player_count))); } }); BotPlus.setOnAction(e -> { if (bot_count < 6 && bot_count >= 0) { bot_count++; BotCount.setText((String.valueOf(bot_count))); } }); BotMinus.setOnAction(e -> { if (bot_count <= 6 && bot_count > 0) { bot_count--; BotCount.setText((String.valueOf(bot_count))); } }); confirm.setOnAction(e -> { if (player_count + bot_count <= 6 && player_count + bot_count >= 2) { SM.setPlayerNumber(player_count); SM.setBotNumber(bot_count); SM.changeScene(View.INIT); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Player Count"); alert.setHeaderText("Total player count is " + (player_count + bot_count)); alert.setContentText("Total must be between 2 and 6"); alert.showAndWait(); } }); Back.setOnAction(e -> SM.changeScene(View.MAIN_MENU)); } }
31.851852
91
0.587984
10b4ac7c8f9e01d04e07c5d282dd735cd04f4a7e
2,001
package com.ddabadi.dto.laporan; import com.ddabadi.enumera.StatusTerima; import java.util.Date; /** * Created by deddy on 6/25/16. */ public class LaporanPembelianDto { private Long id; private String namaSupp; private String noFaktur; private Date tglTerima; private String keterangan; private StatusTerima statusTerima; private Double total; private Date tglBayar; private String caraBayar; private String ketBayar; public Date getTglBayar() { return tglBayar; } public void setTglBayar(Date tglBayar) { this.tglBayar = tglBayar; } public String getCaraBayar() { return caraBayar; } public void setCaraBayar(String caraBayar) { this.caraBayar = caraBayar; } public String getKetBayar() { return ketBayar; } public void setKetBayar(String ketBayar) { this.ketBayar = ketBayar; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNamaSupp() { return namaSupp; } public void setNamaSupp(String namaSupp) { this.namaSupp = namaSupp; } public String getNoFaktur() { return noFaktur; } public void setNoFaktur(String noFaktur) { this.noFaktur = noFaktur; } public Date getTglTerima() { return tglTerima; } public void setTglTerima(Date tglTerima) { this.tglTerima = tglTerima; } public String getKeterangan() { return keterangan; } public void setKeterangan(String keterangan) { this.keterangan = keterangan; } public StatusTerima getStatusTerima() { return statusTerima; } public void setStatusTerima(StatusTerima statusTerima) { this.statusTerima = statusTerima; } public Double getTotal() { return total; } public void setTotal(Double total) { this.total = total; } }
19.427184
60
0.626687
9e352ab8290d383751ebf86c5f2e83463d39d19b
977
/* * Copyright © 2018 www.noark.xyz All Rights Reserved. * * 感谢您选择Noark框架,希望我们的努力能为您提供一个简单、易用、稳定的服务器端框架 ! * 除非符合Noark许可协议,否则不得使用该文件,您可以下载许可协议文件: * * http://www.noark.xyz/LICENSE * * 1.未经许可,任何公司及个人不得以任何方式或理由对本框架进行修改、使用和传播; * 2.禁止在本项目或任何子项目的基础上发展任何派生版本、修改版本或第三方版本; * 3.无论你对源代码做出任何修改和改进,版权都归Noark研发团队所有,我们保留所有权利; * 4.凡侵犯Noark版权等知识产权的,必依法追究其法律责任,特此郑重法律声明! */ package com.company.game.event; import xyz.noark.core.annotation.Autowired; import xyz.noark.core.annotation.Service; import xyz.noark.core.event.EventManager; import javax.annotation.PostConstruct; /** * 联盟业务. * * @author 小流氓[176543888@qq.com] * @since 3.2.6 */ @Service public class AllianceService { @Autowired private EventManager eventManager; @PostConstruct public void init() { // 模拟1号玩家创建名称为天下的联盟 eventManager.publish(new AllianceCreateEvent(1L, "天下")); // 模拟2号玩家加入名称为天下的联盟 eventManager.publish(new AllianceJoinEvent(2L, "天下")); } }
23.261905
64
0.718526
e3a86599c3fbcf0a165bcd625e1a5b74703fd624
4,006
/* * The MIT License * Copyright © 2014-2019 Ilkka Seppälä * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.iluwatar.pageobject; import java.awt.Desktop; import java.io.File; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Page Object pattern wraps an UI component with an application specific API allowing you to * manipulate the UI elements without having to dig around with the underlying UI technology used. * This is especially useful for testing as it means your tests will be less brittle. Your tests can * concentrate on the actual test cases where as the manipulation of the UI can be left to the * internals of the page object itself. * * <p>Due to this reason, it has become very popular within the test automation community. In * particular, it is very common in that the page object is used to represent the html pages of a * web application that is under test. This web application is referred to as AUT (Application Under * Test). A web browser automation tool/framework like Selenium for instance, is then used to drive * the automating of the browser navigation and user actions journeys through this web application. * Your test class would therefore only be responsible for particular test cases and page object * would be used by the test class for UI manipulation required for the tests. * * <p>In this implementation rather than using Selenium, the HtmlUnit library is used as a * replacement to represent the specific html elements and to drive the browser. The purpose of this * example is just to provide a simple version that showcase the intentions of this pattern and how * this pattern is used in order to understand it. */ public final class App { private static final Logger LOGGER = LoggerFactory.getLogger(App.class); private App() { } /** * Application entry point * * <p>The application under development is a web application. Normally you would probably have a * backend that is probably implemented in an object-oriented language (e.g. Java) that serves the * frontend which comprises of a series of HTML, CSS, JS etc... * * <p>For illustrations purposes only, a very simple static html app is used here. This main * method just fires up this simple web app in a default browser. * * @param args arguments */ public static void main(String[] args) { try { File applicationFile = new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath()); // should work for unix like OS (mac, unix etc...) if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(applicationFile); } else { // java Desktop not supported - above unlikely to work for Windows so try instead... Runtime.getRuntime().exec("cmd.exe start " + applicationFile); } } catch (IOException ex) { LOGGER.error("An error occured.", ex); } } }
43.543478
100
0.738392
9ca71effc98937a601a4de722fa4515cd0466b35
4,514
package com.programmerdan.minecraft.cropcontrol.handler; import java.util.LinkedList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.programmerdan.minecraft.cropcontrol.config.DropConfig; import com.programmerdan.minecraft.cropcontrol.CropControl; import com.programmerdan.minecraft.cropcontrol.config.RootConfig; import com.programmerdan.minecraft.cropcontrol.config.ToolConfig; import vg.civcraft.mc.civmodcore.command.Command; import vg.civcraft.mc.civmodcore.command.CommandHandler; import vg.civcraft.mc.civmodcore.command.PlayerCommand; public class CropControlCommandHandler extends CommandHandler { @Override public void registerCommands() { this.addCommands( new Generate("ccgen") ); this.addCommands( new CropControlCommand("cropcontrol") ); } private class Generate extends PlayerCommand { public Generate(String name) { super(name); setIdentifier("ccgen"); setDescription("Generates all CC drops around calling player"); setUsage("/ccgen"); setArguments(0,1); setSenderMustBePlayer(true); } @Override public boolean execute(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Cannot be run as console"); } Player player = (Player) sender; double mult = 1; try { mult = Integer.parseInt(args[0]); } catch (Exception e) {mult = 1;} final double vmult = mult; sender.sendMessage("Force loading all configs and generating all drops, this could cause lag"); Bukkit.getScheduler().runTaskAsynchronously(CropControl.getPlugin(), new Runnable() { @Override public void run() { long delay = 0l; FileConfiguration config = CropControl.getPlugin().getConfig(); ConfigurationSection crops = config.getConfigurationSection("crops"); ConfigurationSection saplings = config.getConfigurationSection("saplings"); ConfigurationSection trees = config.getConfigurationSection("trees"); List<String> indexMap = new LinkedList<String>(); for (String crop : crops.getKeys(false)) { ConfigurationSection cropConfig = crops.getConfigurationSection(crop); if (!cropConfig.isConfigurationSection("drops")) { for (String subtype : cropConfig.getKeys(false)) { indexMap.add("crops." + crop + "." + subtype); } } else { indexMap.add("crops." + crop); } } for (String sapling : saplings.getKeys(false)) { indexMap.add("saplings." + sapling); } for (String tree : trees.getKeys(false)) { indexMap.add("trees." + tree); } for (String index : indexMap) { RootConfig rootConfig = RootConfig.from(index); if (rootConfig != null) { for (String drop : rootConfig.getDropList()) { DropConfig dropConfig = DropConfig.byIdent(drop); List<ItemStack> drops = dropConfig.getDrops((int) vmult); if (drops != null && !drops.isEmpty()) { for (ItemStack item : drops) { Bukkit.getScheduler().runTaskLater(CropControl.getPlugin(), new Runnable() { @Override public void run() { sender.sendMessage(String.format("Root: %s, drop: %s, item: %s", index, drop, item.getType())); Item dropped = player.getWorld().dropItem(player.getLocation().add(0, 1.0, 0), item); dropped.setPickupDelay(20); } }, delay++); } } } } } } }); return false; } @Override public List<String> tabComplete(CommandSender arg0, String[] arg1) { return null; } } private class CropControlCommand extends PlayerCommand { public CropControlCommand(String name) { super(name); setIdentifier("cropcontrol"); setDescription("Reloads the configuration"); setUsage("/cropcontrol"); setArguments(0,0); setSenderMustBePlayer(false); } @Override public boolean execute(CommandSender sender, String[] arg1) { RootConfig.reload(); DropConfig.reload(); ToolConfig.clear(); sender.sendMessage("Configuration cleared, will progressively reload."); return true; } @Override public List<String> tabComplete(CommandSender arg0, String[] arg1) { return null; } } }
30.5
107
0.682322
36070af68d66564ced9752fe654603a99b04820f
1,800
/** * Copyright 2019 Anthony Trinh * * Licensed 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. */ package ch.qos.logback.core.util; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /** * A synchronized implementation of SimpleDateFormat which uses caching internally. * * @author Ceki G&uuml;c&uuml; * @since 0.9.29 */ public class CachingDateFormatter { long lastTimestamp = -1; String cachedStr = null; final SimpleDateFormat sdf; public CachingDateFormatter(String pattern) { this(pattern, Locale.US); } public CachingDateFormatter(String pattern, Locale locale) { sdf = new SimpleDateFormat(pattern, locale); } public final String format(long now) { // SimpleDateFormat is not thread safe. // See also the discussion in http://jira.qos.ch/browse/LBCLASSIC-36 // DateFormattingThreadedThroughputCalculator and SelectiveDateFormattingRunnable // are also note worthy // The now == lastTimestamp guard minimizes synchronization synchronized (this) { if (now != lastTimestamp) { lastTimestamp = now; cachedStr = sdf.format(new Date(now)); } return cachedStr; } } public void setTimeZone(TimeZone tz) { sdf.setTimeZone(tz); } }
27.272727
85
0.715556
ac49cee290a1c311ea7ebc678274c7b74d866507
18,736
package com.google.android.gms.example.exercisesforthebrain; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Handler; import android.os.SystemClock; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.transition.Explode; import android.transition.Transition; import android.transition.TransitionManager; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Chronometer; import android.widget.TextView; import com.google.android.gms.example.exercisesforthebrain.data.Contract; import com.google.android.gms.example.exercisesforthebrain.utilities.GeneralUtilities; import com.google.android.gms.example.exercisesforthebrain.utilities.Timer; import java.util.Arrays; import java.util.Collections; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import butterknife.OnFocusChange; public class TestColorActivity extends AppCompatActivity { private static final String STATE_COLORA = "01"; private static final String STATE_COLORB = "02"; private static final String STATE_COLORC = "03"; private static final String STATE_TEXTTITLE = "04"; private static final String STATE_COLORTITLE = "05"; private static final String STATE_TIMER = "0"; private static final String STATE_ITEMSANSWERED = "06"; private static final String STATE_BOOLEANSTART = "07"; private static final String STATE_ANSWEREASERTED = "08"; @BindView(R.id.fabOption1TestColorId) FloatingActionButton fabOption1; @BindView(R.id.fabOption2TestColorId) FloatingActionButton fabOption2; @BindView(R.id.fabOption3TestColorId) FloatingActionButton fabOption3; @BindView(R.id.buttonStartId) Button startChro; @BindView(R.id.buttonPerformanceColorId) Button perform; @BindView(R.id.textViewSubtitleId) TextView subtitleApp; @BindView(R.id.textViewDescriptionExerId) TextView descriptionExercise; @BindView(R.id.textViewMathQuestionId) TextView textViewWordColorId; private Long baseTime; private Long referencetime; private boolean restore = false; private boolean startButtonboolean = false; private boolean clickPerformance = false; private Chronometer crono; private ActionBar ab; private int itemForTestColor = 1; private String textTitleForColorExercise; private int intColorTitle; private int colorA; private int colorB; private int colorC; private List<Integer> ListPosibleposibleSelectedColorsTitle; private List<Integer> ListPosibleSelectedColorText; private List<String> ListText; private Explode mExplode; private ViewGroup mRootView; private String sharedText; private int correctAnswer = 0; private String substrSharedText; private Context context; private String[] textColorArray = {"PURPLE", "YELLOW", "ORANGE", "GREEN", "BLUE", "RED", "GREY", "BLACK", "BROWN"}; private Integer[] posibleSelectedColorsText = {0, 1, 2}; private Integer[] posibleSelectedColorsTitle = {0, 1, 2}; protected void generatorValues() { String textColorSelection; Collections.shuffle(ListText); Collections.shuffle(ListPosibleposibleSelectedColorsTitle); Collections.shuffle(ListPosibleSelectedColorText); //Select any of the first three options on the array over all colors available after shuffe textTitleForColorExercise = ListText.get(ListPosibleposibleSelectedColorsTitle.get(0)); //Selec the first option after shuffe the three first text colors textColorSelection = ListText.get(ListPosibleSelectedColorText.get(0)); //Extract the int value of the text Color intColorTitle = getColorFromText(textColorSelection); colorA = getColorFromText(ListText.get(0)); colorB = getColorFromText(ListText.get(1)); colorC = getColorFromText(ListText.get(2)); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test_color); ButterKnife.bind(this); context = getApplicationContext(); Intent intent = getIntent(); //Required to know the day of activity and for store statistic information sharedText = intent.getStringExtra("dayTest"); substrSharedText = sharedText.substring(4); // Get the root view and create a transition mRootView = findViewById(R.id.activityTextLayout); mExplode = new Explode(); mExplode.setDuration(300); ListPosibleposibleSelectedColorsTitle = Arrays.asList(posibleSelectedColorsTitle); ListPosibleSelectedColorText = Arrays.asList(posibleSelectedColorsText); ListText = Arrays.asList(textColorArray); generatorValues(); startChro = findViewById(R.id.buttonStartId); crono = findViewById(R.id.chronometerId); Transition enterTrans = new Explode(); enterTrans.setDuration(300); getWindow().setEnterTransition(enterTrans); Transition returnTrans = new Explode(); returnTrans.setDuration(300); Transition exitTrans = new Explode(); exitTrans.setDuration(300); Transition reenterTrans = new Explode(); reenterTrans.setDuration(800); Toolbar toolbar = findViewById(R.id.toolbarTestStartAlphaId); setSupportActionBar(toolbar); // Get a support ActionBar corresponding to this toolbar ab = getSupportActionBar(); // Enable the Up button if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); } setValuesColorActivity(); fabOption1.setEnabled(false); fabOption2.setEnabled(false); fabOption3.setEnabled(false); crono.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { crono.setBackgroundColor(getColor(R.color.focus_button)); } else { crono.setBackgroundColor(Color.TRANSPARENT); } } }); } @Override public void onResume() { super.onResume(); if (startButtonboolean) { if (referencetime != null) { referencetime = SystemClock.elapsedRealtime() - baseTime; crono.setBase(referencetime); crono.start(); } } } @Override public void onStop() { super.onStop(); if (startButtonboolean) { if (!clickPerformance) { baseTime = SystemClock.elapsedRealtime() - crono.getBase(); referencetime = baseTime; crono.stop(); } } } @Override public void onSaveInstanceState(Bundle savedInstanceState) { if (!clickPerformance) { // Save UI state changes to the savedInstanceState. savedInstanceState.putInt(STATE_COLORA, colorA); savedInstanceState.putInt(STATE_COLORB, colorB); savedInstanceState.putInt(STATE_COLORC, colorC); savedInstanceState.putInt(STATE_COLORTITLE, intColorTitle); savedInstanceState.putString(STATE_TEXTTITLE, textTitleForColorExercise); savedInstanceState.putInt(STATE_ITEMSANSWERED, itemForTestColor); savedInstanceState.putLong(STATE_TIMER, SystemClock.elapsedRealtime() - crono.getBase()); savedInstanceState.putBoolean(STATE_BOOLEANSTART, startButtonboolean); savedInstanceState.putInt(STATE_ANSWEREASERTED, correctAnswer); super.onSaveInstanceState(savedInstanceState); } } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { // Call the superclass so it can restore the view hierarchy super.onRestoreInstanceState(savedInstanceState); // Restore state members from saved instance colorA = savedInstanceState.getInt(STATE_COLORA); colorB = savedInstanceState.getInt(STATE_COLORB); colorC = savedInstanceState.getInt(STATE_COLORC); intColorTitle = savedInstanceState.getInt(STATE_COLORTITLE); textTitleForColorExercise = savedInstanceState.getString(STATE_TEXTTITLE); itemForTestColor = savedInstanceState.getInt(STATE_ITEMSANSWERED); baseTime = savedInstanceState.getLong(STATE_TIMER); startButtonboolean = savedInstanceState.getBoolean(STATE_BOOLEANSTART); correctAnswer = savedInstanceState.getInt(STATE_ANSWEREASERTED); restore = true; if (startButtonboolean) { String questionColorAnswered = getString(R.string.questionAnswered) + " " + itemForTestColor + getString(R.string.questionSing); descriptionExercise.setText(questionColorAnswered); startprocedure(); } else { baseTime = 0L; crono.stop(); setValuesColorActivity(); } } @OnFocusChange({ R.id.buttonStartId, R.id.buttonPerformanceColorId }) void onfocusbutton(boolean hasFocus, Button button) { switch (button.getId()) { case R.id.buttonStartId: if (hasFocus) { startChro.setBackgroundColor(getColor(R.color.colorfocusmathedayexe)); startChro.setTextColor(Color.WHITE); } else { startChro.setBackgroundColor(getColor(R.color.colorfabbuttondayactivity)); startChro.setTextColor(Color.WHITE); } break; case R.id.buttonPerformanceColorId: if (hasFocus) { perform.setBackgroundColor(getColor(R.color.colorfocusmathedayexe)); perform.setTextColor(Color.WHITE); } else { perform.setBackgroundColor(getColor(R.color.colorfabbuttondayactivity)); perform.setTextColor(Color.WHITE); } break; } } @OnFocusChange({ R.id.textViewSubtitleId, R.id.textViewDescriptionExerId, R.id.textViewMathQuestionId, }) void onfocustext(boolean hasFocus, TextView text) { switch (text.getId()) { case R.id.textViewSubtitleId: if (hasFocus) { subtitleApp.setBackgroundColor(Color.TRANSPARENT); subtitleApp.setTextColor(Color.WHITE); } else { subtitleApp.setBackgroundColor(Color.TRANSPARENT); subtitleApp.setTextColor(Color.WHITE); } break; case R.id.textViewDescriptionExerId: if (hasFocus) { descriptionExercise.setBackgroundColor(getColor(R.color.focus_button)); } else { descriptionExercise.setBackgroundColor(Color.TRANSPARENT); } break; case R.id.textViewMathQuestionId: if (hasFocus) { textViewWordColorId.setBackgroundColor(getColor(R.color.focus_button)); } else { textViewWordColorId.setBackgroundColor(Color.TRANSPARENT); } break; } } private void startprocedure() { ab.setDisplayHomeAsUpEnabled(false); crono.setBase(SystemClock.elapsedRealtime()); crono.start(); if (restore) { referencetime = SystemClock.elapsedRealtime() - baseTime; crono.setBase(referencetime); } setValuesColorActivity(); fabOption1.setEnabled(true); fabOption2.setEnabled(true); fabOption3.setEnabled(true); // Start recording changes to the view hierarchy TransitionManager.beginDelayedTransition(mRootView, mExplode); // Add the new TextView to the view hierarchy mRootView.removeView(startChro); mRootView.removeView(perform); } @OnClick({ R.id.buttonStartId, R.id.buttonPerformanceColorId }) void buttons(Button button) { switch (button.getId()) { case R.id.buttonStartId: startButtonboolean = true; generatorValues(); startprocedure(); break; case R.id.buttonPerformanceColorId: clickPerformance = true; Intent mathPerformance = new Intent(TestColorActivity.this, PerformanceAcivity.class); mathPerformance.putExtra("data", "color"); startActivity(mathPerformance); break; } } @OnClick({ R.id.fabOption1TestColorId, R.id.fabOption2TestColorId, R.id.fabOption3TestColorId, }) void floatingbuttons(FloatingActionButton buttonpresed) { switch (buttonpresed.getId()) { case R.id.fabOption1TestColorId: wramUpTestColorActivity(intColorTitle, 1, colorA, colorB, colorC); itemForTestColor++; break; case R.id.fabOption2TestColorId: wramUpTestColorActivity(intColorTitle, 2, colorA, colorB, colorC); itemForTestColor++; break; case R.id.fabOption3TestColorId: wramUpTestColorActivity(intColorTitle, 3, colorA, colorB, colorC); itemForTestColor++; break; } } protected int getColorFromText(String textColor) { switch (textColor) { case "PURPLE": return getColor(R.color.colorPurple); case "YELLOW": return getColor(R.color.colorYellow); case "ORANGE": return getColor(R.color.colorOrange); case "GREEN": return getColor(R.color.colorGeen); case "BLUE": return getColor(R.color.colorBlue); case "RED": return getColor(R.color.colorRed); case "GREY": return getColor(R.color.colorGrey); case "BLACK": return getColor(R.color.colorBlack); case "BROWN": return getColor(R.color.colorBrown); } return 0; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finishAfterTransition(); return true; } return super.onOptionsItemSelected(item); } protected void setValuesColorActivity() { if (!restore) { generatorValues(); } textViewWordColorId.setText(textTitleForColorExercise); textViewWordColorId.setTextColor(intColorTitle); fabOption1.setBackgroundTintList(ColorStateList.valueOf(colorA)); fabOption1.setContentDescription(ListText.get(0)); fabOption2.setBackgroundTintList(ColorStateList.valueOf(colorB)); fabOption2.setContentDescription(ListText.get(1)); fabOption3.setBackgroundTintList(ColorStateList.valueOf(colorC)); fabOption3.setContentDescription(ListText.get(2)); } protected void wramUpTestColorActivity(final int colorint, int value, final int colorA, final int colorB, final int colorC) { if (value == 1) { if (colorint - colorA == 0) { fabOption1.setImageResource((R.drawable.ic_check_white_48dp)); correctAnswer++; } else { fabOption1.setImageResource((R.drawable.ic_clear_white_48dp)); } } else if (value == 2) { if (colorint - colorB == 0) { fabOption2.setImageResource((R.drawable.ic_check_white_48dp)); correctAnswer++; } else { fabOption2.setImageResource((R.drawable.ic_clear_white_48dp)); } } else if (value == 3) { if (colorint - colorC == 0) { fabOption3.setImageResource((R.drawable.ic_check_white_48dp)); correctAnswer++; } else { fabOption3.setImageResource((R.drawable.ic_clear_white_48dp)); } } fabOption1.setEnabled(false); fabOption2.setEnabled(false); fabOption3.setEnabled(false); delayResultextColor(); } protected void delayResultextColor() { //Delay to show result, and generate new value for the next question. final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { fabOption1.setImageResource(android.R.color.transparent); fabOption2.setImageResource(android.R.color.transparent); fabOption3.setImageResource(android.R.color.transparent); TransitionManager.beginDelayedTransition(mRootView, mExplode); generatorValues(); setValuesColorActivity(); fabOption1.setEnabled(true); fabOption2.setEnabled(true); fabOption3.setEnabled(true); String questionColorAnswered = getString(R.string.questionAnswered) + " " + itemForTestColor + getString(R.string.questionSing); descriptionExercise.setText(questionColorAnswered); } }, 500); if (itemForTestColor == 30) { String timeElapsed = Timer.showElapsedTime(crono); ContentValues quoteCVA = new ContentValues(); quoteCVA.put(Contract.Entry.COLUMN_COLOR, String.valueOf(correctAnswer + "," + timeElapsed)); GeneralUtilities.requestToLocalDataBase(context, substrSharedText, quoteCVA); Intent intent = new Intent(TestColorActivity.this, DayActivity.class); intent.putExtra("identity", sharedText); //Close "Day activity" and the current Activity. intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } } }
38.472279
144
0.639037
260cef3b144e5e8cb02928eae84b03c621ed2ef1
374
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package livestreamerJGUI; /** * * @author Matthias */ public enum Quality { source, best, high, medium, low, mobile_source, mobile_high, mobile_medium, mobile_low, mobile_mobile }
23.375
105
0.73262
d7df26c33dea4839c55db000e9979ff27d508355
1,567
package net.anotheria.moskito.core.threshold; import net.anotheria.moskito.core.predefined.ServiceStats; import net.anotheria.moskito.core.producers.IStats; import net.anotheria.moskito.core.producers.IStatsProducer; import net.anotheria.moskito.core.registry.ProducerRegistryFactory; import java.util.ArrayList; import java.util.List; public class DummyStatProducer implements IStatsProducer { private List<IStats> stats = new ArrayList<IStats>(); ServiceStats dynamic; private String producerId = "dummy"; public DummyStatProducer(String aProducerId){ producerId = aProducerId; ServiceStats stat1 = new ServiceStats("first"); ServiceStats stat2 = new ServiceStats("second"); ServiceStats stat3 = new ServiceStats("third"); ServiceStats stat4 = new ServiceStats("dynamic"); dynamic = stat4; for (int i=0; i<100; i++){ stat1.addRequest(); stat2.addRequest();stat2.addRequest(); stat3.addRequest();stat3.addRequest();stat3.addRequest(); } stats.add(stat1);stats.add(stat2);stats.add(stat3);stats.add(stat4); ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(this); } @Override public List<IStats> getStats() { return stats; } @Override public String getProducerId() { return producerId; } @Override public String getCategory() { return "default"; } @Override public String getSubsystem() { return "default"; } public void increaseDynamic(){ dynamic.addRequest(); } public long getDynamicTR(String intervalName){ return dynamic.getTotalRequests(intervalName); } }
24.107692
79
0.752393
62e828843d2c70364d5a14945e40d8cac9847cb5
6,168
/**************************************************************** * 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. * ****************************************************************/ package org.apache.james.mailbox.inmemory.mail; import java.util.List; import java.util.Set; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Predicate; import org.apache.commons.lang3.StringUtils; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.model.MailboxAnnotation; import org.apache.james.mailbox.model.MailboxAnnotationKey; import org.apache.james.mailbox.model.MailboxId; import org.apache.james.mailbox.store.mail.AnnotationMapper; import org.apache.james.util.streams.Iterators; import com.github.steveash.guavate.Guavate; import com.google.common.base.Preconditions; import com.google.common.collect.HashBasedTable; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Table; public class InMemoryAnnotationMapper implements AnnotationMapper { private final Table<InMemoryId, String, String> mailboxesAnnotations; private final ReadWriteLock lock = new ReentrantReadWriteLock(); public InMemoryAnnotationMapper() { mailboxesAnnotations = HashBasedTable.create(); } @Override public void endRequest() { } @Override public <T> T execute(Transaction<T> transaction) throws MailboxException { return transaction.run(); } private Iterable<MailboxAnnotation> retrieveAllAnnotations(InMemoryId mailboxId) { lock.readLock().lock(); try { return Iterables.transform( mailboxesAnnotations.row(mailboxId).entrySet(), input -> MailboxAnnotation.newInstance(new MailboxAnnotationKey(input.getKey()), input.getValue())); } finally { lock.readLock().unlock(); } } @Override public List<MailboxAnnotation> getAllAnnotations(MailboxId mailboxId) { return ImmutableList.copyOf(retrieveAllAnnotations((InMemoryId) mailboxId)); } @Override public List<MailboxAnnotation> getAnnotationsByKeys(MailboxId mailboxId, final Set<MailboxAnnotationKey> keys) { return ImmutableList.copyOf( Iterables.filter(retrieveAllAnnotations((InMemoryId) mailboxId), input -> keys.contains(input.getKey()))); } @Override public List<MailboxAnnotation> getAnnotationsByKeysWithAllDepth(MailboxId mailboxId, final Set<MailboxAnnotationKey> keys) { return Iterators.toStream(retrieveAllAnnotations((InMemoryId) mailboxId).iterator()) .filter(getPredicateFilterByAll(keys)) .collect(Guavate.toImmutableList()); } @Override public List<MailboxAnnotation> getAnnotationsByKeysWithOneDepth(MailboxId mailboxId, final Set<MailboxAnnotationKey> keys) { return getAnnotationsByKeysWithAllDepth(mailboxId, keys) .stream() .filter(getPredicateFilterByOne(keys)) .collect(Guavate.toImmutableList()); } private Predicate<MailboxAnnotation> getPredicateFilterByAll(final Set<MailboxAnnotationKey> keys) { return input -> keys.stream().anyMatch(filterAnnotationsByPrefix(input)); } private Predicate<MailboxAnnotation> getPredicateFilterByOne(final Set<MailboxAnnotationKey> keys) { return input -> keys.stream().anyMatch(filterAnnotationsByParentKey(input.getKey())); } private Predicate<MailboxAnnotationKey> filterAnnotationsByParentKey(final MailboxAnnotationKey input) { return key -> input.countComponents() <= (key.countComponents() + 1); } private Predicate<MailboxAnnotationKey> filterAnnotationsByPrefix(final MailboxAnnotation input) { return key -> key.equals(input.getKey()) || StringUtils.startsWith(input.getKey().asString(), key.asString() + "/"); } @Override public void insertAnnotation(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation) { Preconditions.checkArgument(!mailboxAnnotation.isNil()); lock.writeLock().lock(); try { mailboxesAnnotations.put((InMemoryId) mailboxId, mailboxAnnotation.getKey().asString(), mailboxAnnotation.getValue().get()); } finally { lock.writeLock().unlock(); } } @Override public void deleteAnnotation(MailboxId mailboxId, MailboxAnnotationKey key) { lock.writeLock().lock(); try { mailboxesAnnotations.remove((InMemoryId) mailboxId, key.asString()); } finally { lock.writeLock().unlock(); } } @Override public boolean exist(MailboxId mailboxId, MailboxAnnotation mailboxAnnotation) { return mailboxesAnnotations.contains((InMemoryId) mailboxId, mailboxAnnotation.getKey().asString()); } @Override public int countAnnotations(MailboxId mailboxId) { return mailboxesAnnotations.row((InMemoryId) mailboxId).size(); } }
41.395973
136
0.680447
6376e47ae1a5f8ca4cb7d363563f66d9e7892ca2
2,181
/* * Copyright (c) 2019 Taner Sener * * This file is part of FlutterFFmpeg. * * FlutterFFmpeg is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FlutterFFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with FlutterFFmpeg. If not, see <http://www.gnu.org/licenses/>. */ package org.openponce.open_camera; import android.os.Handler; import android.os.Looper; import io.flutter.plugin.common.EventChannel; import io.flutter.plugin.common.MethodChannel; /** * <h3>Flutter FFmpeg Result Handler</h3> * * @author Taner Sener * @since 0.2.2 */ class FlutterFFmpegResultHandler { private final Handler handler; FlutterFFmpegResultHandler() { handler = new Handler(Looper.getMainLooper()); } void notImplemented(final MethodChannel.Result result) { handler.post(new Runnable() { @Override public void run() { if (result != null) { result.notImplemented(); } } }); } void success(final MethodChannel.Result result, final Object object) { handler.post(new Runnable() { @Override public void run() { if (result != null) { result.success(object); } } }); } void success(final EventChannel.EventSink eventSink, final Object object) { handler.post(new Runnable() { @Override public void run() { if (eventSink != null) { eventSink.success(object); } } }); } }
27.961538
80
0.589638